reduce¶
- earthkit.transforms.ensemble.reduce(dataarray: DataArray | Dataset, how: str | Callable = 'mean', dim: str | None = None)[source]¶
Reduce data over the ensemble dimension.
- Parameters:
dataarray (xarray.DataArray | xarray.Dataset) – The DataArray over which to reduce. Must contain an ensemble dimension.
how (str or callable) – Method used to reduce data. Default=’mean’, which will implement the xarray in-built mean. If string, it must be an in-built xarray reduce method, an earthkit how method or any numpy method. In the case of duplicate names, method selection is first in the order: xarray, earthkit, numpy. Otherwise it can be any function which can be called in the form f(x, axis=axis, **kwargs) to return the result of reducing an numpy.ndarray over an integer valued axis.
dim (str, optional) – Name of the ensemble dimension in the data object, default behaviour is to detect the ensemble dimension from the input object.
- Returns:
Data reduced over the ensemble dimension.
- Return type: