nnaumenko / metaf

Modern C++ library for parsing METAR weather report and TAF weather forecast
https://nnaumenko.gitlab.io/metaf/
MIT License
17 stars 8 forks source link
aviation metar meteorology modern-cpp taf weather webassembly

Modern C++ library for parsing METAR and TAF

pipeline status Codacy Badge codecov MIT license Try online

Highlights

Introduction

Metaf is a header-only, dependency-free modern C++ library for parsing METAR weather reports and TAF weather forecasts used in aviation.

Live demo: Short weather summary for aerodromes near your location based on METAR/TAF weather data.

Live demo: Decode METAR or TAF report and explain in English language.

Metaf can do the following:

Compatible compilers

The following compiler are compatible (with C++17 standard enabled):

The compatibility with the compilers above is routinely tested using Gitlab CI after each commit.

Prerequisites and dependencies

Metaf requires C++17.

Metaf library itself is dependency-free and requires only standard C++ library. Boost is not used.

Unit tests included with the project use Google Test framework.

Limitations

Old TAF format, used before November 2008 employs different format for time spans and trends (time without date); the current version does not decode this old format.

License

Metaf is released under MIT license.

Documentation

Please refer to documentation for details.

Tutorial on basic usage of Metaf library.

METAR and TAF

What is METAR?

METAR is current weather report format used in aviation. Typical METAR report contains information such as location, report issue time, wind, visibility, clouds, weather phenomena, temperature, dewpoint and atmospheric pressure.

METAR in raw form is human-readable though it might look cryptic for untrained person.

Example of a simple METAR report is as follows:

METAR EICK 092100Z 23007KT 9999 FEW038 BKN180 11/08 Q1019 NOSIG=

What is TAF?

TAF (Terminal Aerodrome Forecast) is a weather forecast report format used in aviation. TAF report is quite similar to METAR and reports trends and changes in visibility, wind, clouds, weather, etc over periods of time.

TAF in raw form is also human-readable but requires training to decode.

Example of a TAF report is as follows:

TAF EICK 091700Z 0918/1018 27012KT 9999 BKN025 BECMG 0920/0923 24007KT BECMG 1002/1005 21007KT BECMG 1009/1012 21015KT TEMPO 1010/1013 -RA BKN012 TEMPO 1010/1018 21018G28KT BECMG 1013/1016 6000 -RA SCT003 BKN010 TEMPO 1014/1018 3000 -RADZ BKN003 PROB40 TEMPO 1015/1018 1200 BR BKN002=

Which groups Metaf is able to recognize?

Performance

The following statistics were acquired by parsing all METAR and TAF reports collected during year 2020. The parsing was done using single thread and the statistics do not include IO operations' lag.

1973075048 microseconds, 76416000 reports, 38729 reports per second.
1973075048 microseconds, 916172097 groups, 464337 groups per second.

Basically, it took 33 minutes to parse all METARs and TAFs from 2020 using one CPU core on the old laptop with i5 CPU.

Roadmap

Version 6.0.0 is currently planned (no release date set), with a number of new groups to be added (the candidates are runway wind, additional sea surface groups, first/last report, next scheduled report time remarks, variable cloud cover, additional visibility groups etc).

There are also plans to change the handling of CNL keyword because some cancelled reports have additional remarks and some reports use CNL as a part of plain-text remark. Currently Metaf is unable to parse such reports.

After version 6.0.0 is released, the priority is to fix bugs, improve test coverage and documentation, and perform 'under the hood' changes such as optimisation and refactoring.

Acknowledgements

This project uses Emscripten to compile examples into Webassembly.

Unit tests included with the project use Google Test framework.

Gitlab CI/CD is used for deployment of the project website.

METAR, TAF, and weather station data used in weather summary example are from Aviation Weather Center Text Data Server.

Weather widget uses the following external content: Weather Icons by Erik Flowers distributed under SIL OFL 1.1 license, Source Sans Pro Font by Paul D. Hunt distributed under Open Font License, 'eye-regular' and 'icicles-solid' icons by Font Awesome distributed under Creative Commons Attribution 4.0 International license. METAR, TAF, and weather station data are acquired using CORS-anywhere.

The project repository is hosted on Gitlab and mirrored to Github.

Thanks to Ogimet for providing access to historical METAR and TAF data.