reduce¶
- earthkit.transforms.reduce(dataarray: Dataset | DataArray, *_args, **kwargs)[source]¶
Reduce an xarray.dataarray or xarray.dataset using a specified how method.
With the option to apply weights either directly or using a specified weights method.
- Parameters:
dataarray (xarray.DataArray or xarray.Dataset) – Data object to reduce
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, a 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 xp.ndarray over an integer valued axis
weights (str) – Choose a recognised method to apply weighting. Currently available methods are; ‘latitude’
how_label (str) – Label to append to the name of the variable in the reduced object
how_dropna (str or None) – Choose how to drop nan values. Default is None and na values are preserved. Options are ‘any’ and ‘all’.
**kwargs – kwargs recognised by the how :func: reduce
- Returns:
A data array with reduced dimensions removed.
- Return type: