-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Labels
topic-DataTreeRelated to the implementation of a DataTree classRelated to the implementation of a DataTree class
Description
What is your issue?
Originally posted by @keewis in xarray-contrib/datatree#203
there's something weird happening when assigning nodes using update:
In [1]: import datatree
...: import xarray as xr
...:
...: tree1 = datatree.DataTree.from_dict({"/a/b": xr.Dataset()})
...: node = datatree.DataTree()
...:
...: tree2 = tree1.copy()
...: tree2.update({"c": node})
...:
...: for node in tree3.subtree:
...: print(node.path, node.name, id(node.root))
/ None 140512169735136
/a a 140512169735136
/a/b b 140512169735136
/ c 140512169735248(the parent of node is None, so its root is the node itself)
So it seems with update / assign you can end up with a inconsistent tree? With xarray-contrib/datatree#201, that inconsistent tree fails to copy because relative_to raises an error.
Metadata
Metadata
Assignees
Labels
topic-DataTreeRelated to the implementation of a DataTree classRelated to the implementation of a DataTree class