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

Method any

xarray/namedarray/_aggregations.py:132–183  ·  view source on GitHub ↗

Reduce this NamedArray'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=["

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

Source from the content-addressed store, hash-verified

130 )
131
132 def any(
133 self,
134 dim: Dims = None,
135 **kwargs: Any,
136 ) -> Self:
137 """
138 Reduce this NamedArray's data by applying ``any`` along some dimension(s).
139
140 Parameters
141 ----------
142 dim : str, Iterable of Hashable, "..." or None, default: None
143 Name of dimension[s] along which to apply ``any``. For e.g. ``dim="x"``
144 or ``dim=["x", "y"]``. If "..." or None, will reduce over all dimensions.
145 **kwargs : Any
146 Additional keyword arguments passed on to the appropriate array
147 function for calculating ``any`` on this object's data.
148 These could include dask-specific kwargs like ``split_every``.
149
150 Returns
151 -------
152 reduced : NamedArray
153 New NamedArray with ``any`` applied to its data and the
154 indicated dimension(s) removed
155
156 See Also
157 --------
158 numpy.any
159 dask.array.any
160 Dataset.any
161 DataArray.any
162 :ref:`agg`
163 User guide on reduction or aggregation operations.
164
165 Examples
166 --------
167 >>> from xarray.namedarray.core import NamedArray
168 >>> na = NamedArray(
169 ... "x", np.array([True, True, True, True, True, False], dtype=bool)
170 ... )
171 >>> na
172 <xarray.NamedArray (x: 6)> Size: 6B
173 array([ True, True, True, True, True, False])
174
175 >>> na.any()
176 <xarray.NamedArray ()> Size: 1B
177 array(True)
178 """
179 return self.reduce(
180 duck_array_ops.array_any,
181 dim=dim,
182 **kwargs,
183 )
184
185 def max(
186 self,

Callers 1

from_arrayFunction · 0.45

Calls 1

reduceMethod · 0.95

Tested by

no test coverage detected