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 r
(
self,
dim: Mapping[Any, int] | None = None,
boundary: CoarsenBoundaryOptions = "exact",
side: SideOptions | Mapping[Any, SideOptions] = "left",
coord_func: str | Callable | Mapping[Any, str | Callable] = "mean",
**window_kwargs: int,
)
| 10442 | return DatasetRolling(self, dim, min_periods=min_periods, center=False) |
| 10443 | |
| 10444 | def coarsen( |
| 10445 | self, |
| 10446 | dim: Mapping[Any, int] | None = None, |
| 10447 | boundary: CoarsenBoundaryOptions = "exact", |
| 10448 | side: SideOptions | Mapping[Any, SideOptions] = "left", |
| 10449 | coord_func: str | Callable | Mapping[Any, str | Callable] = "mean", |
| 10450 | **window_kwargs: int, |
| 10451 | ) -> DatasetCoarsen: |
| 10452 | """ |
| 10453 | Coarsen object for Datasets. |
| 10454 | |
| 10455 | Parameters |
| 10456 | ---------- |
| 10457 | dim : mapping of hashable to int, optional |
| 10458 | Mapping from the dimension name to the window size. |
| 10459 | boundary : {"exact", "trim", "pad"}, default: "exact" |
| 10460 | If 'exact', a ValueError will be raised if dimension size is not a |
| 10461 | multiple of the window size. If 'trim', the excess entries are |
| 10462 | dropped. If 'pad', NA will be padded. |
| 10463 | side : {"left", "right"} or mapping of str to {"left", "right"}, default: "left" |
| 10464 | coord_func : str or mapping of hashable to str, default: "mean" |
| 10465 | function (name) that is applied to the coordinates, |
| 10466 | or a mapping from coordinate name to function (name). |
| 10467 | |
| 10468 | Returns |
| 10469 | ------- |
| 10470 | computation.rolling.DatasetCoarsen |
| 10471 | |
| 10472 | See Also |
| 10473 | -------- |
| 10474 | :class:`computation.rolling.DatasetCoarsen` |
| 10475 | :func:`DataArray.coarsen <DataArray.coarsen>` |
| 10476 | |
| 10477 | :ref:`reshape.coarsen` |
| 10478 | User guide describing :py:func:`~xarray.Dataset.coarsen` |
| 10479 | |
| 10480 | :ref:`compute.coarsen` |
| 10481 | User guide on block aggregation :py:func:`~xarray.Dataset.coarsen` |
| 10482 | |
| 10483 | :doc:`xarray-tutorial:fundamentals/03.3_windowed` |
| 10484 | Tutorial on windowed computation using :py:func:`~xarray.Dataset.coarsen` |
| 10485 | |
| 10486 | """ |
| 10487 | from xarray.computation.rolling import DatasetCoarsen |
| 10488 | |
| 10489 | dim = either_dict_or_kwargs(dim, window_kwargs, "coarsen") |
| 10490 | return DatasetCoarsen( |
| 10491 | self, |
| 10492 | dim, |
| 10493 | boundary=boundary, |
| 10494 | side=side, |
| 10495 | coord_func=coord_func, |
| 10496 | ) |
| 10497 | |
| 10498 | @_deprecate_positional_args("v2024.07.0") |
| 10499 | def resample( |