MCPcopy Index your code
hub / github.com/pydata/xarray / sum

Method sum

xarray/core/_aggregations.py:4508–4642  ·  view source on GitHub ↗

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

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

Source from the content-addressed store, hash-verified

4506 return out
4507
4508 def sum(
4509 self,
4510 dim: Dims = None,
4511 *,
4512 skipna: bool | None = None,
4513 min_count: int | None = None,
4514 keep_attrs: bool | None = None,
4515 **kwargs: Any,
4516 ) -> Dataset:
4517 """
4518 Reduce this Dataset's data by applying ``sum`` along some dimension(s).
4519
4520 Parameters
4521 ----------
4522 dim : str, Iterable of Hashable, "..." or None, default: None
4523 Name of dimension[s] along which to apply ``sum``. For e.g. ``dim="x"``
4524 or ``dim=["x", "y"]``. If None, will reduce over the GroupBy dimensions.
4525 If "...", will reduce over all dimensions.
4526 skipna : bool or None, optional
4527 If True, skip missing values (as marked by NaN). By default, only
4528 skips missing values for float dtypes; other dtypes either do not
4529 have a sentinel missing value (int) or ``skipna=True`` has not been
4530 implemented (object, datetime64 or timedelta64).
4531 min_count : int or None, optional
4532 The required number of valid values to perform the operation. If
4533 fewer than min_count non-NA values are present the result will be
4534 NA. Only used if skipna is set to True or defaults to True for the
4535 array's dtype. Changed in version 0.17.0: if specified on an integer
4536 array and skipna=True, the result will be a float array.
4537 keep_attrs : bool or None, optional
4538 If True, ``attrs`` will be copied from the original
4539 object to the new one. If False, the new object will be
4540 returned without attributes.
4541 **kwargs : Any
4542 Additional keyword arguments passed on to the appropriate array
4543 function for calculating ``sum`` on this object's data.
4544 These could include dask-specific kwargs like ``split_every``.
4545
4546 Returns
4547 -------
4548 reduced : Dataset
4549 New Dataset with ``sum`` applied to its data and the
4550 indicated dimension(s) removed
4551
4552 See Also
4553 --------
4554 numpy.sum
4555 dask.array.sum
4556 Dataset.sum
4557 :ref:`groupby`
4558 User guide on groupby operations.
4559
4560 Notes
4561 -----
4562 Use the ``flox`` package to significantly speed up groupby computations,
4563 especially with dask arrays. Xarray will use flox by default if installed.
4564 Pass flox-specific keyword arguments in ``**kwargs``.
4565 See the `flox documentation <https://flox.readthedocs.io>`_ for more.

Callers

nothing calls this directly

Calls 3

_flox_reduceMethod · 0.95
reduceMethod · 0.95

Tested by

no test coverage detected