🍾 Xarray is now 10 years old! 🎉

xarray.Dataset.coarsen

xarray.Dataset.coarsen#

Dataset.coarsen(dim=None, boundary='exact', side='left', coord_func='mean', **window_kwargs)[source]#

Coarsen object for Datasets.

Parameters:
  • dim (mapping of hashable to int, optional) – Mapping from the dimension name to the window size.

  • boundary ({"exact", "trim", "pad"}, default: "exact") – If ‘exact’, a ValueError will be raised if dimension size is not a multiple of the window size. If ‘trim’, the excess entries are dropped. If ‘pad’, NA will be padded.

  • side ({"left", "right"} or mapping of str to {"left", "right"}, default: "left")

  • coord_func (str or mapping of hashable to str, default: "mean") – function (name) that is applied to the coordinates, or a mapping from coordinate name to function (name).

Returns:

core.rolling.DatasetCoarsen

See also

core.rolling.DatasetCoarsen DataArray.coarsen

Reshaping via coarsen

User guide describing coarsen()

Coarsen large arrays

User guide on block arrgragation coarsen()

Windowed Computations

Tutorial on windowed computation using coarsen()