ladybug.psychrometrics module

Utility functions for converting between humidity metrics.

ladybug.psychrometrics.db_temp_and_hr_from_wb_rh(wb_temp, rel_humid, b_press=101325)[source]

Dry bulb temperature (C) from wet bulb temperature (C) and relative humidity (%).

Parameters
  • wb_temp – Wet bulb temperature (C).

  • rel_humid – Relative humidity (%).

  • b_press – Air pressure (Pa). Default is pressure at sea level (101325 Pa).

Returns

A tuple with two values.

  • Dry bulb temperature (C).

  • Humidity ratio (kg water/kg air).

Note

[1] ASHRAE Handbook - Fundamentals (2017)

ladybug.psychrometrics.db_temp_from_enth_hr(enthalpy, humid_ratio, reference_temp=0)[source]

Dry bulb temperature (C) from enthalpy (kJ/kg) and humidity ratio (water/air).

Parameters
  • enthalpy – Enthalpy (kJ/kg).

  • humid_ratio – Humidity ratio (kg water/kg air).

  • reference_temp – Reference dry air temperature (C). Default is 0C, which is standard practice for SI enthalpy values. However, for IP enthalpy, this is typically at 0F (-17.78C). Alternatively, for absolute thermodynamic enthalpy, one can input 0K (-273.15).

Returns

Dry bulb temperature (C).

Note

[1] ASHRAE Handbook - Fundamentals (2017) ch. 1 eqn 30

ladybug.psychrometrics.db_temp_from_rh_hr(rel_humid, humid_ratio, b_press=101325)[source]

Dry bulb temperature (C) from relative humidity (%) and humidity ratio (water/air).

Parameters
  • rel_humid – Relative humidity (%).

  • humid_ratio – Humidity ratio (kg water/kg air).

  • b_press – Air pressure (Pa). Default is pressure at sea level (101325 Pa).

Returns

Dry bulb temperature (C).

Note

[1] Antoine equation - Antoine, C. (1888), Vapor Pressure: a new relationship between pressure and temperature, 107: 681–684, 778–780, 836–837. https://en.wikipedia.org/wiki/Antoine_equation

ladybug.psychrometrics.dew_point_from_db_enth(db_temp, enthalpy, b_press=101325, reference_temp=0)[source]

Dew point temperature (C) from air temperature (C) and enthalpy (kJ/kg).

Parameters
  • db_temp – Dry bulb temperature (C).

  • enthalpy – Enthalpy (kJ/kg).

  • b_press – Air pressure (Pa). Default is pressure at sea level (101325 Pa).

  • reference_temp – Reference dry air temperature (C). Default is 0C, which is standard practice for SI enthalpy values. However, for IP enthalpy, this is typically at 0F (-17.78C). Alternatively, for absolute thermodynamic enthalpy, one can input 0K (-273.15).

Returns

Dew point temperature (C).

ladybug.psychrometrics.dew_point_from_db_hr(db_temp, humid_ratio, b_press=101325)[source]

Dew Point Temperature (C) from air temperature (C) and humidity ratio (water/air).

Parameters
  • db_temp – Dry bulb temperature (C).

  • humid_ratio – Humidity ratio (kg water/kg air).

  • b_press – Air pressure (Pa). Default is pressure at sea level (101325 Pa).

Returns

Dew point temperature (C).

ladybug.psychrometrics.dew_point_from_db_rh(db_temp, rel_humid)[source]

Dew point temperature (C) from air temperature (C) and relative humidity (%).

The dew point temperature is solved by inverting the equation giving water vapor pressure at saturation from temperature, which is relatively slow but ensures high accuracy down to 0.1 C at a wide range of dry bulb temperatures. The Newton-Raphson (NR) method is used on the logarithm of water vapour pressure as a function of temperature, which is a very smooth function Convergence is usually achieved in 3 to 5 iterations.

Parameters
  • db_temp – Dry bulb temperature (C).

  • rel_humid – Relative humidity (%).

Returns

Dew point temperature (C).

Note

[1] ASHRAE Handbook - Fundamentals (2017) ch. 1 eqn. 5 and 6

[2] Meyer et al., (2019). PsychroLib: a library of psychrometric functions to calculate thermodynamic properties of air. Journal of Open Source Software, 4(33), 1137, https://doi.org/10.21105/joss.01137 https://github.com/psychrometrics/psychrolib/blob/master/src/python/psychrolib.py

