# [Tutorial] Heat Index

## Heat Index

Heat index is a measure of how hot it really feels when relative humidity is factored in with the actual air temperature. Facer does not currently have a tag for this calculation currently, so I decided to look into the math needed for it.

## Details

The Math

In my online research I located NOAA’s website which included an online calculator, explanation, and equation. Converting this to something Facer could use ended up being quite tricky. The other complicating factor is that these calculations are all focused on Temperature in Fahrenheit. To appeal to all users there needed to be two versions of the formula that would detect what the user has selected.
http://www.wpc.ncep.noaa.gov/html/heatindex_equation.shtml

HI = -42.379 + 2.04901523T + 10.14333127RH — .22475541TRH — .00683783TT — .05481717RHRH + .00122874TTRH + .00085282TRHRH — .00000199TTRHRH

National Weather Service

The calculation is adapted by substituting Facer tags for the appropriate values:
T = Temperature = #WCT#
RH = Relative Humidity = #WCHN#

(round(-42.379 + (2.04901523*#WCT#) + (10.14333127*#WCHN#) — (0.22475541*#WCT##WCHN#) — (0.00683783#WCT##WCT#) — (0.05481717#WCHN##WCHN#) + (0.00122874#WCT##WCT##WCHN#) + (0.00085282*#WCT##WCHN##WCHN#) — (0.00000199*#WCT##WCT##WCHN#*#WCHN#)))
Round was added to the full expression to limit the long decimal.

## Complications

There is a complication to the formula however. The Rothfusz regression is not valid for extreme temperature and relative humidity conditions beyond the range of data considered by Steadman. Anything with temps lower than 80F or Relative Humidity lower than 40% will not work as you can see in the NOAA chart above. So a conditional statement needed to be added to not return a result when conditions were outside of these values:

\$(#WCT#)>=80&&(#WCHN#)>40? (round(-42.379 + (2.04901523*#WCT#) + (10.14333127*#WCHN#) — (0.22475541*#WCT##WCHN#) — (0.00683783#WCT##WCT#) — (0.05481717#WCHN##WCHN#) + (0.00122874#WCT##WCT##WCHN#) + (0.00085282*#WCT##WCHN##WCHN#) — (0.00000199*#WCT##WCT##WCHN#*#WCHN#)))F:(#WCT#)F\$

The above calculation is valid only for Fahrenheit. To convert for Celsius we need to use the following calculation for the #WCT# tag:

((#WCT#*1.8)+32)

And the applied to the whole formula:

\$((#WCT#1.8)+32)>=80&&(#WCHN#)>40? (round((((-42.379 + (2.04901523((#WCT#1.8)+32)) + (10.14333127#WCHN#) — (0.22475541*((#WCT#1.8)+32)#WCHN#) — (0.00683783*((#WCT#1.8)+32)((#WCT#1.8)+32)) — (0.05481717#WCHN##WCHN#) + (0.00122874((#WCT#1.8)+32)((#WCT#1.8)+32)#WCHN#) + (0.00085282*((#WCT#1.8)+32)#WCHN##WCHN#) — (0.00000199((#WCT#1.8)+32)((#WCT#1.8)+32)#WCHN#*#WCHN#)))-32)*0.5555))C:(#WCT#)C\$

## Final Touches

For the final touches, adding in transparency conditions for the F/C user setting is required. This requires two elements. One each for the users preference in Temperature units. Place this formula in the transparency field:

Element 1 — Fahrenheit

\$#WM#=F?100:0\$

Element 2 — Celsius

\$#WM#=C?100:0\$