From 283369f79016fcb98d1c0148d0ecc1e8929c880d Mon Sep 17 00:00:00 2001 From: calvintr Date: Wed, 8 Jun 2022 17:54:56 +0200 Subject: [PATCH 1/2] Removing enumerate from iterable in response to comments --- atlite/gis.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/atlite/gis.py b/atlite/gis.py index a6cc72d1..617b4d21 100644 --- a/atlite/gis.py +++ b/atlite/gis.py @@ -438,7 +438,7 @@ def shape_availability(geometry, excluder): # For the following: 0 is eligible, 1 in excluded raster = None - for idx, d in enumerate(excluder.rasters, start=1): + for d in excluder.rasters: # allow reusing preloaded raster with different post-processing if raster != d["raster"]: raster = d["raster"] @@ -463,7 +463,7 @@ def shape_availability(geometry, excluder): exclusions = exclusions | masked_ - for idx, d in enumerate(excluder.geometries, start=1): + for d in excluder.rasters: masked = ~geometry_mask(d["geometry"], shape, transform, invert=d["invert"]) exclusions = exclusions | masked From 17c2fbc605c1975f42b27408f2761f152e0a337e Mon Sep 17 00:00:00 2001 From: calvintr Date: Wed, 8 Jun 2022 18:06:43 +0200 Subject: [PATCH 2/2] Fix wrong iterable --- atlite/gis.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/atlite/gis.py b/atlite/gis.py index 617b4d21..5b4056b1 100644 --- a/atlite/gis.py +++ b/atlite/gis.py @@ -463,7 +463,7 @@ def shape_availability(geometry, excluder): exclusions = exclusions | masked_ - for d in excluder.rasters: + for d in excluder.geometries: masked = ~geometry_mask(d["geometry"], shape, transform, invert=d["invert"]) exclusions = exclusions | masked