ladybug.psychrometrics.dew_point_from_db_rh_fast(db_temp, rel_humid)[source]

Dew point temperature (C) from air temperature (C) and relative humidity (%).

Note that the formula here is fast but is only accurate up to 90C. For accurate values at extreme temperatures, the dew_point_from_db_rh function should be used.

Parameters
  • db_temp – Dry bulb temperature (C).

  • rel_humid – Relative humidity (%).

Returns

Dew point temperature (C).

Note

[1] J. Sullivan and L. D. Sanders. “Method for obtaining wet-bulb temperatures by modifying the psychrometric formula.” Center for Experiment Design and Data Analysis. NOAA - National Oceanic and Atmospheric Administration. https://www.weather.gov/epz/wxcalc_rh

ladybug.psychrometrics.dew_point_from_db_wb(db_temp, wet_bulb, b_press=101325)[source]

Dew point temperature (C) from dry bulb (C) and wet bulb temperature (C).

Parameters
  • db_temp – Dry bulb temperature (C).

  • wet_bulb – Wet bulb temperature (C).

  • b_press – Air pressure (Pa). Default is pressure at sea level (101325 Pa).

Returns

Dew point temperature (C).

ladybug.psychrometrics.enthalpy_from_db_hr(db_temp, humid_ratio, reference_temp=0)[source]

Enthalpy (kJ/kg) at a given humidity ratio (water/air) and dry bulb temperature (C).

Parameters
  • db_temp – Dry bulb temperature (C).

  • humid_ratio – Humidity ratio (kg water/kg air).

  • reference_temp – Reference dry air temperature (C). Default is 0C, which is standard practice for SI enthalpy values. However, for IP enthalpy, this is typically at 0F (-17.78C). Alternatively, for absolute thermodynamic enthalpy, one can input 0K (-273.15).

Returns

Enthalpy (kJ/kg).

Note

[1] ASHRAE Handbook - Fundamentals (2017) ch. 1 eqn 30

[2] Meyer et al., (2019). PsychroLib: a library of psychrometric functions to calculate thermodynamic properties of air. Journal of Open Source Software, 4(33), 1137, https://doi.org/10.21105/joss.01137 https://github.com/psychrometrics/psychrolib/blob/master/src/python/psychrolib.py

ladybug.psychrometrics.humid_ratio_from_db_rh(db_temp, rel_humid, b_press=101325)[source]

Humidity ratio (kg water/kg air) from air temperature (C) and relative humidity (%).

Parameters
  • db_temp – Dry bulb temperature (C).

  • rel_humid – Relative humidity (%).

  • b_press – Air pressure (Pa). Default is pressure at sea level (101325 Pa).

Returns

Humidity ratio (kg water/kg air).

Note

[1] ASHRAE Handbook - Fundamentals (2017) ch. 1 eqn 20

[2] Meyer et al., (2019). PsychroLib: a library of psychrometric functions to calculate thermodynamic properties of air. Journal of Open Source Software, 4(33), 1137, https://doi.org/10.21105/joss.01137 https://github.com/psychrometrics/psychrolib/blob/master/src/python/psychrolib.py

ladybug.psychrometrics.humid_ratio_from_db_wb(db_temp, wb_temp, b_press=101325)[source]

Humidity ratio from air temperature (C) and wet bulb temperature (C).

Parameters
  • db_temp – Dry bulb temperature (C).

  • wb_temp – Wet bulb temperature (C).

  • b_press – Air pressure (Pa). Default is pressure at sea level (101325 Pa).

Returns

Humidity ratio (kg water / kg air).

Note

[1] ASHRAE Handbook - Fundamentals (2017) ch. 1 eqn 36, solved for W

ladybug.psychrometrics.rel_humid_from_db_dpt(db_temp, dew_pt)[source]

Relative humidity (%) from dry bulb temperature (C), and dew point temperature (C).

Parameters
  • db_temp – Dry bulb temperature (C).

  • dew_pt – Dew point temperature (C).

Returns

Relative humidity (%).

ladybug.psychrometrics.rel_humid_from_db_enth(db_temp, enthalpy, b_press=101325, reference_temp=0)[source]

Relative Humidity (%) from air temperature (C) and enthalpy (kJ/kg).

