rolling_reduce

earthkit.transforms.rolling_reduce(dataarray: Dataset | DataArray, *_args, **kwargs) Dataset | DataArray[source]

Return reduced data using a moving window over which to apply the reduction.

Parameters:
  • dataarray (xarray.DataArray or xarray.Dataset) – Data over which the moving window is applied according to the reduction method.

  • windows – windows for the rolling groups, for example time=10 to perform a reduction in the time dimension with a bin size of 10. the rolling groups can be defined over any number of dimensions. see documentation for xarray.dataarray.rolling.

  • min_periods (integer) – The minimum number of observations in the window required to have a value (otherwise result is NaN). Default is to set min_periods equal to the size of the window. see documentation for xarray.dataarray.rolling

  • center (bool) – Set the labels at the centre of the window, see documentation for xarray.dataarray.rolling.

  • how_reduce (str,) – Function to be applied for reduction. Default is ‘mean’.

  • how_dropna (str or None) – Determine if dimension is removed from the output when we have at least one NaN or all NaN. how_dropna can be None, ‘any’ or ‘all’. Default is ‘any’.

  • **kwargs – Any kwargs that are compatible with the select how_reduce method.

Return type:

xarray.DataArray or xarray.Dataset (as provided)