median¶
- earthkit.transforms.temporal.median(*_args, **kwargs)[source]¶
Calculate the median of an xarray.dataarray or xarray.dataset along the time/date dimension.
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
time_dim (str) – Name of the time dimension, or coordinate, in the xarray object, default behaviour is to deduce time dimension from attributes of coordinates, then fall back to “time”. If you do not want to aggregate along the time dimension use earthkit.transforms.aggregate.reduce
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, default is _median
how_dropna (str) – 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: earthkit.transforms.aggregate.reduce
- Returns:
A dataarray of the median value in the time dimensions
- Return type: