cf.TimeDuration.equivalent

TimeDuration.equivalent(other, rtol=None, atol=None, traceback=False)[source]

True if two time durations are logically equivalent.

See also

equals

New in version 1.0.

Parameters:
other :

The object to compare for equivalence.

atol : float, optional

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

rtol : float, optional

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

traceback : bool, optional

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

Returns:
out : bool

Whether or not the two instances logically equivalent.

Examples:
>>> t = cf.TimeDuration(36, 'calendar_months')
>>> u = cf.TimeDuration(3, 'calendar_years') 
>>> t == u
True
>>> t.equivalent(u)
True
>>> t.equals(u, traceback=True)
TimeDuration: Different durations: <CF Data: 12 calendar_months>, <CF Data: 1 calendar_years>
False