Skip to content

Commit 44be51e

Browse files
clausmichelesoxofaan
authored andcommitted
FIx load_stac parameters
1 parent 0db9a79 commit 44be51e

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

openeo/local/connection.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -207,19 +207,21 @@ def load_stac(
207207
"""
208208
arguments = {"url": url}
209209
# TODO: more normalization/validation of extent/band parameters and `properties`
210-
if spatial_extent:
210+
if spatial_extent is not None:
211211
arguments["spatial_extent"] = spatial_extent
212-
if temporal_extent:
212+
if temporal_extent is not None:
213213
arguments["temporal_extent"] = DataCube._get_temporal_extent(temporal_extent)
214-
if bands:
214+
if bands is not None:
215215
arguments["bands"] = bands
216-
if properties:
216+
if properties is not None:
217217
arguments["properties"] = properties
218218
cube = self.datacube_from_process(process_id="load_stac", **arguments)
219219
# detect actual metadata from URL
220220
# run load_stac to get the datacube metadata
221-
arguments["spatial_extent"] = BoundingBox.parse_obj(spatial_extent)
222-
arguments["temporal_extent"] = TemporalInterval.parse_obj(temporal_extent)
221+
if spatial_extent is not None:
222+
arguments["spatial_extent"] = BoundingBox.parse_obj(spatial_extent)
223+
if temporal_extent is not None:
224+
arguments["temporal_extent"] = TemporalInterval.parse_obj(temporal_extent)
223225
xarray_cube = load_stac(**arguments)
224226
attrs = xarray_cube.attrs
225227
for at in attrs:

0 commit comments

Comments
 (0)