winds-engine v0.9.2

Deterministic wind fields for trajectory simulation — profiles, forecast and terrain — in Rust.

# Cargo.toml
winds-engine = "0.9"

What it does

Built on ballistics-engine's wind-field core (re-exported) and nalgebra; the only optional extras are grib and download. No network, no wall clock, no unseeded randomness.

Conventions

Heights

Sounding heights are metres above sea level, and to_profile_field() keeps them there, so the profile reads directly in a frame whose y is altitude above sea level, like rockets-engine's. The layers in validate use the same sea-level heights.

LogProfile and EkmanProfile take y as height above the ground, where they are calm. In a sea-level frame, wrap them in HeightOffset with offset −ground elevation — convert in one place only: shifting the sounding too would move every wind by the site elevation.

Example

use nalgebra::Vector3;
use winds_engine::{validate, HeightOffset, LogProfile, ProfileField, ProfileLevel, Sounding, WindField};

fn main() -> Result<(), Box<dyn std::error::Error>> {
    // altitude_m speed_mps direction_from_deg; heights above sea level
    let sounding = Sounding::parse("287 0.0 0\n305 3.09 125\n610 3.60 145\n")?;

    // The profile keeps those heights: read it at y = altitude above sea level.
    let measured = sounding.to_profile_field()?;
    let wind = measured.wind(0.0, Vector3::new(0.0, 500.0, 0.0));
    println!("{:.2} m/s", wind.x.hypot(wind.z));

    // Score a candidate profile, on the same sea-level heights, against it.
    let candidate = ProfileField::new(vec![
        ProfileLevel { altitude_m: 287.0, speed_mps: 0.0, direction_from_deg: 0.0 },
        ProfileLevel { altitude_m: 610.0, speed_mps: 4.0, direction_from_deg: 140.0 },
    ])?;
    let report = validate::validate(&candidate, &sounding);
    println!("speed RMSE {:.2} m/s", report.speed_rmse_mps);

    // A log law measures height from the ground: HeightOffset reads it in the
    // sea-level frame (offset = minus the ground elevation), converting once.
    let log = HeightOffset::new(LogProfile::new(8.0, 10.0, 0.03, 270.0)?, -287.0)?;
    let low = log.wind(0.0, Vector3::new(0.0, 500.0, 0.0));
    println!("{:.2} m/s", low.x.hypot(low.z));
    Ok(())
}

Needs Rust 1.89 or newer. The README walks through the same sounding.

Where it fits

Status

Version 0.6.0, published on crates.io; API docs at docs.rs/winds-engine. It is a library only, with no CLI and no browser terminal.

Planned, not built: more sounding validation days (one KMPX profile is checked in), and a full 3-D terrain mesh — the diagnostic 2-D-per-level adjustment above is the cheap first tier.

Get it