MCPcopy
hub / github.com/pydata/xarray / notnull

Method notnull

xarray/core/common.py:1318–1359  ·  view source on GitHub ↗

Test each value in the array for whether it is not a missing value. Parameters ---------- keep_attrs : bool or None, optional If True, the attributes (`attrs`) will be copied from the original object to the new one. If False, the new objec

(self, keep_attrs: bool | None = None)

Source from the content-addressed store, hash-verified

1316 )
1317
1318 def notnull(self, keep_attrs: bool | None = None) -> Self:
1319 """Test each value in the array for whether it is not a missing value.
1320
1321 Parameters
1322 ----------
1323 keep_attrs : bool or None, optional
1324 If True, the attributes (`attrs`) will be copied from
1325 the original object to the new one. If False, the new
1326 object will be returned without attributes.
1327
1328 Returns
1329 -------
1330 notnull : DataArray or Dataset
1331 Same type and shape as object, but the dtype of the data is bool.
1332
1333 See Also
1334 --------
1335 pandas.notnull
1336
1337 Examples
1338 --------
1339 >>> array = xr.DataArray([1, np.nan, 3], dims="x")
1340 >>> array
1341 <xarray.DataArray (x: 3)> Size: 24B
1342 array([ 1., nan, 3.])
1343 Dimensions without coordinates: x
1344 >>> array.notnull()
1345 <xarray.DataArray (x: 3)> Size: 3B
1346 array([ True, False, True])
1347 Dimensions without coordinates: x
1348 """
1349 from xarray.computation.apply_ufunc import apply_ufunc
1350
1351 if keep_attrs is None:
1352 keep_attrs = _get_keep_attrs(default=True)
1353
1354 return apply_ufunc(
1355 duck_array_ops.notnull,
1356 self,
1357 dask="allowed",
1358 keep_attrs=keep_attrs,
1359 )
1360
1361 def isin(self, test_elements: Any) -> Self:
1362 """Tests each value in the array for whether it is in test elements.

Callers

nothing calls this directly

Calls 2

_get_keep_attrsFunction · 0.90
apply_ufuncFunction · 0.90

Tested by

no test coverage detected