In our trajectory computation, we set our wind values to zero for each sector, but left room in the functionality to include wind as an input. In our project specs we mentioned that we want to use the 'Real World Weather' option in X-Plane. In order to match the flight plan to the X-Plane environment, we have three options:
parse out weather data that X-Plane is using
create my own METAR and upperwinds weather files in X-Plane 11 format, and load them into the simulator (X-Plane allows this)
get weather from an outside party and see if it matches
I decided to try option 3, because I think it will require the least amount of work. We aren't looking for perfection; we just want a decent match between the forecast weather and what we see in the simulator. I should tell you, however, that X-Plane 11 documentation warns against doing this:
External sources should never be used for obtaining weather conditions in the simulator, even when flying in 'Real Weather' mode. They are highly unlikely to match due to the random elements to X-Plane's weather simulation, different data sources, and differences in the way that the various data-sources are processed.
To produce X-Plane's weather in 'Real Weather' mode, these are blended with another datasource which is based on a forecast of regional weather in the near future. This blending of point samples from the past with a generalised regional forecast for the future, plus the small amount of randomness layered onto the results, means that the simulator's weather should be similar to actual conditions but will rarely if ever be an exact match with any other source of weather information.
But we are going to try it anyway because I want to see what happens.
Globally, there are several institutions which run sophisticated weather forecasting systems. Examples include the NOAA and the UK Met Office. These institutions generate tons of detailed weather data. The access methods to this data, as well as the structure and format of it, can be very complex. To make life easier, 3rd party services exist which offer simplified interfaces to the weather data.
After doing some shopping, I found a service provider called Open-Meteo which offers what I am looking for. From their website:
Open-Meteo is an open-source weather API and offers free access for non-commercial use. No API key required. Open-Meteo partners with national weather services to bring you open data with high resolution, ranging from 1 to 11 kilometres. Our powerful APIs intelligently select the most suitable weather models for your specific location, ensuring accurate and reliable forecasts.
Per the website:
there's a free tier that offers up to 10,000 calls per day
upper level wind forecasts are available
forecasts are updated hourly
there is an easy-to-use Python library to interface with the service
We are going to code a very simple process as an experiment. If the results look promising we can always come back and make improvements. After installing the open-meteo python library, we take the following steps.
First, calculate the centroid (centre coordinates) of each sector:
Here is the printout:
<class 'list'>[(55.8695796893471, -161.62144230876086), (56.81632341523953, -159.53442537147652), (57.726350956966144, -157.34143063569402), (58.5964690740907, -155.03782992598184), (59.42326550669019, -152.6196192512433), (60.20312302605591, -150.08368051576227), (60.82150629055127, -147.87420144773708)]Next, prepare the call to the API. Note in the call we are requesting data for 7 points, i.e. the centroid of each sector:
Here is how the response looks:
There are 7 responses to process, one for each sector. We will process them one by one. The reasoning behind each step in the process is explained in the code comments.
Here is the weather dataframe for sector 0; we've highlighted the first row, which corresponds to the forecast wind valid about 30 minutes from the time of the request:
And here is the summarized result for all sectors:
current UTC time: 2026-01-03 13:27:38.629997+00:00This list is in the format the the trajectory compute is expecting, so it can be used as-is without further modification.
Note that in the API call, we did not request the winds at 30,000 ft MSL; the altitude was approximated by asking for the weather forecast at 300 hPa. If you squint closely at the following diagram of the International Standard Atmosphere, you will see that 300 hPa corresponds to a standard altitude of about 30,000 ft MSL (about 10km). This figure is close enough for our weather experiment.
It would definitely be possible to use the entire planned flight path (lat, lon, alt) in our call to the weather API, instead of just requesting data for the sector centroid coordinates; however, as with Remark 1, I just wanted to keep it simple to get started.