spatial_extent and temporal_extent not effective in load_collection()
Working with a datacube from a local ZARR folder: the spatial and temporal
filters do not seem effective in the load_collection
loader.
MRE
setup
# micromamba activate clim2stac && cd ./examples
from pathlib import Path
from openeo.local import LocalConnection
import xarray as xr
from utils import *
# files to xarray
DATA_DIR = Path('..', 'test', 'data')
AMT_ROOT = DATA_DIR / 'input' / 'amt'
rcp_45 = AMT_ROOT / 'rcp45'
rcp_85 = AMT_ROOT / 'rcp85'
files_rcp45 = list_all_files(rcp_45)
files_rcp85 = list_all_files(rcp_85)
da_rcp45 = dataarray_concat(files_rcp45, 4.5, bands='bnds', variable='amt')
da_rcp85 = dataarray_concat(files_rcp85, 8.5, bands='bnds', variable='amt')
list_ds_rcp = [da_rcp45, da_rcp85]
rcp_ds = xr.concat(list_ds_rcp, dim='rcp')
# attributes
json_attrs_path = DATA_DIR / 'test_rcp.json'
write_dataset_attr(files_rcp45, json_attrs_path, single_attr=['Title','Institution','Comment'], concat_attr=['Source'])
with open(json_attrs_path, "r") as f:
attributes = json.load(f)
rcp_ds.attrs.update(attributes)
# xarray to zarr
test_collection_id = 'test_rcp_ds.zarr'
zarr_path = DATA_DIR / test_collection_id
rcp_ds.to_zarr(zarr_path, mode="w", compute=True)
# <xarray.backends.zarr.ZarrStore object at 0x7f4ea5f9ad40>
# openeo local connection
local_data_folders = [ DATA_DIR ]
local_conn = LocalConnection(local_data_folders)
local_conn.list_collections() # check
# [{'stac_version': '1.0.0-rc.2', 'type': 'Collection', 'id': [...]
[!] load the collection
zarr_oed = local_conn.load_collection(zarr_path.as_posix(),
spatial_extent = {"west": 11.00, "east": 11.50, "north": 46.80, "south": 46.40},
temporal_extent = ["1970-01-01T12:00:00Z", "1980-01-01T00:00:00Z"])
zarr_xds = zarr_oed.execute()
str(zarr_xds.coords['time'].max().values)
# '2100-01-01T12:00:00.000000000'
The Dataset has not been filtered spatial nor temporally.
NOTE, also tried:
-
spatial_extent
using non-default native CRS coordinates:
{"west": 4400000, "east": 4450000, "north": 2580000, "south": 2550000, "crs": 3035}
-
temporal_extent
with only dates:
temporal_extent=["1970-01-01", "1980-01-01"]
Relevant environment:
-
openeo
0.42.1
Any help appreciated : @michele.claus @Juraj.Zvolensky @Suriyah.Dhinakaran @Yuvraj.Adagale
Edited by Campalani Piero