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.
Name permanence #116
Closed
Description
Xarray Datasets don't alter the names of the objects they store:
In [1]: import xarray as xr
In [2]: da = xr.DataArray(name="b")
In [3]: ds = xr.Dataset()
In [4]: ds['a'] = da
In [5]: ds["a"].name
Out[5]: 'a'
In [6]: da.name
Out[6]: 'b'
After #41 (and #115 ensures it) then DataTree
objects behave similarly for data variables they store
In [7]: from datatree import DataTree
In [8]: root = DataTree()
In [9]: root["a"] = da
In [10]: root["a"].name
Out[10]: 'a'
In [11]: da.name
Out[11]: 'b'
However, currently DataTree
objects do alter the name of child DataTree
nodes that they store.
In [12]: subtree = DataTree(name="b")
In [13]: root = DataTree()
In [14]: root["a"] = subtree
In [15]: root["a"].name
Out[15]: 'a'
In [16]: subtree.name
Out[16]: 'a'
I noticed this in #115, but fixing it might be a bit complex.