resqpy.weights_and_measures.convert¶
- resqpy.weights_and_measures.convert(x, unit_from, unit_to, quantity=None, inplace=False)¶
Convert value between two compatible units.
- Parameters
x (numeric or np.array) – value(s) to convert
unit_from (str) – resqml uom
unit_to (str) – resqml uom
quantity (str, optional) – If provided, raise an exception if units are not supported by this quantity
inplace (bool) – if True, convert arrays in-place. Else, return new value
- Returns
Converted value(s)
- Raises
InvalidUnitError – if units cannot be coerced into RESQML units
IncompatibleUnitsError – if units do not have compatible base units