xarray.core.rolling.DataArrayRolling

class xarray.core.rolling.DataArrayRolling(obj, windows, min_periods=None, center=False, keep_attrs=None)
__init__(self, obj, windows, min_periods=None, center=False, keep_attrs=None)

Moving window object for DataArray. You should use DataArray.rolling() method to construct this object instead of the class constructor.

Parameters
  • obj (DataArray) – Object to window.

  • windows (A mapping from a dimension name to window size) –

    dimstr

    Name of the dimension to create the rolling iterator along (e.g., time).

    windowint

    Size of the moving window.

  • min_periods (int, default None) – Minimum number of observations in window required to have a value (otherwise result is NA). The default, None, is equivalent to setting min_periods equal to the size of the window.

  • center (boolean, default False) – Set the labels at the center of the window.

  • keep_attrs (bool, optional) – If True, the object’s attributes (attrs) will be copied from the original object to the new one. If False (default), the new object will be returned without attributes.

Returns

rolling

Return type

type of input argument

See also

DataArray.rolling(), DataArray.groupby(), Dataset.rolling(), Dataset.groupby()

Methods

__init__(self, obj, windows[, min_periods, …])

Moving window object for DataArray.

argmax(self, \*\*kwargs)

Reduce this object’s data windows by applying argmax along its dimension.

argmin(self, \*\*kwargs)

Reduce this object’s data windows by applying argmin along its dimension.

construct(self, window_dim[, stride, fill_value])

Convert this rolling object to xr.DataArray, where the window dimension is stacked as a new dimension

count(self)

Reduce this object’s data windows by applying count along its dimension.

max(self, \*\*kwargs)

Reduce this object’s data windows by applying max along its dimension.

mean(self, \*\*kwargs)

Reduce this object’s data windows by applying mean along its dimension.

median(self, \*\*kwargs)

Reduce this object’s data windows by applying median along its dimension.

min(self, \*\*kwargs)

Reduce this object’s data windows by applying min along its dimension.

prod(self, \*\*kwargs)

Reduce this object’s data windows by applying prod along its dimension.

reduce(self, func, \*\*kwargs)

Reduce the items in this group by applying func along some dimension(s).

std(self, \*\*kwargs)

Reduce this object’s data windows by applying std along its dimension.

sum(self, \*\*kwargs)

Reduce this object’s data windows by applying sum along its dimension.

var(self, \*\*kwargs)

Reduce this object’s data windows by applying var along its dimension.

Attributes

center

dim

keep_attrs

min_periods

obj

window

window_labels