Data.mask_invalid(i=False)[source]

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

Note that:

• Invalid values in the results of arithmetic operations may only occur if the raising of FloatingPointError exceptions has been suppressed by cf.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 of cf.Data.mask_fpe. In this case, such automatic conversion might be faster than calling mask_invalid.
Parameters: i : bool, optional If True then update the data array in place. By default a new data array is created. out: cf.Data
>>> d = cf.Data([0., 1])
>>> e = cf.Data([1., 2])
>>> old = cf.Data.seterr('ignore')

>>> f = e/d
>>> f
<CF Data: [inf, 2.0] >
<CF Data: [--, 2.0] >

>>> f=e**12345
>>> f
<CF Data: [1.0, inf] >

>>> old = cf.Data.seterr('raise')