This repository has a grab-bag of calculators and reference data for the Heat Index as defined by the US National Weather Service. There's nothing unique here, except perhaps that the code is intended to be used as library functions in other programs.
- Background Material
- Test and Reference
- Library Routines and Test Harnesses
- Updating the CSV Query
- License, Acknowledgements, etc.
As background info, we also include:
- Lans Rothfusz' 1990 paper that defines the calculations we use (and gives background).
- A reference PDF of the NWS Heat Index Equation page from 2018-09-23, which defines additional corrections and refinements.
- Another reference chart mapping (temperature, dew point) to heat index (accessed 2020-07-12 from
https://www.weather.gov/media/jetstream/global/heatindex_chart_dp.pdf
)
As a utility, we provide an Excel spreadsheet, heat-index.xlsm. This opens to a table calculated using the NWS formulas. It also includes sheets for comparing a .csv file against the reference table.
-
Everybody loves Excel. We have a Visual Basic routine that can be used in your spreadsheets:
heat-index.vba
. This version returns#Value
for input values that are not part of the defined range. -
JavaScript:
heat-index.js
. This implementation returnsnull
for input values that are out of the defined domain of the function, and also for output values that would be over 183.5 degrees F (because the tables online don't cover input compbinations in this range).To test, use Node.js and the test harness
test-heat-index.js
, as follows:cat heat-index.js test-heat-index.js | node - >test-heat-index.csv
Then open
heat-index.xslm
. Unfortunately, Excel doesn't keep relative paths, so you'll have to change the spreadsheet to point to the CSV file properly. See (#updating-the-csv-query). Once the input is correct, the sheet labeledtest-heat-index
will check the cvs values against the reference, and puts a summary at the top of the page ("All Match: TRUE" for success).
- Open the spreadsheet.
- Switch to the
CSV-Query
sheet - Switch to the
Query
tab (at the top -- it appears only when you open theCSV-Query
sheet). - Click
Edit
. - The "Power Query Editor" appears in a new window.
- Make sure
Home
tab is selected, then clickData Source Settings
- Click
Change Source...
- Edit the file path.
- Click
OK
, then clickClose
. - Close the Power Query window.
- Your data should now appear.
This page is maintained by Terry Moore of MCCI Corporation.
This material is released under the MIT license. The two PDFs are from US government websites and are therefore in the public domain.
Material was verified against a chart posted by iweathernet.com. The chart we used is in the repo at assets/heat-index-chart-relative-humidity-2.png
.
MCCI is a registered trademark of MCCI Corporation.