cf.DimensionCoordinate.masked_invalid

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

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

Invalid values in any bounds are also masked.

Parameters
inplace: bool, optional

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

Returns
DimensionCoordinate 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 --]