pub fn resolve_station_pressure(
pressure_hpa: f64,
altitude_m: f64,
) -> Option<f64>Expand description
Resolve the station-pressure override for an air-density calculation.
Altitude and pressure are redundant inputs for density. The rule:
- An explicitly-supplied pressure is the authoritative STATION pressure (already
altitude-reduced); it is returned as
Someand used directly, so altitude is NOT double-counted. - When pressure is left at the sea-level standard default (≈1013.25 hPa) while a real
altitude is given, the caller meant “standard atmosphere at this altitude”: return
Nonesocalculate_atmospherederives the station pressure from altitude (ICAO standard) instead of silently using sea-level density.
Without this, --altitude with the default pressure produced sea-level density (altitude
had no effect on drag). The ±0.5 hPa tolerance covers the 29.92 inHg ≈ 1013.21 hPa
conversion, and >1 m avoids triggering at sea level. (Mirrors the existing
pressure != 29.92 “user override” sentinel used elsewhere in the CLI.)