cf.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 1.7.0.

Parameters
other:

The object to compare for equality.

verbose: int or None, optional

If an integer from 0 to 3, corresponding to increasing verbosity (else -1 as a special case of maximal and extreme verbosity), set for the duration of the method call (only) as the minimum severity level cut-off of displayed log messages, regardless of the global configured cfdm.LOG_LEVEL.

Else, if None (the default value), log messages will be filtered out, or otherwise, according to the value of the cfdm.LOG_LEVEL setting.

Overall, the higher a non-negative integer that is set (up to a maximum of 3) the more description that is printed to convey information about differences that lead to inequality.

ignore_type: bool, optional

Any type of object may be tested but, in general, equality is only possible with another domain axis construct, or a subclass of one. If ignore_type is True then 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