datatree.DataTree.get#

DataTree.get(key: str, default: Optional[Union[datatree.datatree.DataTree, xarray.core.dataarray.DataArray]] = None) Optional[Union[datatree.datatree.DataTree, xarray.core.dataarray.DataArray]][source][source]#

Access child nodes, variables, or coordinates stored in this node.

Returned object will be either a DataTree or DataArray object depending on whether the key given points to a child or variable.

Parameters
  • key (str) – Name of variable / child within this node. Must lie in this immediate node (not elsewhere in the tree).

  • default (DataTree | DataArray, optional) – A value to return if the specified key does not exist. Default return value is None.