cf.FieldList.equals

FieldList.equals(other, rtol=None, atol=None, ignore_fill_value=False, traceback=False, ignore=('Conventions', ), _set=False)[source]

True if two field lists are equal, False otherwise.

Two field lists are equal if they have the same number of elements and the field elements are equal pairwise, i.e. f.equals(g) is equivalent to all(x.equals(y) for x, y in map(None, f, g)).

Two fields are equal if ...

Note that a single element field list may be equal to field, for example f[0:1].equals(f[0]) and f[0].equals(f[0:1]) are always True.

See also

cf.Field.equals, set_equals

Examples 1:
>>> b = f.equals(g)
Parameters:
other: object

The object to compare for equality.

atol: float, optional

The absolute tolerance for all numerical comparisons, By default the value returned by the cf.ATOL function is used.

rtol: float, optional

The relative tolerance for all numerical comparisons, By default the value returned by the cf.RTOL function is used.

ignore_fill_value: bool, optional

If True then data arrays with different fill values are considered equal. By default they are considered unequal.

traceback: bool, optional

If True then print a traceback highlighting where the two field lists differ.

ignore: tuple, optional

The names of CF properties to omit from the comparison. By default, the CF Conventions property is omitted.

Returns:
out: bool

Whether or not the two field lists are equal.

Examples 2:
>>> f.Conventions
'CF-1.0'
>>> g = f.copy()
>>> g.Conventions = 'CF-1.5'
>>> f.equals(g)
True

In the following example, two fields differ only by the long name of their time coordinates. The traceback shows that they differ in their domains, that they differ in their time coordinates and that the long name could not be matched.

>>> g = f.copy()
>>> g.coord('time').long_name += ' different'
>>> f.equals(g, traceback=True)
Domain: Different coordinate: <CF Coordinate: time(12)>
Field: Different domain properties: <CF Domain: (128, 1, 12, 64)>, <CF Domain: (128, 1, 12, 64)>
False