cf.Index.masked_invalid

Index.masked_invalid(*args, **kwargs)[source]

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

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
Index or None

The construct with masked values, or None if the operation was in-place.

Examples

>>> print(f.array)
[0 1 2]
>>> print(g.array)
[0 2 0]
>>> h = f / g
>>> print(h.array)
[nan 0.5 inf]
>>> i = h.masked_invalid()
>>> print(i.array)
[-- 0.5 --]