-
-
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 class
Description
What is your issue?
When assigning to a full path with DataTree.coords
, I expected to assign a coordinate to a child, not the root.
Here's the behavior on main
:
In [36]: tree = DataTree(Dataset(coords={'x': 0}), children={'child': DataTree()})
In [37]: tree.coords['/child/y'] = 2
In [38]: tree
Out[38]:
<xarray.DataTree>
Group: /
│ Dimensions: ()
│ Coordinates:
│ x int64 8B 0
│ /child/y int64 8B 2
└── Group: /child
Instead, I expected the result of assigning directly to the child node (without the duiplicate inherited coordinate, of course):
In [40]: tree['/child'].coords['y'] = 2
In [41]: tree
Out[41]:
<xarray.DataTree>
Group: /
│ Dimensions: ()
│ Coordinates:
│ x int64 8B 0
└── Group: /child
Dimensions: ()
Coordinates:
x int64 8B 0
y int64 8B 2
TomNicholas
Metadata
Metadata
Assignees
Labels
bugtopic-DataTreeRelated to the implementation of a DataTree classRelated to the implementation of a DataTree class