Ruby
The reference implementation — a comprehensive Ruby gem with object-oriented API, lazy computation, and full ISO coverage. Requires Ruby 3.0+.
Installation
gem install atmospherisOr add to your Gemfile: gem "atmospheris". Requires Ruby 3.0+.
Quick Start
require "atmospheris"
# Calculate all properties at a given altitude
attrs = Atmospheris::Export::AltitudeAttrs.new
attrs.set_geopotential_altitude(10_000, :meters)
attrs.realize_values!
# Access individual properties
attrs.temperature_kelvin # => 223.252 K
attrs.temperature_celsius # => -49.898 °C
attrs.pressure_pascal # => 26436.0 Pa
attrs.pressure_mbar # => 264.36 mbar
attrs.density # => 0.4135 kg/m³
attrs.speed_of_sound # => 299.46 m/sAPI Reference
Atmospheris::Export::AltitudeAttrs
Sets an altitude and computes all ISA properties. Supports geopotential, geometric, and direct altitude input in meters or feet.
attrs = Atmospheris::Export::AltitudeAttrs.new
attrs.set_geopotential_altitude(10_000, :meters)
attrs.realize_values!
attrs.temperature_kelvin # => 223.252
attrs.temperature_celsius # => -49.898
attrs.pressure_pascal # => 26436.0
attrs.pressure_mbar # => 264.36
attrs.density # => 0.4135
attrs.speed_of_sound # => 299.46
attrs.dynamic_viscosity # => 1.458e-5
attrs.kinematic_viscosity # => 3.525e-5
attrs.pressure_scale_height # => 6581.2
attrs.mean_free_path # => 2.372e-7Atmospheris::Export::PressureAttrs
Sets a pressure value and performs reverse lookup to find the corresponding altitude via the hypsometrical equation.
attrs = Atmospheris::Export::PressureAttrs.new
attrs.set_pressure(264.36, :mbar)
attrs.realize_values!
attrs.geopotential_altitude_meters # => ~10000Atmospheris::Isa::Algorithms
Low-level calculation methods for individual ISA formulas. Useful when you need fine-grained control over specific equations rather than computing all properties at once. Methods include: temperature, pressure, density, gravity, dynamic viscosity (Sutherland’s formula), kinematic viscosity, speed of sound, thermal conductivity, mean free path, collision frequency, and air number density.
Atmospheris::Iso5878.compute_wind_derived
Computes derived wind characteristics from observed zonal and meridional wind components using the Rice (circular normal) distribution per ISO 5878 Section 5.4.
# Quick function API
wind = Atmospheris::Iso5878.compute_wind_derived(-3.9, -1.2, 5.9)
wind.vr #=> 4.08 — vector mean wind magnitude
wind.vsc #=> 6.03 — scalar mean wind speed
wind.sigma #=> 4.17 — per-component std deviation
wind.percentiles[1].high #=> ~14.7
wind.percentiles[10] #=> PercentilePair(low, high)
# For zones > 20°N where Vy ≈ 0
wind = Atmospheris::Iso5878.compute_wind_derived(-3.9, 0, 5.9,
use_absolute_vx: true
)WindObservation
Encapsulates a single altitude-level wind observation with empirical parameters and lazily computed derived statistics:
obs = Atmospheris::Iso5878::WindObservation.new(
geopotential_altitude: 1000,
vx: -3.9, vy: -1.2, sigma_r: 5.9
)
obs.vr #=> 4.08
obs.vsc #=> 6.03 (calculated)
obs.percentile_bounds[1].high #=> ~14.7
obs.derived_fields #=> WindDerivedFields structRiceDistribution
Object-oriented wrapper for the Rice distribution with lazy-cached computations:
dist = Atmospheris::Iso5878::RiceDistribution.new(vr: 4.08, sigma_r: 5.9)
dist.mean #=> 6.03
dist.pdf(5.0) #=> probability density at 5 m/s
dist.cdf(10.0) #=> P(wind ≤ 10 m/s)
dist.quantile(0.99) #=> ~14.7
dist.percentile_bounds #=> { 1 => Pair, 10 => Pair, 20 => Pair }