This repository was archived by the owner on Oct 24, 2024. It is now read-only.
This repository was archived by the owner on Oct 24, 2024. It is now read-only.
parent
of new nodes is not assigned properly in update
#203
Closed
Description
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 #201, that inconsistent tree fails to copy because relative_to
raises an error.