mesmer.datatree.map_over_datasets

mesmer.datatree.map_over_datasets#

mesmer.datatree.map_over_datasets(func, *args, kwargs=None)#

Applies a function to every dataset in one or more DataTree objects with the same structure (ie.., that are isomorphic), returning new trees which store the results.

adapted version of xr.map_over_datasets which skips empty nodes

Parameters:
  • func (callable) – Function to apply to datasets with signature:

    func(*args: Dataset, **kwargs) -> Union[Dataset, tuple[Dataset, …]].

    (i.e. func must accept at least one Dataset and return at least one Dataset.)

  • *args (tuple, optional) – Positional arguments passed on to func. Any DataTree arguments will be converted to Dataset objects via .dataset.

  • kwargs (dict, optional) – Optional keyword arguments passed directly to func.

See also

xr.map_over_datasets

Notes

For the discussion in xarray see pydata/xarray#9693