This module provides some pythonic classes to define measures. At the moment only these mesures are supported
Bases: float
Class that models an enthalpy measure with conversion utilities
Supported units are
>>> h = Enthalpy(1000)
>>> h.kJkg
1.0
>>> h.kcalkg
0.23900573613766729
>>> h.Btulb
0.42992261392949266
Bases: float
Class that models a length measure with conversion utilities
Supported units are
>>> l = Length(1).unit('inch')
>>> l.mm
25.399999999999999
>>> l.ft
0.083333333333333343
>>> l
0.025399999999999999
Bases: float
Class that models a mass flow measure with conversion utilities
Supported units are
Bases: float
Class that models a mass flow measure with conversion utilities
Supported units are
Bases: float
Class that models a Pressure measure with conversion utilities
Suported units are
Normal instantiation is pressure in Pa. How much is an athmosphere?
>>> p = Pressure(1.0).unit('atm')
>>> p
101325.0
>>> p.torr
760.0
>>> p.mmwc
10285.839999999998
>>> p.psi
14.69594877551345
Bases: float
Class that models a temperature measure with conversion utilities
Supported units are
Normal instantiation is a temperature in Kelvin
>>> T = Temperature(100)
>>> T
100.0
But you can instantiate and specify if unit is Celsius or Fahrenheit
>>> T = Temperature(100).unit('F')
>>> T
310.92777777777775
Unit conversion is as easy as it gets.
>>> T.C
37.777777777777771
>>> T.F
99.999999999999986
You can compute with temperatures because inherits from the float built-in
>>> T1 = Temperature(200)
>>> T2 = Temperature(0).unit('C')
>>> T1+T2
473.14999999999998
If you don’t want to use the class’ attribute you can use the function getattr to get a value using the unit code.
>>> getattr(T,'C')
37.777777777777771