xarray.DataTree.get

Contents

xarray.DataTree.get#

DataTree.get(key, default=None)[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 | None, optional) – A value to return if the specified key does not exist. Default return value is None.