cf.AuxiliaryCoordinate.mask_invalid¶
-
AuxiliaryCoordinate.
mask_invalid
(*args, **kwargs)[source]¶ Mask the array where invalid values occur.
Deprecated at version 3.14.0. Use the method
masked_invalid
instead.Note that:
Invalid values are Nan or inf
Invalid values in the results of arithmetic operations only occur if the raising of
FloatingPointError
exceptions has been suppressed bycf.Data.seterr
.If the raising of
FloatingPointError
exceptions has been allowed then invalid values in the results of arithmetic operations it is possible for them to be automatically converted to masked values, depending on the setting ofcf.Data.mask_fpe
. In this case, such automatic conversion might be faster than callingmask_invalid
.
See also
- Parameters
- Returns
AuxiliaryCoordinate
orNone
The construct with masked elements.
Examples
>>> print(f.array) [ 0. 1.] >>> print(g.array) [ 1. 2.]
>>> old = cf.data.seterr('ignore') >>> h = g/f >>> print(h.array) [ inf 2.] >>> h.mask_invalid(inplace=True) >>> print(h.array) [-- 2.]
>>> h = g**12345 >>> print(h.array) [ 1. inf] >>> h.mask_invalid(inplace=True) >>> print(h.array) [1. --]
>>> old = cf.data.seterr('raise') >>> old = cf.data.mask_fpe(True) >>> print((g/f).array) [ -- 2] >>> print((g**12345).array) [1. -- ]