Parameters
  • db_temp – Dry bulb temperature (C).

  • enthalpy – Enthalpy (kJ/kg).

  • b_press – Air pressure (Pa). Default is pressure at sea level (101325 Pa).

  • reference_temp – Reference dry air temperature (C). Default is 0C, which is standard practice for SI enthalpy values. However, for IP enthalpy, this is typically at 0F (-17.78C). Alternatively, for absolute thermodynamic enthalpy, one can input 0K (-273.15).

Returns

Relative humidity (%).

ladybug.psychrometrics.rel_humid_from_db_hr(db_temp, humid_ratio, b_press=101325)[source]

Relative Humidity (%) from humidity ratio (water/air) and air temperature (C).

Parameters
  • db_temp – Dry bulb temperature (C).

  • humid_ratio – Humidity ratio (kg water/kg air).

  • b_press – Air pressure (Pa). Default is pressure at sea level (101325 Pa).

Returns

Relative humidity (%).

ladybug.psychrometrics.rel_humid_from_db_wb(db_temp, wet_bulb, b_press=101325)[source]

Relative humidity (%) from dry bulb temperature (C), and wet bulb temperature (C).

Parameters
  • db_temp – Dry bulb temperature (C).

  • wet_bulb – Wet bulb temperature (C).

  • b_press – Air pressure (Pa). Default is pressure at sea level (101325 Pa).

Returns

Relative humidity (%).

ladybug.psychrometrics.saturated_vapor_pressure(t_kelvin)[source]

Saturated vapor pressure (Pa) at a given dry bulb temperature (K).

This function accounts for the different behavior above vs. below the freezing point of water.

Parameters

t_kelvin – Dry bulb temperature (K).

Returns

Saturated vapor pressure (Pa).

Note

[1] ASHRAE Handbook - Fundamentals (2017) ch. 1 eqn. 5 and 6

[2] Meyer et al., (2019). PsychroLib: a library of psychrometric functions to calculate thermodynamic properties of air. Journal of Open Source Software, 4(33), 1137, https://doi.org/10.21105/joss.01137 https://github.com/psychrometrics/psychrolib/blob/master/src/python/psychrolib.py

ladybug.psychrometrics.wet_bulb_from_db_hr(db_temp, humid_ratio, b_press=101325)[source]

Wet bulb temperature (C) from air temperature (C) and humidity ratio.

Parameters
  • db_temp – Dry bulb temperature (C).

  • humid_ratio – Humidity ratio (kg water/kg air).

  • b_press – Air pressure (Pa). Default is pressure at sea level (101325 Pa).

Returns

Wet bulb temperature (C).

ladybug.psychrometrics.wet_bulb_from_db_rh(db_temp, rel_humid, b_press=101325)[source]

Wet bulb temperature (C) from air temperature (C) and relative humidity (%).

Parameters
  • db_temp – Dry bulb temperature (C).

  • rel_humid – Relative humidity (%).

  • b_press – Air pressure (Pa). Default is pressure at sea level (101325 Pa).

Returns

Wet bulb temperature (C).

Note

[1] ASHRAE Handbook - Fundamentals (2017) ch. 1 eqn 33 and 35

[2] Meyer et al., (2019). PsychroLib: a library of psychrometric functions to calculate thermodynamic properties of air. Journal of Open Source Software, 4(33), 1137, https://doi.org/10.21105/joss.01137 https://github.com/psychrometrics/psychrolib/blob/master/src/python/psychrolib.py

ladybug.psychrometrics.wet_bulb_from_db_rh_fast(db_temp, rel_humid, b_press=101325)[source]

Wet bulb temperature (C) from air temperature (C) and relative humidity (%).

Note that the formula here is fast but is only accurate around temperatures of 20C and lower. For accurate values at extreme temperatures, the wet_bulb_from_db_rh function should be used.

Parameters
  • db_temp – Dry bulb temperature (C).

  • rel_humid – Relative humidity (%).

  • b_press – Air pressure (Pa). Default is pressure at sea level (101325 Pa).

Returns

Wet bulb temperature (C).

Note

[1] J. Sullivan and L. D. Sanders. “Method for obtaining wet-bulb temperatures by modifying the psychrometric formula.” Center for Experiment Design and Data Analysis. NOAA - National Oceanic and Atmospheric Administration. https://www.weather.gov/epz/wxcalc_rh