cf.Units.equivalent

Units.equivalent(other)[source]

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

See also

equals

Parameters:
other : Units

The other units.

Returns:
out : bool

True if the units are equivalent, False otherwise.

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

Previous topic

cf.Units.equals

Next topic

cf.Units.formatted

This Page