reduce_qnh_to_station_pressure

Function reduce_qnh_to_station_pressure 

Source
pub fn reduce_qnh_to_station_pressure(qnh_hpa: f64, altitude_m: f64) -> f64
Expand description

Reduce a sea-level-corrected altimeter setting (QNH) to the station pressure at altitude_m (MBA-1397), using the inverse of the ICAO troposphere barometric formula:

station = QNH * (1 + L*h/T0)^(-g/(L*R))

which, for the troposphere’s published lapse rate L and sea-level temperature T0, is exactly the standard ICAO Doc 7488 / NOAA altimeter-setting reduction station = QNH * (1 - 0.0065*h/288.15)^5.25588, where h is GEOPOTENTIAL height, not the geometric altitude the caller supplies — this function converts the one to the other first (geometric_to_geopotential_height_m), as ISA requires. Substituting geometric altitude directly into that expression reproduces the reduction only to about 0.04 hPa at 1500 m, which is why the worked values below are not what the bare formula gives.

Reuses the SAME troposphere layer (ICAO_LAYERS[0]) and physical constants (G_ACCEL_MPS2, R_AIR) that calculate_icao_standard_atmosphere (private to this crate) uses for its own non-isothermal-layer pressure formula, rather than re-hardcoding the lapse rate / sea-level temperature / exponent a second time — this is that same formula, solved for a caller-given sea-level pressure instead of the fixed 1013.25 hPa standard. altitude_m is clamped and converted to geopotential height exactly like calculate_icao_standard_atmosphere, so a QNH of exactly 1013.25 hPa reduces to precisely the ICAO standard station pressure at every altitude (this is what makes the omitted-pressure default byte-identical under either PressureReferenceMode).

The reduction is only physically meaningful within the troposphere (the altitude range real shooting takes place in); it is not re-derived per-layer for higher altitudes.