units#

SI ↔ IP unit conversion helpers for psychrometric applications (temperature, humidity ratio, mass flow, power, pressure, volume flow, length, enthalpy, density, specific volume), plus state_to_ip() to convert a complete moist-air state at once.

API Reference#

SI ↔ IP unit conversion helpers for psychrometric applications.

Pure conversion functions, no state, no dependencies beyond stdlib. Conversion factors come from NIST SP 811 (2008). Each pair (X_to_Y / Y_to_X) round-trips to better than 1 part in 10⁶.

Conventions:

SI — °C, kg/kg, kJ/kg dry air, Pa, kg/s, m³/h, m, kg/m³, m³/kg IP — °F, gr/lb (grains per pound), BTU/lb dry air, psi/inHg, lb/h,

CFM, ft, lb/ft³, ft³/lb

Use state_to_ip() to convert an entire MoistAirState to a dict of IP-unit values in one shot.

pyedautils.units.c_to_f(c: float) → float[source]#

Celsius → Fahrenheit.

pyedautils.units.f_to_c(f: float) → float[source]#

Fahrenheit → Celsius.

pyedautils.units.c_to_k(c: float) → float[source]#

Celsius → Kelvin.

pyedautils.units.k_to_c(k: float) → float[source]#

Kelvin → Celsius.

pyedautils.units.kgkg_to_grlb(x: float) → float[source]#

kg water / kg dry air → grains water / lb dry air (mass ratio).

1 lb = 7000 grains; the mass ratio is dimensionless so the factor is 7000.

pyedautils.units.grlb_to_kgkg(x: float) → float[source]#

grains water / lb dry air → kg water / kg dry air.

pyedautils.units.kgkg_to_gkg(x: float) → float[source]#

kg / kg → g / kg (convenience).

pyedautils.units.gkg_to_kgkg(x: float) → float[source]#

g / kg → kg / kg (convenience).

pyedautils.units.kgs_to_lbh(m: float) → float[source]#

kg/s → lb/h.

pyedautils.units.lbh_to_kgs(m: float) → float[source]#

lb/h → kg/s.

pyedautils.units.kgs_to_kgh(m: float) → float[source]#

kg/s → kg/h.

pyedautils.units.kgh_to_kgs(m: float) → float[source]#

kg/h → kg/s.

pyedautils.units.kw_to_btuh(p: float) → float[source]#

kW → BTU/h.

pyedautils.units.btuh_to_kw(p: float) → float[source]#

BTU/h → kW.

pyedautils.units.pa_to_kpa(p: float) → float[source]#

Pa → kPa.

pyedautils.units.kpa_to_pa(p: float) → float[source]#

kPa → Pa.

pyedautils.units.pa_to_psi(p: float) → float[source]#

Pa → psi.

pyedautils.units.psi_to_pa(p: float) → float[source]#

psi → Pa.

pyedautils.units.pa_to_inhg(p: float) → float[source]#

Pa → inches of mercury (at 60 °F).

pyedautils.units.inhg_to_pa(p: float) → float[source]#

inches of mercury (at 60 °F) → Pa.

pyedautils.units.m3h_to_cfm(v: float) → float[source]#

m³/h → CFM (ft³/min).

pyedautils.units.cfm_to_m3h(v: float) → float[source]#

CFM (ft³/min) → m³/h.

pyedautils.units.m_to_ft(m: float) → float[source]#

metre → foot.

pyedautils.units.ft_to_m(ft: float) → float[source]#

foot → metre.

pyedautils.units.kjkg_to_btulb(h: float) → float[source]#

kJ/kg → BTU/lb.

pyedautils.units.btulb_to_kjkg(h: float) → float[source]#

BTU/lb → kJ/kg.

pyedautils.units.kgm3_to_lbft3(rho: float) → float[source]#

kg/m³ → lb/ft³.

pyedautils.units.lbft3_to_kgm3(rho: float) → float[source]#

lb/ft³ → kg/m³.

pyedautils.units.m3kg_to_ft3lb(v: float) → float[source]#

m³/kg → ft³/lb (reciprocal of density conversion).

pyedautils.units.ft3lb_to_m3kg(v: float) → float[source]#

ft³/lb → m³/kg.

pyedautils.units.state_to_ip(s: MoistAirState) → dict[source]#

Convert a MoistAirState (SI) to a dict of IP-unit values.

The returned dict has explicit unit suffixes in the keys so it can be handed directly to a UI/template without losing context.