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

Method all

xarray/core/_aggregations.py:6914–7002  ·  view source on GitHub ↗

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

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

Source from the content-addressed store, hash-verified

6912 return out
6913
6914 def all(
6915 self,
6916 dim: Dims = None,
6917 *,
6918 keep_attrs: bool | None = None,
6919 **kwargs: Any,
6920 ) -> DataArray:
6921 """
6922 Reduce this DataArray's data by applying ``all`` along some dimension(s).
6923
6924 Parameters
6925 ----------
6926 dim : str, Iterable of Hashable, "..." or None, default: None
6927 Name of dimension[s] along which to apply ``all``. For e.g. ``dim="x"``
6928 or ``dim=["x", "y"]``. If None, will reduce over the GroupBy dimensions.
6929 If "...", will reduce over all dimensions.
6930 keep_attrs : bool or None, optional
6931 If True, ``attrs`` will be copied from the original
6932 object to the new one. If False, the new object will be
6933 returned without attributes.
6934 **kwargs : Any
6935 Additional keyword arguments passed on to the appropriate array
6936 function for calculating ``all`` on this object's data.
6937 These could include dask-specific kwargs like ``split_every``.
6938
6939 Returns
6940 -------
6941 reduced : DataArray
6942 New DataArray with ``all`` applied to its data and the
6943 indicated dimension(s) removed
6944
6945 See Also
6946 --------
6947 numpy.all
6948 dask.array.all
6949 DataArray.all
6950 :ref:`groupby`
6951 User guide on groupby operations.
6952
6953 Notes
6954 -----
6955 Use the ``flox`` package to significantly speed up groupby computations,
6956 especially with dask arrays. Xarray will use flox by default if installed.
6957 Pass flox-specific keyword arguments in ``**kwargs``.
6958 See the `flox documentation <https://flox.readthedocs.io>`_ for more.
6959
6960 Examples
6961 --------
6962 >>> da = xr.DataArray(
6963 ... np.array([True, True, True, True, True, False], dtype=bool),
6964 ... dims="time",
6965 ... coords=dict(
6966 ... time=("time", pd.date_range("2001-01-01", freq="ME", periods=6)),
6967 ... labels=("time", np.array(["a", "b", "c", "c", "b", "a"])),
6968 ... ),
6969 ... )
6970 >>> da
6971 <xarray.DataArray (time: 6)> Size: 6B

Callers

nothing calls this directly

Calls 3

_flox_reduceMethod · 0.95
reduceMethod · 0.95

Tested by

no test coverage detected