🍾 Xarray is now 10 years old! 🎉

xarray.core.rolling_exp.RollingExp.mean

xarray.core.rolling_exp.RollingExp.mean#

RollingExp.mean(keep_attrs=None)[source]#

Exponentially weighted moving average.

Parameters:

keep_attrs (bool, default: None) – If True, the attributes (attrs) will be copied from the original object to the new one. If False, the new object will be returned without attributes. If None uses the global default.

Examples

>>> da = xr.DataArray([1, 1, 2, 2, 2], dims="x")
>>> da.rolling_exp(x=2, window_type="span").mean()
<xarray.DataArray (x: 5)> Size: 40B
array([1.        , 1.        , 1.69230769, 1.9       , 1.96694215])
Dimensions without coordinates: x