cf.Units.equivalent

Units.equivalent(other)[source]

Returns True if numeric values in one unit are convertible to numeric values in the other unit.

Parameters :
other : Units

The other units.

Returns :
out : bool

True if the units are equivalent, False otherwise.

Examples

>>> u = Units(units='m')
>>> v = Units(units='km')
>>> w = Units(units='s')
>>> u.equivalent(v)
True
>>> u.equivalent(w)
False
>>> u = Units(units='days since 2000-1-1')
>>> v = Units(units='days since 2000-1-1', calendar='366_day')
>>> w = Units(units='seconds since 1978-3-12')
>>> u.equivalent(v)
False
>>> u.equivalent(w)
True

Previous topic

cf.Units.equals

Next topic

cf.Units.formatted

This Page