Skip to content

Commit

Permalink
Fix clip block more. (#126)
Browse files Browse the repository at this point in the history
  • Loading branch information
arjanverkerk authored Oct 28, 2024
1 parent b84b164 commit ec36044
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Changelog of dask-geomodeling
2.5.4 (unreleased)
------------------

- Nothing changed yet.
- Fix clip block when start is None.


2.5.3 (2024-10-28)
Expand Down
4 changes: 3 additions & 1 deletion dask_geomodeling/raster/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ def get_sources_and_requests(self, **request):
if period is None:
return [(None, None), (None, None)]

start = request.get("start", period[1])
start = request.get("start")
if start is None:
start = period[1]
stop = request.get("stop")

if stop is not None:
Expand Down
8 changes: 8 additions & 0 deletions dask_geomodeling/tests/test_raster_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,14 @@ def test_clip_no_temporal_overlap(source, vals_request):
assert clip.get_data(**vals_request) is None


def test_clip_request_start_is_none(source, point_request):
clip = raster.Clip(source, source)
point_request["start"] = None
point_request["stop"] = None
result = clip.get_data(**point_request)["values"].item()
assert result == 255


def test_reclassify(source, vals_request):
view = raster.Reclassify(store=source, data=[[7, 1000]])
data = view.get_data(**vals_request)
Expand Down

0 comments on commit ec36044

Please sign in to comment.