parse_wind_scenario_set

Function parse_wind_scenario_set 

Source
pub fn parse_wind_scenario_set(
    text: &str,
    units: UnitSystem,
) -> Result<WindScenarioSetV1, WindScenarioError>
Expand description

Decode a wind scenario set from JSON TEXT (MBA-1349).

Text, not a path: this module stays fs-free so it compiles for wasm32, exactly like crate::drag_file and crate::truing_dsf. File reading belongs to the front end.

Segments are written as the SAME SPEED:ANGLE:UNTIL[:VERTICAL] tokens --wind-segment takes, so there is one wind grammar to learn and one parser to trust:

{"version": 1, "nominal": "low",
 "scenarios": [
   {"name": "low",  "segments": ["5:90:400", "3:90:800"]},
   {"name": "high", "segments": ["12:90:400", "9:270:800"]}]}

units selects how SPEED and UNTIL are read (mph/yards imperial, m/s and meters metric), matching --wind-segment exactly.