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 (
numericornp.array) – value(s) to convertunit_from (
str) – resqml uomunit_to (
str) – resqml uomquantity (
str, optional) – If provided, raise an exception if units are not supported by this quantityinplace (
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