Skip to content

mcci-catena/heat-index

Repository files navigation

NWS Heat Index Calculations

Heat-Image Chart

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.

GitHub release GitHub commits

Background Material

As background info, we also include:

Test and Reference

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.

Library Routines and Test Harnesses

  • 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 returns null 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 labeled test-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).

Updating the CSV Query

  • Open the spreadsheet.
  • Switch to the CSV-Query sheet
  • Switch to the Query tab (at the top -- it appears only when you open the CSV-Query sheet).
  • Click Edit.
  • The "Power Query Editor" appears in a new window.
  • Make sure Home tab is selected, then click Data Source Settings
  • Click Change Source...
  • Edit the file path.
  • Click OK, then click Close.
  • Close the Power Query window.
  • Your data should now appear.

License, Acknowledgements, etc.

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.