cf.Data.isclose¶
-
Data.
isclose
(y, rtol=None, atol=None)[source]¶ Return a boolean data array showing where two broadcastable arrays have equal values within a tolerance.
For numeric data arrays,
d.isclose(y, rtol, atol)
is equivalent toabs(d - y) <= ``atol + rtol*abs(y)
, otherwise it is equivalent tod == y
.Parameters: y : data_like
Returns: out: bool
Examples: >>> d = cf.Data([1000, 2500], 'metre') >>> e = cf.Data([1, 2.5], 'km') >>> print d.isclose(e).array [ True True]
>>> d = cf.Data(['ab', 'cdef']) >>> print d.isclose([[['ab', 'cdef']]]).array [[[ True True]]]
>>> d = cf.Data([[1000, 2500], [1000, 2500]], 'metre') >>> e = cf.Data([1, 2.5], 'km') >>> print d.isclose(e).array [[ True True] [ True True]]
>>> d = cf.Data([1, 1, 1], 's') >>> print d.isclose(1).array [ True True True]