cf.Units.equals¶
-
Units.
equals
(other, rtol=None, atol=None)[source]¶ Return True if and only if numeric values in one unit are convertible to numeric values in the other unit and their conversion is a scale factor of 1.
See also
Parameters: - other : Units
The other units.
Returns: - out : bool
True if the units are equal, False otherwise.
Examples: >>> u = Units('km') >>> v = Units('1000m') >>> w = Units('100000m') >>> u.equals(v) True >>> u.equals(w) False
>>> u = Units('m s-1') >>> m = Units('m') >>> s = Units('s') >>> u.equals(m) False >>> u.equals(m/s) True >>> (m/s).equals(u) True
Undefined units are considered equal:
>>> u = Units() >>> v = Units() >>> u.equals(v) True