cumulative
- UnitsAwareDataArray.cumulative(dim: str | Iterable[Hashable], min_periods: int = 1) DataArrayRolling
- Accumulating object for DataArrays. - Parameters:
- dims (iterable of hashable) – The name(s) of the dimensions to create the cumulative window along 
- min_periods (int, default: 1) – Minimum number of observations in window required to have a value (otherwise result is NA). The default is 1 (note this is different from - Rolling, whose default is the size of the window).
 
- Return type:
- core.rolling.DataArrayRolling 
 - Examples - Create rolling seasonal average of monthly data e.g. DJF, JFM, …, SON: - >>> da = xr.DataArray( ... np.linspace(0, 11, num=12), ... coords=[ ... pd.date_range( ... "1999-12-15", ... periods=12, ... freq=pd.DateOffset(months=1), ... ) ... ], ... dims="time", ... ) - >>> da <xarray.DataArray (time: 12)> Size: 96B array([ 0., 1., 2., 3., 4., 5., 6., 7., 8., 9., 10., 11.]) Coordinates: * time (time) datetime64[ns] 96B 1999-12-15 2000-01-15 ... 2000-11-15 - >>> da.cumulative("time").sum() <xarray.DataArray (time: 12)> Size: 96B array([ 0., 1., 3., 6., 10., 15., 21., 28., 36., 45., 55., 66.]) Coordinates: * time (time) datetime64[ns] 96B 1999-12-15 2000-01-15 ... 2000-11-15 - See also - DataArray.rolling,- Dataset.cumulative,- core.rolling.DataArrayRolling