Units#
Lightweight explicit SI conversion helpers. Public APIs document SI base units.
- engineeringkit.units.convert(value, from_unit, to_unit)[source]#
Convert a length or pressure between units.
- Parameters:
value (
float) – Finite value infrom_unit.from_unit (
str) – Unit names:m,mm,cm,km,in,ftfor length, orPa,kPa,MPa,bar,psifor pressure.to_unit (
str) – Unit names:m,mm,cm,km,in,ftfor length, orPa,kPa,MPa,bar,psifor pressure.
- Returns:
valueexpressed into_unit.- Return type:
float- Raises:
ValueError – If
valueis nonfinite or the units are unknown or of different quantities.
Notes
Use it to bring a value to SI before passing it to the package, whose inputs are raw SI numbers with no dimensional metadata.