cf.CellMethod.equals¶
-
CellMethod.
equals
(**kwargs)[source]¶ Whether two cell method constructs are the same.
Equality is strict by default. This means that:
the descriptive qualifiers must be the same (see the ignore_qualifiers parameter).
The axes of the cell method constructs are not considered, because they may only be correctly interpreted by the field constructs that contain the cell method constructs in question. They are, however, taken into account when two fields constructs are tested for equality.
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.Any type of object may be tested but, in general, equality is only possible with another cell method construct, or a subclass of one. See the ignore_type parameter.
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.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.atol
function.- rtol: number, optional
The tolerance on relative differences between real numbers. The default value is set by the
cfdm.rtol
function.- verbose:
int
orstr
orNone
, optional If an integer from
-1
to3
, 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-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 thecfdm.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.- ignore_qualifiers: sequence of
str
, optional The names of qualifiers to omit from the comparison.
- ignore_type:
bool
, optional Any type of object may be tested but, in general, equality is only possible with another
CellMethod
instance, or a subclass of one. If ignore_type is True thencfdm.CellMethod(source=other)
is tested, rather than theother
defined by the other parameter.
- Returns
bool
Whether the two cell method constructs are equal.
Examples
>>> c = cfdm.CellMethod() >>> c.equals(c) True >>> c.equals(c.copy()) True >>> c.equals('not a cell method') False