cf.DomainAxis.equals

DomainAxis.equals(other, verbose=False, 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: bool, optional

If True then print 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=True)
DomainAxis: Different axis sizes: 1 != 99
False