Reduce this DataArray'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,
)
| 7535 | return out |
| 7536 | |
| 7537 | def sum( |
| 7538 | self, |
| 7539 | dim: Dims = None, |
| 7540 | *, |
| 7541 | skipna: bool | None = None, |
| 7542 | min_count: int | None = None, |
| 7543 | keep_attrs: bool | None = None, |
| 7544 | **kwargs: Any, |
| 7545 | ) -> DataArray: |
| 7546 | """ |
| 7547 | Reduce this DataArray's data by applying ``sum`` along some dimension(s). |
| 7548 | |
| 7549 | Parameters |
| 7550 | ---------- |
| 7551 | dim : str, Iterable of Hashable, "..." or None, default: None |
| 7552 | Name of dimension[s] along which to apply ``sum``. For e.g. ``dim="x"`` |
| 7553 | or ``dim=["x", "y"]``. If None, will reduce over the GroupBy dimensions. |
| 7554 | If "...", will reduce over all dimensions. |
| 7555 | skipna : bool or None, optional |
| 7556 | If True, skip missing values (as marked by NaN). By default, only |
| 7557 | skips missing values for float dtypes; other dtypes either do not |
| 7558 | have a sentinel missing value (int) or ``skipna=True`` has not been |
| 7559 | implemented (object, datetime64 or timedelta64). |
| 7560 | min_count : int or None, optional |
| 7561 | The required number of valid values to perform the operation. If |
| 7562 | fewer than min_count non-NA values are present the result will be |
| 7563 | NA. Only used if skipna is set to True or defaults to True for the |
| 7564 | array's dtype. Changed in version 0.17.0: if specified on an integer |
| 7565 | array and skipna=True, the result will be a float array. |
| 7566 | keep_attrs : bool or None, optional |
| 7567 | If True, ``attrs`` will be copied from the original |
| 7568 | object to the new one. If False, the new object will be |
| 7569 | returned without attributes. |
| 7570 | **kwargs : Any |
| 7571 | Additional keyword arguments passed on to the appropriate array |
| 7572 | function for calculating ``sum`` on this object's data. |
| 7573 | These could include dask-specific kwargs like ``split_every``. |
| 7574 | |
| 7575 | Returns |
| 7576 | ------- |
| 7577 | reduced : DataArray |
| 7578 | New DataArray with ``sum`` applied to its data and the |
| 7579 | indicated dimension(s) removed |
| 7580 | |
| 7581 | See Also |
| 7582 | -------- |
| 7583 | numpy.sum |
| 7584 | dask.array.sum |
| 7585 | DataArray.sum |
| 7586 | :ref:`groupby` |
| 7587 | User guide on groupby operations. |
| 7588 | |
| 7589 | Notes |
| 7590 | ----- |
| 7591 | Use the ``flox`` package to significantly speed up groupby computations, |
| 7592 | especially with dask arrays. Xarray will use flox by default if installed. |
| 7593 | Pass flox-specific keyword arguments in ``**kwargs``. |
| 7594 | See the `flox documentation <https://flox.readthedocs.io>`_ for more. |
nothing calls this directly
no test coverage detected