Fortran: an Obscure Programming Language Still Used in Weather Forecasting

Meteum Team
Meteum
Published in
5 min readAug 2, 2022

At a glance, modern weather forecasting almost seems magical, or at least wildly futuristic. And in many aspects, it really is: meteorologists are often the first to apply state-of-the-art advancements in AI and machine learning. However, once you take a look under the hood, you’ll find some odd antiques. See, the general mantra for weather forecasting is “if it ain’t broke, don’t fix it.”

That’s why virtually all the big weather models, including the ones we use at Meteum to deliver incredibly accurate forecasts and nowcasts, are mostly written in…wait for it…Fortran. Yes, really — you could say the entire weather forecasting field runs on a programming language almost as ancient as computer programming at large.

A Quick Historical Note

A Fortran punch card. Photograph by Arnold Reinhold

IBM’s Fortran made its first debut in 1957 — a whopping 65 years back! — and was one of the first general-purpose, high-level languages that made programming human-legible and accessible to anyone with its neat, English-like syntax. Making the language easy to comprehend was the primary goal, as Fortran targeted mathematicians and physicists with no computer-related background who needed a quick way to input formulas and algorithms into the bulky machines. Hence the name: Formula Translator. During that time, the only way to feed a formula to a computer was via punch cards, but that has since changed. Here’s a modern Fortran program that outputs “Hello, World!”:

program helloworld

write(*,*) ‘Hello, World!’

end

Don’t even get us started on how this simple program would look in a low-level language like assembly. Just take our word: it’s not pretty nor understandable unless you’re a literal robot. As such, Fortran was one of the pioneers that revolutionized programming, and you can see its influence in virtually any popular language of today. We specify popular because assembly is still a thing among engineers trying to get the most out of every individual component of their machines. And, of course, there are always esoteric languages like this one:

++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.> — -.+++++++..+++.>>.<-.<.+++. — — — . — — — — .>>+.>++.

Can you guess the language?

But we digress — let’s move on to what allowed the star of today’s show, Fortran, to outlive many of its creators.

Fortran in the 21st Century

We won’t be lying if we say that math is a complicated science. To solve most problems, scientists and engineers tend to shortcut their way by using pre-existing algorithms, and that’s where Fortran truly shines. This language is outstandingly well-documented, thanks to its decades-long lifespan and generational support. Ready-made solutions for pretty much any mathematical problem in calculus, linear algebra, trigonometry, geometry, and physics are all openly available. Unwieldy mathematical models tend to use Fortran: it would be quite a challenge to find a supercomputer not equipped with a Fortran compiler.

While its age may instill bewilderment, it would be unfair to call Fortran obsolete because it’s still actively maintained and compilers are updated to support the new versions. Perhaps most famously, Fortran has been gradually expanded since 1991 to include many elements of object-oriented programming, making it totally usable for any task you could feasibly achieve with a modern language like Python (although you probably shouldn’t). Obviously, user-friendly IDEs are also available — so no punch cards. The latest Fortran release dates to 2018, and continuous support from the scientific community ensures that this language isn’t going anywhere any time soon.

Weather Forecasting and Fortran

It’s common knowledge that weather forecasting is an ancient science driven by physics and math that’s always had to do with sophisticated calculations: it’s no wonder that as soon as meteorologists could use computers for processing weather data, they got right onto it. Conveniently, Fortran happened to be one of the first accessible programming languages. Over decades, primitive weather models written in Fortran have grown to be incomprehensibly complex and are constantly updated to this day — simply put, rewriting them in another programming language would be a colossal waste of time. Why bother if it works like a charm?

Take WRF, an open-source weather model we use in our own forecasts. You can go to WRF’s GitHub repository and download the entire thing to your Linux machine right now, but be warned: this model’s out-of-the-box experience is not exactly a walk in the park. After scouring the manuals, you’ll discover that the WRF build relies on Perl and several UNIX utilities. A C compiler is needed to compile programs and libraries in the tools and external directories. The WRF source code, however, is primarily standard 90s-era Fortran with a few minor additions.

Even if you manage to run the model on your computer, you might find yourself dumbstruck with how inaccurate the WRF’s predictions may turn out. That’s because reliably predicting the behavior of something as frantic as the Earth’s atmosphere warrants an intricate preliminary setup for the model. This model is all about predicting the physical and dynamical aspects of everything that goes on in the atmosphere, solidifying Fortran — a language that’s very much intended for this sort of task — as a logical choice.

A section of the WRF model’s computational grid demonstrating temperature (color-coded) and wind movement (via black arrows)

As we’ve established, many generations of scientists have left their mark in polishing the logic behind Fortran to near-perfection. It’s a remarkably reliable programming language that is very much alive despite its old age. Some might see it as a relic, but Fortran’s legacy is undeniable and continues to impact our lives — a large part of the neat forecast you see on your phone screen is calculated with this ancient language! And while weather forecasting technology continues to advance with up-to-the-minute developments, Fortran is driving the very base of it all.

Meteum is unlike any weather forecasting platform you’ve seen before: on top of existing weather models and data from weather stations and balloons, we use satellite imagery and user reports to produce the most accurate forecasts and hyperlocal nowcasts on the market. Check out our enterprise solutions and grab your free API key at meteum.ai/b2b to get a glimpse at the next generation of weather forecasting.

--

--

Meteum Team
Meteum
Writer for

Consumer and business-oriented weather forecasting based on machine learning and crowdsourcing