cf.Data.mask_invalid

Data.mask_invalid(*args, **kwargs)[source]

Mask the array where invalid values occur (NaN or inf).

Deprecated at version 3.14.0. Use the method masked_invalid instead.

See also

where

Parameters
inplace: bool, optional

If True then do the operation in-place and return None.

i: deprecated at version 3.0.0

Use the inplace parameter instead.

Returns
Data or None

The masked data, or None if the operation was in-place.

Examples

>>> d = cf.Data([0, 1, 2])
>>> e = cf.Data([0, 2, 0])
>>> f = d / e
>>> f
<CF Data(3): [nan, 0.5, inf]>
>>> f.mask_invalid()
<CF Data(3): [--, 0.5, --]>