xarray.DataTree.assign (original) (raw)

DataTree.assign(items=None, **items_kwargs)[source]#

Assign new data variables or child nodes to a DataTree, returning a new object with all the original items in addition to the new ones.

Parameters:

Returns:

dt (DataTree) – A new DataTree with the new variables or children in addition to all the existing items.

Notes

Since kwargs is a dictionary, the order of your arguments may not be preserved, and so the order of the new variables is not well-defined. Assigning multiple items within the same assign is possible, but you cannot reference other variables created within the same assign call.