Reduce this NamedArray'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=["
(
self,
dim: Dims = None,
**kwargs: Any,
)
| 77 | ) |
| 78 | |
| 79 | def all( |
| 80 | self, |
| 81 | dim: Dims = None, |
| 82 | **kwargs: Any, |
| 83 | ) -> Self: |
| 84 | """ |
| 85 | Reduce this NamedArray's data by applying ``all`` along some dimension(s). |
| 86 | |
| 87 | Parameters |
| 88 | ---------- |
| 89 | dim : str, Iterable of Hashable, "..." or None, default: None |
| 90 | Name of dimension[s] along which to apply ``all``. For e.g. ``dim="x"`` |
| 91 | or ``dim=["x", "y"]``. If "..." or None, will reduce over all dimensions. |
| 92 | **kwargs : Any |
| 93 | Additional keyword arguments passed on to the appropriate array |
| 94 | function for calculating ``all`` on this object's data. |
| 95 | These could include dask-specific kwargs like ``split_every``. |
| 96 | |
| 97 | Returns |
| 98 | ------- |
| 99 | reduced : NamedArray |
| 100 | New NamedArray with ``all`` applied to its data and the |
| 101 | indicated dimension(s) removed |
| 102 | |
| 103 | See Also |
| 104 | -------- |
| 105 | numpy.all |
| 106 | dask.array.all |
| 107 | Dataset.all |
| 108 | DataArray.all |
| 109 | :ref:`agg` |
| 110 | User guide on reduction or aggregation operations. |
| 111 | |
| 112 | Examples |
| 113 | -------- |
| 114 | >>> from xarray.namedarray.core import NamedArray |
| 115 | >>> na = NamedArray( |
| 116 | ... "x", np.array([True, True, True, True, True, False], dtype=bool) |
| 117 | ... ) |
| 118 | >>> na |
| 119 | <xarray.NamedArray (x: 6)> Size: 6B |
| 120 | array([ True, True, True, True, True, False]) |
| 121 | |
| 122 | >>> na.all() |
| 123 | <xarray.NamedArray ()> Size: 1B |
| 124 | array(False) |
| 125 | """ |
| 126 | return self.reduce( |
| 127 | duck_array_ops.array_all, |
| 128 | dim=dim, |
| 129 | **kwargs, |
| 130 | ) |
| 131 | |
| 132 | def any( |
| 133 | self, |