avwx aviation weather parser

Posted on September 20, 2016

What is avwx?

avwx is a small library that can parse aviation weather reports. Currently, METARs and TAFs are supported.

METARs

A METAR message is an obervation report, these days usually performed automatically and checked for plausibility by an aviation meteorologist. I’ve once witnessed this in EDFE tower (which is not really a tower in a legal sense) on a sunny day: The computer was beeping, the person working EDFE info was glancing at the monitor for a few seconds and pressed ENTER. The new METAR was now published and legally binding.

What does legally binding mean? At the time i visited the tower, you were allowed to land at Egelsbach when the cloud base was at or above 1000 feet AGL. Thus, if the METAR message said the cloud base was at 900FT AGL, you were not allowed to land. Another example, if your aeroplane is certified for a maximum crosswind of 22KT, and EDFE says the crosswind is 23KT, you are still permitted to land, but no insurer will pay for any accident you may have while the crosswind is 1KT above the maximum :-)

In any case: IANAL (I am not a lawyer).

The main documentation I’m using on METARs is the one from DWD.

To give an example, the weather in Frankfurt at the time I’m writing this is:

METAR EDDF 201720Z 03007KT 9999 FEW038 SCT060 BKN080 18/10 Q1018 NOSIG=

This message contains, among other things, the wind:

Wind { _winddirection = Degrees 30 , _velocity = Knots 7 , _gusts = Nothing }

Meaning the wind is blowing from a northeasterly direction with a speed of seven knots, no gusts. (Gusts are only considered if they exceed 10 kn)

We have got a few clouds:

[ ObservedCloud FEW (Height 3800) Unclassified , ObservedCloud SCT (Height 6000) Unclassified , ObservedCloud BKN (Height 8000) Unclassified ]

The temperature:

_temperature = Just 18

Terminal Aerodrome Forecasts

A TAF or Terminal Aerodrome Forecast is a forecast message with a well defined validity period. Usually for small ADs you have 9 hours of validity, whereas international airports use validity periods of 24 or 36 hours.

Subtle differences

Unfortunately, while aviation weather report messages are well parseable, they were designed to be primarily read by humans. Subtle differences exist between messages from various countries or even weather stations. Thus, it is not a simple task to write a parser that is correct in all cases. Bug reports are therefore very welcome.

Where to get it

You can find the source code on hackage, stackage and on github.