cf.CellMethod.equivalent

CellMethod.equivalent(other, rtol=None, atol=None, verbose=None, traceback=False)[source]

True if two cell methods are equivalent, False otherwise.

The axes and intervals attributes are ignored in the comparison.

Parameters
other:

The object to compare for equality.

atol: number, optional

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

rtol: number, optional

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

verbose: int or str or None, optional

If an integer from -1 to 3, or an equivalent string equal ignoring case to one of:

  • 'DISABLE' (0)

  • 'WARNING' (1)

  • 'INFO' (2)

  • 'DETAIL' (3)

  • 'DEBUG' (-1)

set for the duration of the method call only as the minimum cut-off for the verboseness level of displayed output (log) messages, regardless of the globally-configured cf.log_level. Note that increasing numerical value corresponds to increasing verbosity, with the exception of -1 as a special case of maximal and extreme verbosity.

Otherwise, if None (the default value), output messages will be shown according to the value of the cf.log_level setting.

Overall, the higher a non-negative integer or equivalent string that is set (up to a maximum of 3/'DETAIL') for increasing verbosity, the more description that is printed to convey information about the operation.

traceback: deprecated at version 3.0.0

Use the verbose parameter instead.

Returns
bool

Whether or not the two instances are equivalent.

Examples

>>> a = cf.example_field(1)
>>> a.cell_methods()
<CF Constructs: cell_method(2)>
>>> print(a.cell_methods())
Constructs:
{'cellmethod0': <CF CellMethod: domainaxis1: domainaxis2: mean where land (interval: 0.1 degrees)>,
 'cellmethod1': <CF CellMethod: domainaxis3: maximum>}
>>> c0 = a.cell_method('cellmethod0')
>>> c1 = a.cell_method('cellmethod1')
>>> c0.equivalent(c0)
True
>>> c0.equivalent(c1)
False
>>> c1.equivalent(c0)
False
>>> c1.equivalent(c1)
True