-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Labels
bugtopic-DataTreeRelated to the implementation of a DataTree classRelated to the implementation of a DataTree classtopic-documentation
Description
What is your issue?
When defining a data tree only dimension coordinates are inherited. For example
import numpy as np
import xarray as xr
N = 10
ds_1 = xr.Dataset(
coords={
"a": ("a", np.arange(N)),
"a_meta": ("a", np.arange(N) * 3),
}
)
ds_2 = xr.Dataset(data_vars={"data": ("a", np.arange(N) * 5)})
dt = xr.DataTree.from_dict(
{
"/": ds_1,
"/data": ds_2,
}
)
print(dt["/data"])
Results in:
<xarray.DataTree 'data'>
Group: /data
Dimensions: (a: 10)
Inherited coordinates:
* a (a) int64 80B 0 1 2 3 4 5 6 7 8 9
Data variables:
data (a) int64 80B 0 5 10 15 20 25 30 35 40 45
I could not find any mention in the docs that this is the expected behavior. The user guide does not make any sort of distinction and just refers to "coordinates", same with the data structures entry on inheritance.
I'm not sure if this is a bug or undocumented behavior but as a new user after reading the above docs I expected a_meta
to be inherited.
System Info
- python version: 3.13.5
- xarray version: 2025.4.0
Metadata
Metadata
Assignees
Labels
bugtopic-DataTreeRelated to the implementation of a DataTree classRelated to the implementation of a DataTree classtopic-documentation