This function calculates the temperature (°C) from relative humidity (%) and dew point temperature (°C).
Details
The temperature is calculated using the following equation derived from the August-Roche-Magnus approximation:
$$TempC=\frac{243.04\times\left(\frac{17.625\times DewP}{243.04+DewP}-\log\left(\frac{RH}{100}\right)\right)}{17.625+\log\left(\frac{RH}{100}\right)-\frac{17.625\times DewP}{243.04+DewP}}$$
Where:
Temp is the calculated temperature in Celsius
RH is the relative humidity in percent
DewP is the dew point temperature in Celsius
Examples
# Calculate temperature for RH of 50% and dew point of 15°C
calcTemp(50, 15)
#> [1] 26.24387
calcTemp(50, calcDP(20, 50))
#> [1] 20
head(mydata) |> dplyr::mutate(DewPoint = calcDP(Temp, RH), Temp2 = calcTemp(RH, DewPoint))
#> # A tibble: 6 × 7
#> Site Sensor Date Temp RH DewPoint Temp2
#> <chr> <chr> <dttm> <dbl> <dbl> <dbl> <dbl>
#> 1 London Room 1 2024-01-01 00:00:00 21.8 36.8 6.38 21.8
#> 2 London Room 1 2024-01-01 00:15:00 21.8 36.7 6.34 21.8
#> 3 London Room 1 2024-01-01 00:29:59 21.8 36.6 6.30 21.8
#> 4 London Room 1 2024-01-01 00:44:59 21.7 36.6 6.22 21.7
#> 5 London Room 1 2024-01-01 00:59:59 21.7 36.5 6.18 21.7
#> 6 London Room 1 2024-01-01 01:14:59 21.7 36.2 6.06 21.7