Attributes get dropped on empty parent nodes
slevang opened this issue · 0 comments
slevang commented
When applying a function to a node that has attrs but no data:
dt = DataTree()
dt.attrs = {"foo": "bar"}
ds = xr.Dataset({"x": xr.DataArray(0)})
dt["y"] = DataTree(data=xr.DataArray(0, name="y"))
DataTree('None', parent=None)
│ Dimensions: ()
│ Data variables:
│ *empty*
│ Attributes:
│ foo: bar
└── DataTree('y')
Dimensions: ()
Data variables:
y int64 0
map_over_subtree
drops the attributes:
dt.attrs
{'foo': 'bar'}
dt.compute().attrs
{}
Related: #262