{
  "schemaVersion": 1,
  "slug": "dew-point-calculator",
  "category": "weather",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "d0bc1a11918b06291c173541a0444e3c3228bfd52ea2e16dbff659b8ed516880",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/dew-point-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": "e = 6.112 × exp(17.62T ÷ (243.12 + T)) × RH ÷ 100; T_d = 243.12 ln(e ÷ 6.112) ÷ (17.62 − ln(e ÷ 6.112)); T_f = 272.62 ln(e ÷ 6.112) ÷ (22.46 − ln(e ÷ 6.112))",
    "vars": [
      [
        "T",
        "Air temperature (°C)"
      ],
      [
        "RH",
        "Relative humidity (%)"
      ],
      [
        "α",
        "Magnus term"
      ],
      [
        "T_d",
        "Dew point (°C)"
      ],
      [
        "e",
        "Vapor pressure (hPa)"
      ],
      [
        "AH",
        "Absolute humidity (g/m³)"
      ]
    ],
    "note": "T is in °C; Fahrenheit input is converted first. T_d is dew point over water and T_f is frost point over ice. Absolute humidity = 216.7e ÷ (T + 273.15) g/m³. Near-surface estimate; pressure enhancement is omitted. Formula approximation shown for −45 to 60 °C."
  },
  "externalEvidence": null,
  "contract": {
    "compute": "const T=unit==='f'?(Number(temperature)-32)*5/9:Number(temperature),RH=Number(humidity);if(!Number.isFinite(T)||!Number.isFinite(RH)||T< -45||T>60||RH<1||RH>100)return{dewPointC:null,dewPointF:null,frostPointC:null,absoluteHumidity:null,vaporPressure:null,comfort:null,spread:null,__error:'inputError'};const e=6.112*Math.exp(17.62*T/(243.12+T))*RH/100,ln=Math.log(e/6.112),dp=243.12*ln/(17.62-ln),fp=272.62*ln/(22.46-ln),ah=216.7*e/(T+273.15);return{dewPointC:dp,dewPointF:dp*9/5+32,frostPointC:fp,absoluteHumidity:ah,vaporPressure:e,comfort:dp<10?'Dry and comfortable':dp<16?'Pleasant':dp<20?'Slightly humid':dp<24?'Muggy':'Oppressive',spread:T-dp};",
    "inputs": [
      {
        "name": "temperature",
        "type": "number",
        "default": 22,
        "min": -49,
        "max": 140,
        "step": 0.1,
        "slider": true
      },
      {
        "name": "humidity",
        "type": "number",
        "default": 60,
        "min": 1,
        "max": 100,
        "step": 1,
        "slider": true
      },
      {
        "name": "unit",
        "type": "select",
        "default": "c",
        "options": [
          {
            "value": "c"
          },
          {
            "value": "f"
          }
        ]
      }
    ],
    "outputs": [
      {
        "name": "dewPointC",
        "precision": 1,
        "unit": "°C"
      },
      {
        "name": "dewPointF",
        "precision": 1,
        "unit": "°F"
      },
      {
        "name": "frostPointC",
        "precision": 1,
        "unit": "°C"
      },
      {
        "name": "absoluteHumidity",
        "precision": 2,
        "unit": "g/m³"
      },
      {
        "name": "vaporPressure",
        "precision": 2,
        "unit": "hPa"
      },
      {
        "name": "comfort",
        "precision": 0,
        "unit": "",
        "type": "text"
      },
      {
        "name": "spread",
        "precision": 1,
        "unit": "°C"
      }
    ],
    "interpret": null
  }
}
