cfdm.DomainAxis.equals

DomainAxis.equals(other, verbose=None, ignore_type=False)[source]

Whether two domain axis constructs are the same.

Equality is strict by default. This means that:

  • the axis sizes must be the same.

Any type of object may be tested but, in general, equality is only possible with another domain axis construct, or a subclass of one. See the ignore_type parameter.

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.

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 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 the cfdm.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_type: bool, optional

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

Returns
bool

Whether the two domain axis constructs are equal.

Examples:

>>> d.equals(d)
True
>>> d.equals(d.copy())
True
>>> d.equals('not a domain axis')
False
>>> d = cfdm.DomainAxis(1)
>>> e = cfdm.DomainAxis(99)
>>> d.equals(e, verbose=3)
DomainAxis: Different axis sizes: 1 != 99
False