Reduce this DataArray's data by applying ``any`` along some dimension(s). Parameters ---------- dim : str, Iterable of Hashable, "..." or None, default: None Name of dimension[s] along which to apply ``any``. For e.g. ``dim="x"`` or ``dim=["x
(
self,
dim: Dims = None,
*,
keep_attrs: bool | None = None,
**kwargs: Any,
)
| 7002 | return out |
| 7003 | |
| 7004 | def any( |
| 7005 | self, |
| 7006 | dim: Dims = None, |
| 7007 | *, |
| 7008 | keep_attrs: bool | None = None, |
| 7009 | **kwargs: Any, |
| 7010 | ) -> DataArray: |
| 7011 | """ |
| 7012 | Reduce this DataArray's data by applying ``any`` along some dimension(s). |
| 7013 | |
| 7014 | Parameters |
| 7015 | ---------- |
| 7016 | dim : str, Iterable of Hashable, "..." or None, default: None |
| 7017 | Name of dimension[s] along which to apply ``any``. For e.g. ``dim="x"`` |
| 7018 | or ``dim=["x", "y"]``. If None, will reduce over the GroupBy dimensions. |
| 7019 | If "...", will reduce over all dimensions. |
| 7020 | keep_attrs : bool or None, optional |
| 7021 | If True, ``attrs`` will be copied from the original |
| 7022 | object to the new one. If False, the new object will be |
| 7023 | returned without attributes. |
| 7024 | **kwargs : Any |
| 7025 | Additional keyword arguments passed on to the appropriate array |
| 7026 | function for calculating ``any`` on this object's data. |
| 7027 | These could include dask-specific kwargs like ``split_every``. |
| 7028 | |
| 7029 | Returns |
| 7030 | ------- |
| 7031 | reduced : DataArray |
| 7032 | New DataArray with ``any`` applied to its data and the |
| 7033 | indicated dimension(s) removed |
| 7034 | |
| 7035 | See Also |
| 7036 | -------- |
| 7037 | numpy.any |
| 7038 | dask.array.any |
| 7039 | DataArray.any |
| 7040 | :ref:`groupby` |
| 7041 | User guide on groupby operations. |
| 7042 | |
| 7043 | Notes |
| 7044 | ----- |
| 7045 | Use the ``flox`` package to significantly speed up groupby computations, |
| 7046 | especially with dask arrays. Xarray will use flox by default if installed. |
| 7047 | Pass flox-specific keyword arguments in ``**kwargs``. |
| 7048 | See the `flox documentation <https://flox.readthedocs.io>`_ for more. |
| 7049 | |
| 7050 | Examples |
| 7051 | -------- |
| 7052 | >>> da = xr.DataArray( |
| 7053 | ... np.array([True, True, True, True, True, False], dtype=bool), |
| 7054 | ... dims="time", |
| 7055 | ... coords=dict( |
| 7056 | ... time=("time", pd.date_range("2001-01-01", freq="ME", periods=6)), |
| 7057 | ... labels=("time", np.array(["a", "b", "c", "c", "b", "a"])), |
| 7058 | ... ), |
| 7059 | ... ) |
| 7060 | >>> da |
| 7061 | <xarray.DataArray (time: 6)> Size: 6B |
nothing calls this directly
no test coverage detected