library(humidr)

This vignette shows how to make psychrometric calculations using the humidr package.

The Wikipedia page on psychrometrics is a great resource.

Terminology

Symbol | Variable Name | Description ----------|---------------|--------------- $h$ | h | specific enthalpy (kJ/kg) $p$ | p_atm | atmospheric pressure (Pa) $p_sl$ | p_sl | sea-level pressure (Pa) $T_{db}$ | t, t_db | dry-bulb temperature (°C)
$T_{wb}$ | t_wb | wet-bulb temperature (°C) $W$ | w | humidity ratio, mass of water vapor to dry air (1) $z$ | z | elevation (m) $\phi$ | rh | relative humidity (1)

Let's say you have a weather station at a given elevation:

elevation <- 265 # elevation (m)

Let's say you have an set of weather observations at this station:

t_db <- 16.7 # dry-bulb temperauture (°C)
rh <- 0.96   # relative humidity (1)
p_sl <- 101380.0 # sea-level pressure (Pa)

The first thing we need to do is to estimate the atmospheric pressure at the station, given the sea-level pressure reported at the weather station. If that is not available, we can use the standard value for sea-level pressure, 101325 Pa.

We use equation (3) from the ASHRAE handbook:

[ p = p_{sl} \times (1 - \frac{z}{44330.8 \; \rm{m}})^{5.5229} ]

p_atm <- p_atm_z(z = elevation, p_sl = p_sl) # atmospheric pressure (Pa)
p_atm

Now, we can find the humidity ratio (mass of water vapor/mass of dry air), the enthalpy of the moist air (kJ/kg), and the wet-bulb temperature (°C):

w <- w_t_rh(t = t_db, rh = rh, p_atm = p_atm)  # humidity ratio (1)
h_moist <- h_t_w(t = t_db, w = w)              # enthalpy (kJ/kg) 
t_wb <- t_wb(t = t_db, rh = rh, p_atm = p_atm) # wet-bulb temperature (°C)

w
h_moist
t_wb

Vectorized calculation

Given a series of observations:

library(dplyr)

wx_today <- data.frame(
  t_db = c(25.0, 25.0, 22.8, 21.1, 16.7),
  rh = c(0.54, 0.54, 0.62, 0.68, 0.96),
  p_sl = c(101310.0, 101260.0, 101240.0, 101310.0, 101380.0)
)

wx_today <- 
  wx_today %>%
  mutate(
    w = w_t_rh(t_db, rh, p_atm),
    h_moist = h_t_w(t_db, w),
    t_wb = t_wb(t_db, rh, p_atm)
  )
knitr::kable(wx_today)

Naming convention

Function | Description --------- | ------------ h_t_rh | find enthalpy given (db) temperature and relative humidity h_t_w | find enthalpy given (db) temperature and humidity ratio p_atm_z | find atmospheric pressure given elevation (and sea-level pressure) p_ws_t | find saturation-pressure of water-vapor given (db) temperature t_wb | find wet-bulb temperature w_pw | find humidity ratio given saturation-pressure of water-vapor (and atmospheric pressure) w_t_rh | find humidity ratio given (db) temperature and relative humidity

Reference

Chapter 6, 2005 ASHRAE Handbook -- Fundamentals (SI)



ijlyttle/humidr documentation built on May 18, 2019, 3:41 a.m.