{
  "schemaVersion": 1,
  "slug": "heat-index-calculator",
  "category": "weather",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "4e5f0c3ff14779e4dc3aaa03b08f5be1af820493ed6ef96f58a93ee0b99f6219",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/heat-index-calculator.json",
    "src/engine.js"
  ],
  "runtimeSource": "/sources/engine.txt",
  "runtimeHash": "5c888d8898afbdee36267bb9977829e1e2ac568f6677c8ee87469c139864645c",
  "scope": "The compute function records implemented equations, constants, lookup tables and custom rules. Inputs record defaults and allowed values; outputs record precision and units. Defaults are examples, not recommendations. General background references are not evidence for this specific algorithm.",
  "publishedFormula": {
    "formula": "HI = mean(T, HI_simple) if preliminary HI<80°F; otherwise Rothfusz(T,RH)+humidity adjustments",
    "vars": [
      [
        "T",
        "Air temperature, °F"
      ],
      [
        "R",
        "Relative humidity, %"
      ],
      [
        "HI",
        "Heat index, °F"
      ]
    ],
    "note": "NWS method: preliminary HI = mean(T, simple estimate); if preliminary HI ≥80°F, use Rothfusz regression with low-RH (<13%, 80–112°F) and high-RH (>85%, 80–87°F) adjustments. Approximation assumes shade/light wind; reject T >112°F or RH outside 0–100%."
  },
  "externalEvidence": {
    "reviewedAt": "2026-10-12",
    "sources": [
      {
        "name": "NWS — Heat index equation and applicability",
        "url": "https://www.wpc.ncep.noaa.gov/html/heatindex_equation.shtml"
      }
    ],
    "referenceRole": "definition",
    "implementationHash": "4e5f0c3ff14779e4dc3aaa03b08f5be1af820493ed6ef96f58a93ee0b99f6219",
    "basis": "HI = mean(T, HI_simple) if preliminary HI<80°F; otherwise Rothfusz(T,RH)+humidity adjustments",
    "limitations": "The references explain definitions and methods; any extra preset must be checked against the assumptions on this page."
  },
  "contract": {
    "compute": "const T=unit==='c'?temperature*9/5+32:temperature; const R=humidity; if(!Number.isFinite(T)||!Number.isFinite(R)||R<0||R>100||T>110) return {heatIndexF:null,heatIndexC:null,feelsLikeDifference:null,feelsLikeDifferenceC:null,category:null,advice:null,__error:'inputError'}; const table=[[40,110],[45,108],[50,106],[55,104],[60,102],[65,100],[70,98],[75,96],[80,94],[85,92],[90,92],[95,90],[100,90]]; if(T>=80&&R>40){ let maxT=90; for(let i=0;i<table.length-1;i++){if(R<=table[i+1][0]){const p=(R-table[i][0])/(table[i+1][0]-table[i][0]);maxT=table[i][1]+p*(table[i+1][1]-table[i][1]);break;}} if(T>maxT+1e-9)return {heatIndexF:null,heatIndexC:null,feelsLikeDifference:null,feelsLikeDifferenceC:null,category:null,advice:null,__error:'inputError'};} const simple=0.5*(T+61+((T-68)*1.2)+(R*0.094)); let hi=(simple+T)/2; if(hi>=80){ hi=-42.379+2.04901523*T+10.14333127*R-0.22475541*T*R-0.00683783*T*T-0.05481717*R*R+0.00122874*T*T*R+0.00085282*T*R*R-0.00000199*T*T*R*R; if(R<13&&T>=80&&T<=112)hi-=((13-R)/4)*Math.sqrt((17-Math.abs(T-95))/17); if(R>85&&T>=80&&T<=87)hi+=((R-85)/10)*((87-T)/5); } const cat=hi<80?'Comfortable':hi<90?'Caution':hi<103?'Extreme caution':hi<125?'Danger':'Extreme danger'; const adv=hi<80?'No special precautions':hi<90?'Fatigue possible with prolonged exposure':hi<103?'Heat cramps and exhaustion possible':hi<125?'Heat exhaustion likely, heat stroke possible':'Heat stroke highly likely — avoid outdoor activity'; return {heatIndexF:hi,heatIndexC:(hi-32)*5/9,feelsLikeDifference:hi-T,feelsLikeDifferenceC:(hi-T)*5/9,category:cat,advice:adv};",
    "inputs": [
      {
        "name": "temperature",
        "type": "number",
        "default": 95,
        "min": 40,
        "max": 110,
        "step": 0.1,
        "slider": true,
        "unitField": "unit",
        "minByUnit": {
          "f": 40,
          "c": 4.444444444444443
        },
        "maxByUnit": {
          "f": 110,
          "c": 43.333333333333336
        },
        "unitTransforms": {
          "f": {
            "scale": 1,
            "offset": 0
          },
          "c": {
            "scale": 1.8,
            "offset": 32
          }
        }
      },
      {
        "name": "humidity",
        "type": "number",
        "default": 55,
        "min": 0,
        "max": 100,
        "step": 1,
        "slider": true
      },
      {
        "name": "unit",
        "type": "select",
        "default": "f",
        "options": [
          {
            "value": "f"
          },
          {
            "value": "c"
          }
        ]
      }
    ],
    "outputs": [
      {
        "name": "heatIndexF",
        "precision": 1,
        "unit": "°F"
      },
      {
        "name": "heatIndexC",
        "precision": 1,
        "unit": "°C"
      },
      {
        "name": "feelsLikeDifference",
        "precision": 1,
        "unit": "°F"
      },
      {
        "name": "feelsLikeDifferenceC",
        "precision": 1,
        "unit": "°C"
      },
      {
        "name": "category",
        "precision": 0,
        "unit": "",
        "type": "text"
      },
      {
        "name": "advice",
        "precision": 0,
        "unit": "",
        "type": "text"
      }
    ],
    "interpret": null
  }
}
