cf.FieldAncillary.allclose¶
-
FieldAncillary.
allclose
(y, atol=None, rtol=None)[source]¶ Test whether all data are element-wise equal to other, broadcastable data.
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:
The object to be compared with the data array. y must be broadcastable to the data array and if y has units then they must be compatible. May be any object that can be converted to a
Data
object (which includes numpy array andData
objects).- atol:
float
, optional The tolerance on absolute differences between real numbers. The default value is set by the
atol
function.- rtol:
float
, optional The tolerance on relative differences between real numbers. The default value is set by the
rtol
function.
- Returns
Examples
>>> x = f.allclose(g)