"use strict"; function round2(x) { return Math.round(x * 100) / 100; } const STANDARD_SEA_LEVEL_HPA = 1013.25; const ISA_EXPONENT = 0.190284; const ISA_FEET_CONSTANT = 145366.45; function pressureAltitudeFt(stationPressureHpa) { return (1 - Math.pow(stationPressureHpa / STANDARD_SEA_LEVEL_HPA, ISA_EXPONENT)) * ISA_FEET_CONSTANT; } module.exports = { slug: "pressure-altitude-standard-atmosphere", title: "Pressure altitude from station pressure (ISA)", deck_category: "other", description: "Converts a station barometric pressure to pressure altitude using the ICAO/NOAA International Standard Atmosphere barometric formula.", inputs: [ { name: "station_pressure_hpa", type: "number", unit: "hPa (millibars)", required: true, description: "Station (unadjusted) barometric pressure.", min: 300, max: 1100 } ], outputs: [ { name: "pressure_altitude_ft", unit: "feet", description: "Pressure altitude." } ], steps: [ "ISA barometric formula: PA = (1 - (P / 1013.25)^0.190284) * 145366.45, where P is station pressure in hPa and PA is pressure altitude in feet, and 1013.25 hPa is the ICAO standard sea-level pressure.", "Round to 2 decimals.", "This assumes the ICAO Standard Atmosphere's fixed temperature lapse rate; actual pressure altitude readouts from an altimeter use this same formula." ], constants: [ { name: "standard_sea_level_pressure_hpa", value: 1013.25, unit: "hPa", source: 0 }, { name: "isa_exponent", value: 0.190284, unit: "dimensionless", source: 0 }, { name: "isa_feet_constant", value: 145366.45, unit: "feet", source: 0 } ], sources: [ { kind: "standard", value: "ICAO Doc 7488, Manual of the ICAO Standard Atmosphere.", title: "ICAO Standard Atmosphere barometric formula for pressure altitude", publisher: "International Civil Aviation Organization (ICAO); formula also published by NOAA/FAA", retrieved_utc: "2026-09-30T19:55:00Z", note: "Standard pressure-altitude formula used in aviation and meteorology." } ], disclaimer: null, questionText(inputs) { return `Using the ICAO Standard Atmosphere formula, what is the pressure altitude at a station pressure of ${inputs.station_pressure_hpa} hPa?`; }, run(inputs) { const p = inputs && inputs.station_pressure_hpa; if (typeof p !== "number" || p < 300 || p > 1100) throw new Error("station_pressure_hpa must be a number between 300 and 1100"); const pa = round2(pressureAltitudeFt(p)); return { answer: `${pa.toFixed(2)} ft`, values: { pressure_altitude_ft: pa } }; }, examples: [ { name: "worked example", inputs: { station_pressure_hpa: 1013.25 }, expected: { answer: "0.00 ft" }, check: "At exactly the ICAO standard sea-level pressure, the ratio P/1013.25 is 1, 1^0.190284=1, so (1-1)*145366.45=0 by direct arithmetic; pressure altitude at standard sea-level pressure is 0 feet by definition." }, { name: "test vector: lower pressure", inputs: { station_pressure_hpa: 950 }, expected: { answer: "1772.03 ft" }, check: "By hand: ratio=950/1013.25=0.937561; ln(0.937561)=-0.064476; *0.190284=-0.012268; e^-0.012268=0.98781; 1-0.98781=0.01219; *145366.45=1772.0. Cross-checked against the common aviation rule of thumb of about 27 to 30 feet per hPa below standard, (1013.25-950)*27=1708, which is the right order of magnitude." } ] };