converters
This module defines unit converters for the units in 'property_utils.units.units' as well as some converters for common exponentiated units (area and volume).
AbsoluteTemperatureUnitConverter
Bases: AbsoluteUnitConverter
Convert absolute temperature with this converter.
Examples:
>>> AbsoluteTemperatureUnitConverter.convert(10, AbsoluteTemperatureUnit.KELVIN, AbsoluteTemperatureUnit.RANKINE)
18.0
Source code in src/property_utils/units/converters.py
AliasEnergyUnitConverter
Bases: AbsoluteUnitConverter
Convert energy units with this converter.
Examples:
Source code in src/property_utils/units/converters.py
AliasForceUnitConverter
Bases: AbsoluteUnitConverter
Convert force units with this converter.
Examples:
Source code in src/property_utils/units/converters.py
AliasPowerUnitConverter
Bases: AbsoluteUnitConverter
Convert power units with this converter.
Examples:
Source code in src/property_utils/units/converters.py
AliasPressureUnitConverter
Bases: AbsoluteUnitConverter
Convert pressure units with this converter.
Examples:
Source code in src/property_utils/units/converters.py
AmountUnitConverter
Bases: AbsoluteUnitConverter
Convert amount units with this converter.
Examples:
Source code in src/property_utils/units/converters.py
AreaUnitConverter
Bases: ExponentiatedUnitConverter
Convert area units with this converter.
Examples:
Source code in src/property_utils/units/converters.py
ElectricCurrentUnitConverter
Bases: AbsoluteUnitConverter
Convert electric current units with this converter.
Examples:
>>> ElectricCurrentUnitConverter.convert(1000, ElectricCurrentUnit.MILLI_AMPERE, ElectricCurrentUnit.AMPERE)
1.0
Source code in src/property_utils/units/converters.py
EnergyUnitConverter
Bases: CompositeUnitConverter
Convert energy units (mass * length^2 / time^2) with this converter.
Examples:
>>> from_unit = MassUnit.KILO_GRAM * (LengthUnit.METER**2) / (TimeUnit.MINUTE**2)
>>> to_unit = MassUnit.METRIC_TONNE * (LengthUnit.CENTI_METER**2) / (TimeUnit.MINUTE**2)
>>> EnergyUnitConverter.convert(25, from_unit, to_unit)
250.0
Source code in src/property_utils/units/converters.py
ForceUnitConverter
Bases: CompositeUnitConverter
Convert force units (mass * length / time^2) with this converter.
Examples:
>>> from_unit = MassUnit.KILO_GRAM * LengthUnit.CENTI_METER / (TimeUnit.SECOND**2)
>>> to_unit = MassUnit.GRAM * LengthUnit.METER / (TimeUnit.SECOND**2)
>>> ForceUnitConverter.convert(100, from_unit, to_unit)
1000.0
Source code in src/property_utils/units/converters.py
LengthUnitConverter
Bases: AbsoluteUnitConverter
Convert length units with this converter.
Examples:
Source code in src/property_utils/units/converters.py
MassUnitConverter
Bases: AbsoluteUnitConverter
Convert mass units with this converter.
Examples:
Source code in src/property_utils/units/converters.py
NonDimensionalUnitConverter
Bases: AbsoluteUnitConverter
This converter is needed for compatibility, i.e. for conversions to work from non-dimensional units to non-dimensional dimensions.
Source code in src/property_utils/units/converters.py
PowerUnitConverter
Bases: CompositeUnitConverter
Convert power units (mass * length^2 / time^3) with this converter.
Examples:
>>> from_unit = MassUnit.KILO_GRAM * (LengthUnit.METER**2) / (TimeUnit.MINUTE**3)
>>> to_unit = MassUnit.METRIC_TONNE * (LengthUnit.CENTI_METER**2) / (TimeUnit.MINUTE**3)
>>> PowerUnitConverter.convert(15, from_unit, to_unit)
150.0
Source code in src/property_utils/units/converters.py
PressureUnitConverter
Bases: CompositeUnitConverter
Convert pressure units (mass / length / time^2) with this converter.
Examples:
>>> from_unit = MassUnit.GRAM / LengthUnit.CENTI_METER / (TimeUnit.HOUR**2)
>>> to_unit = MassUnit.KILO_GRAM / LengthUnit.METER / (TimeUnit.HOUR**2)
>>> PressureUnitConverter.convert(50, from_unit, to_unit)
5.0
Source code in src/property_utils/units/converters.py
RelativeTemperatureUnitConverter
Bases: RelativeUnitConverter
Convert temperature units with this converter.
Examples:
>>> RelativeTemperatureUnitConverter.convert(100, RelativeTemperatureUnit.CELCIUS, RelativeTemperatureUnit.FAHRENHEIT)
212.0
Source code in src/property_utils/units/converters.py
TimeUnitConverter
Bases: AbsoluteUnitConverter
Convert time units with this converter.
Examples:
Source code in src/property_utils/units/converters.py
UnitPrefix
Bases: float
, Enum
Enumeration of unit prefixes. Handy when converting to and fro prefixed units.
Examples:
Source code in src/property_utils/units/converters.py
inverse()
Return the inverse of the unit prefix. Use when prefixing a unit.
Examples:
Source code in src/property_utils/units/converters.py
VolumeUnitConverter
Bases: ExponentiatedUnitConverter
Convert volume units with this converter.
Examples: