Skip to content

Commit

Permalink
Ensure group names are preserved on update.
Browse files Browse the repository at this point in the history
  • Loading branch information
flamingbear committed Aug 2, 2024
1 parent c7cb9f7 commit 78067f6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion xarray/core/datatree.py
Original file line number Diff line number Diff line change
Expand Up @@ -770,7 +770,7 @@ def _replace_node(
if data is not _default:
self._set_node_data(ds)

self._children = children
self.children = children

def copy(
self: DataTree,
Expand Down
1 change: 1 addition & 0 deletions xarray/tests/test_datatree.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ def test_update(self):
dt.update({"foo": xr.DataArray(0), "a": DataTree()})
expected = DataTree.from_dict({"/": xr.Dataset({"foo": 0}), "a": None})
assert_equal(dt, expected)
assert dt.groups == ("/", "/a")

def test_update_new_named_dataarray(self):
da = xr.DataArray(name="temp", data=[0, 50])
Expand Down

0 comments on commit 78067f6

Please sign in to comment.