Expand description
Weather from Open-Meteo: a launch site’s forecast (or a past day’s archived forecast) on
pressure levels, turned into a SoundingProfile.
Open-Meteo serves numerical weather models’ output as JSON. Two of its APIs carry winds on pressure levels, which a rocket needs above the surface:
- the forecast API (
api.open-meteo.com/v1/forecast), about 16 days ahead and 3 months back; - the historical-forecast API (
historical-forecast-api.open-meteo.com/v1/forecast), the same forecasts archived, for a past launch. (Its ERA5 archive API has no pressure levels.)
An OpenMeteoRequest asks for the two whole hours around the launch time, in UTC, with
these hourly variables:
| variable | unit asked for | where |
|---|---|---|
temperature_2m, relative_humidity_2m | °C, % | 2 m above the ground |
surface_pressure | hPa | the ground |
wind_speed_10m, wind_direction_10m | m/s, ° from | 10 m above the ground |
temperature_<p>hPa, relative_humidity_<p>hPa | °C, % | each of PRESSURE_LEVELS_HPA |
wind_speed_<p>hPa, wind_direction_<p>hPa | m/s, ° from | each level |
geopotential_height_<p>hPa | geopotential m | each level |
OpenMeteoProfile::parse reads the answer, refusing any unit but those, and interpolates
linearly in time between the two hours (the wind by its east and north components). It keeps:
- The surface at the response’s
elevation: the surface pressure there, with the 2 m temperature and humidity and the 10 m wind. Placing the 10 m wind at the ground makes it the wind on the launch rail, as Loft lesson L6 asks, rather than a step at the lowest pressure level. - Each pressure level above the ground. The models report every level, including those
below the ground at a high site, where the values are extrapolated. A level is dropped when
its pressure is not below the surface pressure or its height is not above the elevation.
A level with no data at either hour is dropped too, and so is one whose relative humidity is
outside 0 to 100%.
OpenMeteoProfile::droppedlists each, with its reason.
Heights are read as geopotential meters, as the weather models define them, and converted to
geometric heights at the response’s latitude with WMO-No. 8 eq. 12.16
(hpr_atmos::profile::geometric_from_wmo_geopotential_m), as the atmosphere page
explains. Open-Meteo’s documentation calls the variable an altitude above sea level; the
recorded answers’ layer thicknesses bear out geopotential meters (the hypsometric check in
tests/open_meteo.rs). Directions are the meteorological convention, the direction the wind
blows from, clockwise from north. Relative humidity is taken as over liquid water, which is
what SoundingLevel means by it. A model that reports it over ice at cold levels shifts the
air’s density there by 0.378 (e_w − e_i)/p: at most 27 Pa of vapour pressure (near −12 °C),
so under 0.03% at 400 hPa. Higher up the air is colder and the gap smaller: about 6 Pa at
−40 °C, 0.08% even at 30 hPa.
fetch asks a Client for the URL, so the answer comes from the cache when it can, and
offline from the cache only; an answer that doesn’t parse is never cached. The data is licensed
CC BY 4.0: show ATTRIBUTION (it is on every Fetched) wherever the weather is shown.
How far to trust it: the profile gives back every level it keeps as recorded (the tests); how good the forecast is depends on the weather model, and nothing here measures that. The guide page says more.
use hpr_atmos::WindInterpolation;
use hpr_net::open_meteo::OpenMeteoProfile;
// A response recorded from the historical-forecast API: Spaceport America, 2025-06-21,
// 15:00 and 16:00 UTC. Ask for 15:30.
let body = include_bytes!("../tests/fixtures/replay/open-meteo-historical.json");
let profile = OpenMeteoProfile::parse(body, 1_750_519_800)?;
assert_eq!(profile.dropped.len(), 5); // 1000 to 900 hPa lie below the 1,400 m ground.
let air = profile.sounding(WindInterpolation::SpeedDirection)?;
let at_5_km = air.sample(5_000.0)?.air;
assert!((at_5_km.pressure_pa - 55_000.0).abs() < 1_000.0);Structs§
- Dropped
Level - A pressure level left out of the profile, and why.
- Open
Meteo Level - One pressure level above the ground, at the launch time.
- Open
Meteo Profile - An Open-Meteo response read at one time: the surface and the pressure levels above it.
- Open
Meteo Request - What to ask Open-Meteo for: a place, a time and an API.
- Open
Meteo Surface - The ground under the forecast, at the launch time.
Enums§
- Drop
Reason - Why a pressure level was left out of the profile.
- Open
Meteo Api - Which Open-Meteo API to ask.
- Open
Meteo Error - Why an Open-Meteo request or response was refused.
Constants§
- ATTRIBUTION
- The credit Open-Meteo’s license (CC BY 4.0) asks for, shown wherever its data is shown.
- PRESSURE_
LEVELS_ HPA - The pressure levels asked for, hPa: all 19 that Open-Meteo’s forecast APIs serve.
Functions§
- fetch
- Fetches
requestthroughclientand reads it at the request’s time.