Skip to content

bbox in ItemsCollection.to_xarray(geometry=bbox) does not update the bounds of resultint xarray

The following code

collection_items_xarray_bbox = self.collection_items.to_xarray(geometry=self.bbox) 
print(collection_items_xarray_bbox.shape, collection_items_xarray_bbox.attrs['spec'].bounds)
            

collection_items_xarray = self.collection_items.to_xarray() 
print(collection_items_xarray.shape,collection_items_xarray.attrs['spec'].bounds)

results in the following output

(19, 9, 4116, 10980) (600000.0, 1190220.0, 709800.0, 1235080.0)
(19, 9, 4486, 10980) (600000.0, 1190220.0, 709800.0, 1235080.0)

It seems that the method to_xarray(geometry=bbox) crops the output xarray (the shapes are different) but does not update the bounds. This is misleading since the metadata do not correspond to the xarray.

Edited by Simon BONNEFOY