cf.Field.equivalent¶
-
Field.
equivalent
(other, rtol=None, atol=None, traceback=False)[source]¶ True if two fields are equivalent, False otherwise
two fields are equivalent if:
- They have the same identity, as defined by their
identity
methods. - The same rank, as given by their
rank
attributes. - Their data arrays are the same after accounting for different but
equivalent:
- Units
- Number of size one dimensions (if squeeze is True),
- Dimension directions (if use_directions is True)
- Dimension orders (if transpose is set to a dictionary).
- Both fields’ domains must have the same rankdimensionality and where a
dimension in one field has an identity inferred a 1-d coordinate,
the other field has a matching dimension whose identity inferred
is inferred from a 1-d coordinate with an equivalent data array.
- The rank, as given by their `~cf.Field.rank
See also
equals
,set_equals
Examples 1: >>> b = f.equivalent(g)
Parameters: - other:
object
The object to compare for equivalence.
- atol:
float
, optional The absolute tolerance for all numerical comparisons, By default the value returned by the
cf.ATOL
function is used.- rtol:
float
, optional The relative tolerance for all numerical comparisons, By default the value returned by the
cf.RTOL
function is used.- traceback:
bool
, optional If True then print a traceback highlighting where the two fields differ.
Returns: - out:
bool
Whether or not the two fields are equivalent.
Examples 2: >>>
- They have the same identity, as defined by their