cfdm.Data.masked_values

Data.masked_values(value, rtol=None, atol=None, inplace=False)[source]

Mask using floating point equality.

Masks the data where elements are approximately equal to the given value. For integer types, exact equality is used.

New in version (cfdm): 1.11.0.0

See also

mask

Parameters
value: number

Masking value.

rtol: number, optional

The tolerance on relative differences between real numbers. The default value is set by the cfdm.rtol function.

atol: number, optional

The tolerance on absolute differences between real numbers. The default value is set by the cfdm.atol function.

inplace: bool, optional

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

Returns
Data or None

The result of masking the data where approximately equal to value, or None if the operation was in-place.

Examples

>>> d = cfdm.Data([1, 1.1, 2, 1.1, 3])
>>> e = d.masked_values(1.1)
>>> print(e.array)
[1.0 -- 2.0 -- 3.0]