xray.Dataset.apply

Dataset.apply(func, keep_attrs=False, args=(), **kwargs)

Apply a function over the data variables in this dataset.

Parameters:

func : function

Function which can be called in the form f(x, **kwargs) to transform each DataArray x in this dataset into another DataArray.

keep_attrs : bool, optional

If True, the dataset’s attributes (attrs) will be copied from the original object to the new one. If False, the new object will be returned without attributes.

args : tuple, optional

Positional arguments passed on to func.

**kwargs : dict

Keyword arguments passed on to func.

Returns:

applied : Dataset

Resulting dataset from applying func over each data variable.