ts_lib_units.convert module#
- convert_unit(raw_value_unit: ~ts_ids_core.schema.value_unit.RawValueUnit | ~ts_ids_core.schema.value_unit.ValueUnit, to_unit: ~ts_lib_units.tetra_unit.TetraUnit, ureg: ~pint.registry.UnitRegistry = <pint.registry.UnitRegistry object>) ValueUnit[source]#
Convert a value from one unit to another
- Parameters:
raw_value_unit – The RawValueUnit or ValueUnit object to convert
to_unit – The unit to convert to
ureg (optional) – The pint unit registry to use for conversion
- Returns:
A new ValueUnit object with the converted value and unit
- Return type:
ValueUnit