Examples
Some example calculations
The heatindex
package has one function, which is also called heatindex
. The heatindex
function takes two arguments: the absolute air temperature in Kelvin and the relative humdity from 0 to 1. Below are some (rather trivial) examples.
Calculate a single value of the heat index
Given a single temperature, e.g., 300 K, and a single relative humidity, e.g., 0.5, we can calculate the heat index as follows.
library(heatindex)
heatindex(300,0.5)
import heatindex as hi
hi.heatindex(300,0.5)
This returns the heat index in Kelvin.
Calculate an array of heat index values
If, instead, we have an array of temperature and an array of relative humidity, we can feed those to heatindex
and it will return an array of heat index values.
library(heatindex)
T <- matrix(301:312,nrow=3,byrow=TRUE)
rh <- matrix(1:12/12,nrow=3,byrow=TRUE)
heatindex(T,rh)
import numpy as np
T = np.linspace(301, 312, 12).reshape(3, 4)
rh = np.linspace(1, 12, 12).reshape(3, 4)/12
hi.heatindex(T,rh)
This returns a 3 x 4 matrix of heat index values in Kelvin.