Skip to content

Commit 3db15c5

Browse files
fix obvious errors
1 parent 176db2d commit 3db15c5

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

climada/util/earth_engine.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@ def obtain_image_median(collection, time_range, area):
9797
return image_median
9898

9999
def obtain_image_sentinel(sentinel_collection, time_range, area):
100-
"""Selection of median, cloud-free image from a collection of images in the Sentinel 2 dataset
100+
"""Selection of median, cloud-free image from a collection of images in the Sentinel 2
101+
dataset.
101102
See also: https://developers.google.com/earth-engine/datasets/catalog/COPERNICUS_S2
102103
103104
Parameters
@@ -148,14 +149,13 @@ def get_region(geom):
148149
region : list
149150
"""
150151
if isinstance(geom, ee.Geometry):
151-
region = geom.getInfo()["coordinates"]
152-
elif isinstance(geom, ee.Feature, ee.Image):
153-
region = geom.geometry().getInfo()["coordinates"]
154-
elif isinstance(geom, list):
155-
condition = all([isinstance(item) == list for item in geom])
156-
if condition:
157-
region = geom
158-
return region
152+
return geom.getInfo()["coordinates"]
153+
elif isinstance(geom, (ee.Feature, ee.Image)):
154+
return geom.geometry().getInfo()["coordinates"]
155+
else:
156+
raise ValueError(
157+
"parameter must be one of `ee.Geometry`, `ee.Feature`, `ee.Image`"
158+
)
159159

160160
def get_url(name, image, scale, region):
161161
"""It will open and download automatically a zip folder containing Geotiff data of 'image'.

0 commit comments

Comments
 (0)