heat_index: Algorithm for heat.index function.

Description Usage Arguments Details Value Note Author(s) References Examples

Description

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() function.

Usage

1
2
3
4
5
6
7

Arguments

t

Numeric scalar of air temperature, in celsius.

rh

Numeric scalar of relative humidity, in %.

Details

If an impossible value of relative humidity is given (below 0% or above 100%), heat index is returned as NA.

Value

A numeric scalar of heat index, in celsius

Note

Equations are from the source code for the US National Weather Service's online heat index calculator.

Author(s)

Brooke Anderson brooke.anderson@colostate.edu, Roger Peng rdpeng@gmail.com

References

  1. 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.

  2. 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.

  3. 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.

  4. 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.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
n <- 1e3
t <- seq(-10, 50, length.out = n)
rh <- seq(0.1, 1, length.out = length(t))

## bug exist
# i <- 88
heat_index(t[i], rh[i])
heat_index_julia(t[i], rh[i])
heat_index_vec(t[i], rh[i])


r2 <- heat_index(t, rh)
r1 <- heat_index_julia(t, rh)
r_vec <- heat_index_vec(t, rh)

julia_setup()
# add tests for julia NA values
r1 <- heat_index_julia(t*NA, rh*NA)

all.equal(r1, r2)
all.equal(r1, r_vec)

microbenchmark::microbenchmark(
    r2 <- heat_index(t, rh),
    r1 <- heat_index_julia(t, rh),
    r_vec <- heat_index_vec(t, rh)
)

CUG-hydro/heatwave documentation built on Dec. 17, 2021, 1:53 p.m.