station_for_density_altitude

Function station_for_density_altitude 

Source
pub fn station_for_density_altitude(
    density_altitude_m: f64,
    explicit_temperature_c: Option<f64>,
) -> Result<(f64, f64, f64), AtmosphereError>
Expand description

The station a density altitude gives (resolve_atmosphere_for_density_altitude, bit for bit), or the refusal of a density altitude no air has: the one rule every surface that takes a density altitude applies. A density altitude flies when it is finite and the station the FAA rule’s inverse gives for it can exist; nothing narrower. The station is checked as any other is afterwards (its humidity, and air that cannot exist), by StationAir::new.

use ballistics_engine::atmosphere::station_for_density_altitude;

assert!(station_for_density_altitude(-10_000.0, None).is_ok()); // far below sea level
assert!(station_for_density_altitude(40_000.0, None).is_ok()); // far above the troposphere
assert!(station_for_density_altitude(50_000.0, None).is_err()); // below 0 K by the rule
assert!(station_for_density_altitude(50_000.0, Some(40.0)).is_ok()); // hot air that thin

§Errors