datatree.DataTree.__setitem__#

DataTree.__setitem__(key: str, value: Any) None[source][source]#

Add either a child node or an array to the tree, at any position.

Data can be added anywhere, and new nodes will be created to cross the path to the new location if necessary.

If there is already a node at the given location, then if value is a Node class or Dataset it will overwrite the data already present at that node, and if value is a single array, it will be merged with it.