Accumulating object for Datasets 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
(
self,
dim: str | Iterable[Hashable],
min_periods: int = 1,
)
| 10397 | return DatasetRolling(self, dim, min_periods=min_periods, center=center) |
| 10398 | |
| 10399 | def cumulative( |
| 10400 | self, |
| 10401 | dim: str | Iterable[Hashable], |
| 10402 | min_periods: int = 1, |
| 10403 | ) -> DatasetRolling: |
| 10404 | """ |
| 10405 | Accumulating object for Datasets |
| 10406 | |
| 10407 | Parameters |
| 10408 | ---------- |
| 10409 | dims : iterable of hashable |
| 10410 | The name(s) of the dimensions to create the cumulative window along |
| 10411 | min_periods : int, default: 1 |
| 10412 | Minimum number of observations in window required to have a value |
| 10413 | (otherwise result is NA). The default is 1 (note this is different |
| 10414 | from ``Rolling``, whose default is the size of the window). |
| 10415 | |
| 10416 | Returns |
| 10417 | ------- |
| 10418 | computation.rolling.DatasetRolling |
| 10419 | |
| 10420 | See Also |
| 10421 | -------- |
| 10422 | DataArray.cumulative |
| 10423 | Dataset.rolling |
| 10424 | Dataset.rolling_exp |
| 10425 | """ |
| 10426 | from xarray.computation.rolling import DatasetRolling |
| 10427 | |
| 10428 | if isinstance(dim, str): |
| 10429 | if dim not in self.dims: |
| 10430 | raise ValueError( |
| 10431 | f"Dimension {dim} not found in data dimensions: {self.dims}" |
| 10432 | ) |
| 10433 | dim = {dim: self.sizes[dim]} |
| 10434 | else: |
| 10435 | missing_dims = set(dim) - set(self.dims) |
| 10436 | if missing_dims: |
| 10437 | raise ValueError( |
| 10438 | f"Dimensions {missing_dims} not found in data dimensions: {self.dims}" |
| 10439 | ) |
| 10440 | dim = {d: self.sizes[d] for d in dim} |
| 10441 | |
| 10442 | return DatasetRolling(self, dim, min_periods=min_periods, center=False) |
| 10443 | |
| 10444 | def coarsen( |
| 10445 | self, |