You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Oct 24, 2024. It is now read-only.
I've been using datatree in the context of https://github.com/spatial-image/multiscale-spatial-image and stumbled upon an error: If I try to call datatree.DataTree.sel on a datatree without attributes, the function works as expected. However if the tree has an attribute set, I get the following error:
site-packages/xarray/core/indexing.py:139, in group_indexers_by_index(obj, indexers, options)
137 raise KeyError(f"no index found for coordinate {key!r}")
138 elif key not in obj.dims:
--> 139 raise KeyError(f"{key!r} is not a valid dimension or coordinate")
140 elif len(options):
141 raise ValueError(
142 f"cannot supply selection options {options!r} for dimension {key!r}"
143 "that has no associated coordinate or index"
144 )
KeyError: "'dim_0' is not a valid dimension or coordinate"
Here's a reproducible example:
importdatatreeimportxarrayasxrimportnumpyasnpxs=xr.Dataset({'testvar': xr.DataArray(np.ones((2,3)))})
dt=datatree.DataTree.from_dict({'node1': xs1, 'node2': xs1})
dt.attrs['test_key'] =1# sel works fine without this linedt.sel({'dim_0': 0})
Hi, thank you for your work on
datatree.I've been using
datatreein the context of https://github.com/spatial-image/multiscale-spatial-image and stumbled upon an error: If I try to calldatatree.DataTree.selon a datatree without attributes, the function works as expected. However if the tree has an attribute set, I get the following error:Here's a reproducible example:
I'm using
datatree==0.0.12.