Skip to content

Commit

Permalink
Make Dilate arguments JSON serializable (#81)
Browse files Browse the repository at this point in the history
  • Loading branch information
caspervdw committed Nov 19, 2020
1 parent d12eecd commit 3ed3b42
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Changelog of dask-geomodeling
2.3.2 (unreleased)
------------------

- Nothing changed yet.
- Make Dilate arguments JSON serializable. (#81)


2.3.1 (2020-11-10)
Expand Down Expand Up @@ -621,4 +621,3 @@ Changelog of dask-geomodeling
- Fixed issue with ciso8601 2.*

- Bumped raster-store dependency to 4.0.0.

4 changes: 2 additions & 2 deletions dask_geomodeling/raster/spatial.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ class Dilate(BaseSingle):

def __init__(self, store, values):
values = np.asarray(values, dtype=store.dtype)
super(Dilate, self).__init__(store, values)
super().__init__(store, values.tolist())

@property
def values(self):
Expand All @@ -151,7 +151,7 @@ def process(data, values=None):
return data
original = data["values"]
dilated = original.copy()
for value in values:
for value in np.asarray(values, dtype=original.dtype):
dilated[ndimage.binary_dilation(original == value)] = value
dilated = dilated[:, 1:-1, 1:-1]
return {"values": dilated, "no_data_value": data["no_data_value"]}
Expand Down

0 comments on commit 3ed3b42

Please sign in to comment.