pub fn resolve_station_temperature(
temperature_c: f64,
altitude_m: f64,
) -> Option<f64>Expand description
Resolve the temperature override for an air-density calculation, mirroring
resolve_station_pressure.
- An explicitly-supplied temperature is authoritative (returned as
Some). - When temperature is left at the sea-level standard default (15 °C) while a real altitude
is given, the caller meant “standard atmosphere at this altitude”: return
Nonesocalculate_atmosphereapplies the ICAO lapse-rate temperature for that altitude (≈ −6.5 °C/km).
Without this, --altitude with the default temperature held the air at 15 °C, which
under-estimates density (warm air is thinner) by ~2.4% at 1 km up to ~7% at 3 km versus the
standard atmosphere — validated against py_ballisticcalc, which derives both temperature and
pressure from altitude. The 0.1 °C tolerance matches the 59 °F = 15.0 °C default exactly,
and >1 m avoids triggering at sea level. A shooter at a genuinely non-standard temperature
at altitude should pass an explicit temperature (same contract as station pressure).