cf.Data.equals

Data.equals(other, rtol=None, atol=None, ignore_fill_value=False, ignore_data_type=False, ignore_type=False, verbose=None, traceback=False, ignore_compression=False)[source]

True if two data arrays are logically equal, False otherwise.

Two real numbers x and y are considered equal if |x-y|<=atol+rtol|y|, where atol (the tolerance on absolute differences) and rtol (the tolerance on relative differences) are positive, typically very small numbers. See the atol and rtol parameters.

Parameters
other:

The object to compare for equality.

rtol: number, optional

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

atol: number, optional

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

ignore_fill_value: bool, optional

If True then data arrays with different fill values are considered equal. By default they are considered unequal.

ignore_data_type: bool, optional

If True then ignore the data types in all numerical comparisons. By default different numerical data types imply inequality, regardless of whether the elements are within the tolerance for equality.

ignore_type: bool, optional

Any type of object may be tested but, in general, equality is only possible with another Data instance, or a subclass of one. If ignore_type is True then cf.Data(source=other) is tested, rather than the other defined by the other parameter.

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.

ignore_compression: bool, optional

If False then the compression type and, if applicable, the underlying compressed arrays must be the same, as well as the arrays in their uncompressed forms. By default only the the arrays in their uncompressed forms are compared.

Returns
bool

Whether or not the two instances are equal.

Examples

>>> d.equals(d)
True
>>> d.equals(d + 1)
False