xarray.core.resample.DataArrayResample.map#
- DataArrayResample.map(func, args=(), shortcut=False, **kwargs)[source]#
Apply a function to each array in the group and concatenate them together into a new array.
func is called like func(ar, *args, **kwargs) for each array ar in this group.
Apply uses heuristics (like pandas.GroupBy.apply) to figure out how to stack together the array. The rule is:
If the dimension along which the group coordinate is defined is still in the first grouped array after applying func, then stack over this dimension.
Otherwise, stack over the new dimension given by name of this grouping (the argument to the groupby function).
- Parameters
func (
callable()
) – Callable to apply to each array.shortcut (
bool
, optional) – Whether or not to shortcut evaluation under the assumptions that:The action of func does not depend on any of the array metadata (attributes or coordinates) but only on the data and dimensions.
The action of func creates arrays with homogeneous metadata, that is, with the same dimensions and attributes.
If these conditions are satisfied shortcut provides significant speedup. This should be the case for many common groupby operations (e.g., applying numpy ufuncs).
args (
tuple
, optional) – Positional arguments passed on to func.**kwargs – Used to call func(ar, **kwargs) for each array ar.
- Returns
applied (
DataArray
) – The result of splitting, applying and combining this array.