Reduce this NamedArray's data by applying ``max`` along some dimension(s). Parameters ---------- dim : str, Iterable of Hashable, "..." or None, default: None Name of dimension[s] along which to apply ``max``. For e.g. ``dim="x"`` or ``dim=["
(
self,
dim: Dims = None,
*,
skipna: bool | None = None,
**kwargs: Any,
)
| 183 | ) |
| 184 | |
| 185 | def max( |
| 186 | self, |
| 187 | dim: Dims = None, |
| 188 | *, |
| 189 | skipna: bool | None = None, |
| 190 | **kwargs: Any, |
| 191 | ) -> Self: |
| 192 | """ |
| 193 | Reduce this NamedArray's data by applying ``max`` along some dimension(s). |
| 194 | |
| 195 | Parameters |
| 196 | ---------- |
| 197 | dim : str, Iterable of Hashable, "..." or None, default: None |
| 198 | Name of dimension[s] along which to apply ``max``. For e.g. ``dim="x"`` |
| 199 | or ``dim=["x", "y"]``. If "..." or None, will reduce over all dimensions. |
| 200 | skipna : bool or None, optional |
| 201 | If True, skip missing values (as marked by NaN). By default, only |
| 202 | skips missing values for float dtypes; other dtypes either do not |
| 203 | have a sentinel missing value (int) or ``skipna=True`` has not been |
| 204 | implemented (object, datetime64 or timedelta64). |
| 205 | **kwargs : Any |
| 206 | Additional keyword arguments passed on to the appropriate array |
| 207 | function for calculating ``max`` on this object's data. |
| 208 | These could include dask-specific kwargs like ``split_every``. |
| 209 | |
| 210 | Returns |
| 211 | ------- |
| 212 | reduced : NamedArray |
| 213 | New NamedArray with ``max`` applied to its data and the |
| 214 | indicated dimension(s) removed |
| 215 | |
| 216 | See Also |
| 217 | -------- |
| 218 | numpy.max |
| 219 | dask.array.max |
| 220 | Dataset.max |
| 221 | DataArray.max |
| 222 | :ref:`agg` |
| 223 | User guide on reduction or aggregation operations. |
| 224 | |
| 225 | Examples |
| 226 | -------- |
| 227 | >>> from xarray.namedarray.core import NamedArray |
| 228 | >>> na = NamedArray("x", np.array([1, 2, 3, 0, 2, np.nan])) |
| 229 | >>> na |
| 230 | <xarray.NamedArray (x: 6)> Size: 48B |
| 231 | array([ 1., 2., 3., 0., 2., nan]) |
| 232 | |
| 233 | >>> na.max() |
| 234 | <xarray.NamedArray ()> Size: 8B |
| 235 | array(3.) |
| 236 | |
| 237 | Use ``skipna`` to control whether NaNs are ignored. |
| 238 | |
| 239 | >>> na.max(skipna=False) |
| 240 | <xarray.NamedArray ()> Size: 8B |
| 241 | array(nan) |
| 242 | """ |