From 2f3ae8d23ebcf3fe71e58fa0cbbe71682296c7d6 Mon Sep 17 00:00:00 2001 From: Arjan Verkerk Date: Mon, 28 Oct 2024 12:06:32 +0100 Subject: [PATCH] Fix clip block more. --- CHANGES.rst | 2 +- dask_geomodeling/raster/misc.py | 4 +++- dask_geomodeling/tests/test_raster_misc.py | 8 ++++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index a103985..0fb781c 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -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) diff --git a/dask_geomodeling/raster/misc.py b/dask_geomodeling/raster/misc.py index 944962d..5461e63 100644 --- a/dask_geomodeling/raster/misc.py +++ b/dask_geomodeling/raster/misc.py @@ -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: diff --git a/dask_geomodeling/tests/test_raster_misc.py b/dask_geomodeling/tests/test_raster_misc.py index 0098921..287a91c 100644 --- a/dask_geomodeling/tests/test_raster_misc.py +++ b/dask_geomodeling/tests/test_raster_misc.py @@ -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)