Skip to content

'Dataset' object has no attribute 'openeo'

When building a process graph on a ZARR local datacube, an openeo attribute/accessor on the DataCube object is accessed but not found when calling the execute() on the graph.

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 + chain process

zarr_oed = local_conn.load_collection(zarr_path.as_posix())
zarr_oed_filter = zarr_oed.filter_bbox(west=11.00, east=11.50, north=46.80, south=46.40)
zarr_oed_filter.execute()
"'Dataset' object has no attribute 'openeo'"

NOTE, also tried with:

  • zarr_oed_filter = zarr_oed.filter_temporal("1970-01-01T12:00:00Z", "1980-01-01T00:00:00Z")

Relevant environment:

  • openeo 0.42.1

Any help appreciated : @michele.claus @Juraj.Zvolensky @Suriyah.Dhinakaran @Yuvraj.Adagale

Edited by Campalani Piero