Function to calculate relative humidity (%) from temperature (°C) and dew point (°C)
Details
The relative humidity is calculated using the following equation derived from the August-Roche-Magnus approximation:
$$RH=100\times\frac{\exp\left(\frac{\left(17.625\times DewP\right)}{\left(243.04+DewP\right)}\right)}{\exp\left(\frac{\left(17.625\times Temp\right)}{\left(243.04+Temp\right)}\right)}$$
Where:
RH is the relative humidity in percent
Temp is the air temperature in °C
DewP is the dew point temperature in °C
References
Alduchov, O. A., and R. E. Eskridge, 1996: Improved Magnus' form approximation of saturation vapor pressure. J. Appl. Meteor., 35, 601-609.
https://bmcnoldy.earth.miami.edu/Humidity.html
Examples
# RH at air tempertaure of 20C and dew point of 15°C
calcRH_DP(20, 15)
#> [1] 72.93877
calcRH_DP(20, calcDP(20, 50))
#> [1] 50
head(mydata) |> dplyr::mutate(DewPoint = calcDP(Temp, RH), RH2 = calcRH_DP(Temp, DewPoint))
#> # A tibble: 6 × 7
#> Site Sensor Date Temp RH DewPoint RH2
#> <chr> <chr> <dttm> <dbl> <dbl> <dbl> <dbl>
#> 1 London Room 1 2024-01-01 00:00:00 21.8 36.8 6.38 36.8
#> 2 London Room 1 2024-01-01 00:15:00 21.8 36.7 6.34 36.7
#> 3 London Room 1 2024-01-01 00:29:59 21.8 36.6 6.30 36.6
#> 4 London Room 1 2024-01-01 00:44:59 21.7 36.6 6.22 36.6
#> 5 London Room 1 2024-01-01 00:59:59 21.7 36.5 6.18 36.5
#> 6 London Room 1 2024-01-01 01:14:59 21.7 36.2 6.06 36.2