Author: Paul McCarty

The Weather Report

X-Plane can be configured to model real-world weather conditions. It does this by downloading weather report data from a server, operated by Laminar Research. That server, in turn, periodically fetches three total files from two different sources at NOAA: one for METAR-format weather condition data, and another source for two grib2-format files describing, separately, winds and turbulence. Internally, we tend to refer to this system, overall, as Live Weather, or, in the context of anything server-related, just Weather.

Around March 22nd, it broke down.

What went wrong

As is often the case: several things.

X-Plane began reporting that it couldn’t fetch all the data it needed for real-world weather. This was a little surprising since our weather server is supposed to cache the latest data it received, even if it’s outdated, to smooth over any connectivity or availability issues with NOAA’s servers. Further investigation revealed that only one of the three files it needed was both missing from its local cache, and unavailable from NOAA.

The root cause of that data being absent from cache hasn’t been tracked down, for the reason that that part of the system has been replaced (see below). There may be a bug in the caching logic. The server may have suffered a silent crash-and-restart some time after NOAA stopped serving the file. We’re not sure.

Investigation into the causes of the missing data was sidetracked for a little while because, right around the same time, NOAA happened to suffer a widely-reported, significant disruption to their networks and server operations. Naturally, we initially assumed this was the cause of the problem, and our efforts were mainly aimed at mitigating the harm of a temporary outage, not dealing with a longer-term problem.

In fact, what had happened was a longer-term problem, and the outage was, at most, only part of the cause of the disruption we were seeing.

In which we miss a NOAA systems upgrade

Effective on or about March 22, 2021, beginning with the 1200 Coordinated Universal Time (UTC) run, the National Centers for Environmental Prediction (NCEP) will upgrade the GFS and Global Data Assimilation System (GDAS) from version 15.3 to 16.0.

NOAA Service Change Notice 21-20 (Updated)

What that means is that X-Plane’s Live Weather system was about to break.

The system mentioned in that notice is the one that provides turbulence and wind data for the Live Weather system. These are the grib2-formatted files mentioned above.

Some time into this minor crisis, we noticed that both, not just one, of those files were missing—one had been properly cached, as intended, so it’d initially escaped our notice—and that the directory structure and file naming conventions on the NOAA server from which we source them had changed. Then we found the PDF containing the notice quoted above. Nestled deep in that PDF was the line:

Remove WAFS blended product at 1.25 deg

This refers to the file we used for turbulence data. The wind data we’d been using we could still find, albeit in a new location, but here was confirmation that the turbulence data we’d been using was simply gone.

In which various solutions fail

Our situation at this point was: we had found our wind-data grib2 file, and we had several WAFS (World Area Forecast System) files that looked, judging solely from their names, like they might contain the turbulence data we needed.

None of this was true.

We learned that the NOAA system upgrade had included an upgrade to the compression used on their grib2 files. X-Plane couldn’t understand it, and in internal testing actually crashed when attempting to use these files. That meant that though we had found a file containing the same data we needed for wind, we couldn’t actually use it.

Also, none of the other WAFS-related files contained the same turbulence data we’d been using, nor anything readily translatable to same.

So much for the easy solutions.

Fortran: friend or foe?

NOAA provides a program called cnvgrib to convert grib files to other sorts of grib files—for instance, as one might guess from references above to grib2, there is a grib1 that predated it, and cnvgrb can turn one into the other. It can also, most usefully to our situation, change the compression scheme used by grib2 files, so it should let us turn these new grib2 files into something we can use without having to modify X-Plane itself. Missing turbulence data aside, at least we could convert the wind data grib2 files to be usable.

Fortran is a… let’s say venerable programming language, like, for instance, COBOL. It’s a bit obscure these days, outside certain very long-lived systems and niche applications.

Cnvgrib is written in Fortran, and no recent compiled binary version is available. The Fortran (with some support from C) source code is provided by NOAA, though, along with instructions for compilation.

One Linux VM, a couple hours, and 17GB(?!) of Intel compilers and tools later, and we have a compiled copy of cnvgrib. As hoped, it can turn the new-compression grib2 files into old-compression grib2 files that X-Plane can understand.

There’s still the matter of the turbulence data, though.

Enter the Matrix

I skipped ahead a little. At this point in the troubleshooting process we hadn’t yet noticed that the turbulence data from NOAA wasn’t the same as what we’d been getting before, and once we could convert it to grib2 files that X-Plane could handle, it even looked like it was working.

So we deployed it.

By “it” I mean a very low-tech shell script that periodically downloads the two files we need from NOAA and uses cnvgrib to make them usable by X-Plane.

90s legible-clothing Geek Chic slogans at their finest. Also, I did actually do this to about 2/3 of the existing weather server.

Though this apparently worked, we quickly realized something was very wrong when support began fielding reports of way-too-powerful wind in X-Plane, when using the real-world weather feature. This was caused by X-Plane applying inappropriate turbulence modifiers to wind effects, because we were feeding it (from its perspective) bad data.

Having no new source of the turbulence data we had been using, and with the new data causing serious issues, what could we do without cutting a new release of X-Plane?

As it happens, we’d snagged exactly one of the old WAFS-Blended files, containing the kind of turbulence data X-Plane could use, from the NOAA servers, before they dropped off forever.

Yeah. It is.

The clear stop-gap solution, then, was to simply serve the working, reasonable turbulence-data file that we’d saved. All the time. Even though it’s increasingly outdated and definitely not “Real-World” anymore.

That’s right: so far as turbulence data goes, if you’re playing X-Plane with real-world weather turned on, you’re trapped in an old facsimile of the real world. You’re in The Matrix.

Fortunately, the effect of turbulence is minor enough, overall, that this doesn’t throw things off too badly (most of the time) and having some outdated real-world data is better than having none. Still, if you notice things behaving just slightly strangely—or if you have a sense of deja vu with real-world weather turbulence while flying—that may be why. The Matrix has you.

Are we going to keep lying to X-Plane about turbulence forever, then?

Nope! We’re working on translating other forms of turbulence data into something usable by existing copies of X-Plane, and have plans to make future versions of the Live Weather system more robust so that, hopefully, it won’t fail again—at least not in the same way.

Posted in News by | 20 Comments