cf.Data.allclose¶
-
Data.
allclose
(y, rtol=None, atol=None)[source]¶ Returns True if two broadcastable arrays have equal values, False otherwise.
Two real numbers
x
andy
are considered equal if|x-y|<=atol+rtol|y|
, whereatol
(the tolerance on absolute differences) andrtol
(the tolerance on relative differences) are positive, typically very small numbers. See the atol and rtol parameters.Parameters: y: data_like
Returns: Examples:
>>> d = cf.Data([1000, 2500], 'metre') >>> e = cf.Data([1, 2.5], 'km') >>> d.allclose(e) True
>>> d = cf.Data(['ab', 'cdef']) >>> d.allclose([[['ab', 'cdef']]]) True
>>> d.allclose(e) True
>>> d = cf.Data([[1000, 2500], [1000, 2500]], 'metre') >>> e = cf.Data([1, 2.5], 'km') >>> d.allclose(e) True
>>> d = cf.Data([1, 1, 1], 's') >>> d.allclose(1) True