MCPcopy Create free account
hub / github.com/pydata/xarray / cumsum

Method cumsum

xarray/core/_aggregations.py:8000–8114  ·  view source on GitHub ↗

Reduce this DataArray's data by applying ``cumsum`` along some dimension(s). Parameters ---------- dim : str, Iterable of Hashable, "..." or None, default: None Name of dimension[s] along which to apply ``cumsum``. For e.g. ``dim="x"`` or ``d

(
        self,
        dim: Dims = None,
        *,
        skipna: bool | None = None,
        keep_attrs: bool | None = None,
        **kwargs: Any,
    )

Source from the content-addressed store, hash-verified

7998 return out
7999
8000 def cumsum(
8001 self,
8002 dim: Dims = None,
8003 *,
8004 skipna: bool | None = None,
8005 keep_attrs: bool | None = None,
8006 **kwargs: Any,
8007 ) -> DataArray:
8008 """
8009 Reduce this DataArray's data by applying ``cumsum`` along some dimension(s).
8010
8011 Parameters
8012 ----------
8013 dim : str, Iterable of Hashable, "..." or None, default: None
8014 Name of dimension[s] along which to apply ``cumsum``. For e.g. ``dim="x"``
8015 or ``dim=["x", "y"]``. If None, will reduce over the GroupBy dimensions.
8016 If "...", will reduce over all dimensions.
8017 skipna : bool or None, optional
8018 If True, skip missing values (as marked by NaN). By default, only
8019 skips missing values for float dtypes; other dtypes either do not
8020 have a sentinel missing value (int) or ``skipna=True`` has not been
8021 implemented (object, datetime64 or timedelta64).
8022 keep_attrs : bool or None, optional
8023 If True, ``attrs`` will be copied from the original
8024 object to the new one. If False, the new object will be
8025 returned without attributes.
8026 **kwargs : Any
8027 Additional keyword arguments passed on to the appropriate array
8028 function for calculating ``cumsum`` on this object's data.
8029 These could include dask-specific kwargs like ``split_every``.
8030
8031 Returns
8032 -------
8033 reduced : DataArray
8034 New DataArray with ``cumsum`` applied to its data and the
8035 indicated dimension(s) removed
8036
8037 See Also
8038 --------
8039 numpy.cumsum
8040 dask.array.cumsum
8041 DataArray.cumsum
8042 DataArray.cumulative
8043 :ref:`groupby`
8044 User guide on groupby operations.
8045
8046 Notes
8047 -----
8048 Use the ``flox`` package to significantly speed up groupby computations,
8049 especially with dask arrays. Xarray will use flox by default if installed.
8050 Pass flox-specific keyword arguments in ``**kwargs``.
8051 See the `flox documentation <https://flox.readthedocs.io>`_ for more.
8052
8053 Non-numeric variables will be removed prior to reducing.
8054
8055 Note that the methods on the ``cumulative`` method are more performant (with numbagg installed)
8056 and better supported. ``cumsum`` and ``cumprod`` may be deprecated
8057 in the future.

Callers

nothing calls this directly

Calls 5

_flox_scanMethod · 0.95
reduceMethod · 0.95
module_availableFunction · 0.90
assign_coordsMethod · 0.45

Tested by

no test coverage detected