xarray.DataArray.notnull

xarray.DataArray.notnull#

DataArray.notnull(keep_attrs=None)[source]#

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 object will be returned without attributes.

Returns

notnull (DataArray or Dataset) – Same type and shape as object, but the dtype of the data is bool.

See also

pandas.notnull

Examples

>>> array = xr.DataArray([1, np.nan, 3], dims="x")
>>> array
<xarray.DataArray (x: 3)> Size: 24B
array([ 1., nan,  3.])
Dimensions without coordinates: x
>>> array.notnull()
<xarray.DataArray (x: 3)> Size: 3B
array([ True, False,  True])
Dimensions without coordinates: x