cf.Constructs.equals¶
-
Constructs.equals(**kwargs)[source]¶ Whether two
Constructsinstances are the same.Two real numbers
xandyare 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.Any compression is ignored by default, with only the arrays in their uncompressed forms being compared. See the ignore_compression parameter.
Any type of object may be tested but equality is only possible with another
Constructsconstruct, or a subclass of one.NetCDF elements, such as netCDF variable and dimension names, do not constitute part of the CF data model and so are not checked.
New in version (cfdm): 1.7.0
- 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
cfdm.atolfunction.- rtol: number, optional
The tolerance on relative differences between real numbers. The default value is set by the
cfdm.rtolfunction.- ignore_fill_value:
bool, optional If True then the
_FillValueandmissing_valueproperties are omitted from the comparison for the metadata constructs.- 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_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.
- verbose:
intorstrorNone, optional If an integer from
-1to3, 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
cfdm.log_level. Note that increasing numerical value corresponds to increasing verbosity, with the exception of-1as a special case of maximal and extreme verbosity.Otherwise, if
None(the default value), output messages will be shown according to the value of thecfdm.log_levelsetting.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.
- Returns
boolWhether the two instances are equal.
Examples
>>> x.equals(x) True >>> x.equals(x.copy()) True >>> x.equals('something else') False