heat_index.Rd
heat_index
converts a numeric scalar of temperature
(in Fahrenheit) and a numeric scalar of relative humidity (in %)
to heat index (in Fahrenheit). This function is not meant to be used
outside of the heat_index_vec()
function.
heat_index(t, rh)
.heat.index(t = NA, rh = NA)
heat_index_vec(t = NA, rh = NA)
A numeric scalar of heat index, in celsius
If an impossible value of relative humidity is given
(below 0% or above 100%), heat index is returned as NA
.
Equations are from the source code for the US National Weather Service's online heat index calculator.
Anderson GB, Bell ML, Peng RD. 2013. Methods to calculate the heat index as an exposure Metric in environmental health research. Environmental Health Perspectives 121(10):1111-1119.
National Weather Service Hydrometeorological Prediction Center Web Team. Heat Index Calculator. 30 Jan 2015. http://www.wpc.ncep.noaa.gov/html/heatindex.shtml. Accessed 18 Dec 2015.
Rothfusz L. 1990. The heat index (or, more than you ever wanted to know about heat index) (Technical Attachment SR 90-23). Fort Worth: Scientific Services Division, National Weather Service.
R. Steadman, 1979. The assessment of sultriness. Part I: A temperature-humidity index based on human physiology and clothing science. Journal of Applied Meteorology, 18(7):861–873.
n <- 1e3
t <- seq(-50, 100, length.out = n)
rh <- seq(0, 100, length.out = length(t))
## bug exist
i <- 88
heat_index(t[i], rh[i])
#> [1] -36.93694
heat_index_vec(t[i], rh[i])
#> [1] -36.93694
# heat_index_julia(t[i], rh[i])
# julia_setup()
r <- heat_index(t, rh)
r_vec <- heat_index_vec(t, rh)
# r_jl <- heat_index_julia(t, rh)
# add tests for julia NA values
# r1 <- heat_index_julia(t*NA, rh*NA)
all.equal(r, r_vec)
#> [1] TRUE
# all.equal(r_jl, r_vec)
# microbenchmark::microbenchmark(
# r2 <- heat_index(t, rh),
# r1 <- heat_index_julia(t, rh)
# # r_vec <- heat_index_vec(t, rh)
# )