metaf2xml Logo metaf2xml: parse and decode METAR, TAF, SYNOP and BUOY and write data as XML
(deutsche Version, versión española)

metaf2xml can download, parse and decode aviation routine weather reports (METAR, SPECI, SAO), aerodrome forecasts (TAF), synoptic observations (SYNOP) and observations from buoys (BUOY). The extracted data can be written as XML or passed to a user-defined function (all done in Perl).

It also provides XSLT style sheets to convert the XML to plain language (text, HTML), or XML with different schemas. A web-based (CGI) user interface can be used to download and display up-to-date weather data from NOAA, Ogimet, and other sources.

Content Screenshots
decoded TAF
TAF SBGL
(HTML, español)
decoded METAR
METAR KJFK
(HTML, english)
decoded METAR
METAR UUEE
(HTML, Русский)

Latest version

The latest version (2014-06-01) is 1.55 (TAR, RPM, ZIP), and includes also README, change log, ToDo, distinfo, and DTD.

Background

METAR and SPECI (weather observation) and TAF (weather forecast) information is essential for flight planning and in-flight decisions (real flight and simulation). It is regularily compiled by meteorologists for more than 6200 airports worldwide and distributed via reliable, non-public networks. SYNOP information is collected by more than 7600 manned and unmanned meteorological stations and more than 2500 mobile stations around the world and is used for weather forecasting and climatic statistics. The format of the original messages is abbreviated, some items are coded.

Here are some METAR, TAF, and SYNOP messages from Rio (SBGL, 83746), New York (KJFK, 74486), and Tokyo (RJTT, 47662) and messages from nearby buoys:

SBGL 172300Z 24007KT 9999 TS FEW015 FEW030CB BKN100 25/21 Q1013
SBGL 172130Z 1800/1906 21010KT 7000 BKN015 TX26/1800Z TN17/1823Z PROB30 TEMPO 1801/1805
 4000 TSRA BKN015 FEW025CB BECMG 1808/1810 4000 BR BKN008 BECMG 1812/1814 19010KT 6000 NSW BKN012 RMK PGZ
KJFK 172351Z 14003KT 10SM CLR 14/05 A3036 RMK AO2 SLP280 T01440050 10189 20144 55002
KJFK 172320Z 1800/1906 VRB04KT P6SM SKC FM181600 18008KT P6SM SKC FM190200 VRB05KT P6SM SKC
RJTT 172330Z 35009KT CAVOK 22/16 Q1020 NOSIG RMK A3013
RJTT 172036Z 1721/1824 04012KT 9999 FEW030 BECMG 1806/1809 07014KT BECMG 1812/1815 03006KT
AAXX 17184 74486 NIL
AAXX 17184 47662 12970 20203 10203 20151 30150 40193 56005 60001 80002
ZZYY 31262 17093 13001 522980 042100 6112/ 11119 02801 10021 48214 444 20120 17093 1159/ 518// 60371
ZZYY 41955 17093 2200/ 739065 071940 6111/ 22219 00238 444 20110 17093 1828/ 50101 80119 80007 9/015
ZZYY 53904 17093 2336/ 135184 142953 6112/ 22219 00285 444 20120 17093 2331/ 50101 80092 80016 9/015

The format of the messages (and a lot more about observing and reporting weather) is specified in WMO Manual No. 306 or in Annex 3 to the Convention on International Civil Aviation; some countries deviate from that standard or extend it, some have published documentation (e.g. Federal Meteorological Handbook No. 1 and No. 2 for the USA). Especially the format of the remarks for METAR and TAF messages, or the coding of sections 3 and 5 for SYNOP messages depend on the country or even the observing station.

metaf2xml can be used for flight simulations or by private pilot (students) who want to extend their knowledge about the message formats, and everyone who just wants to know the current or forecast weather at some station in plain language (see examples below).

Why another METAR/TAF parser?

There are other projects that deal with METAR and TAF messages, e.g.:

But somehow I always missed a feature I liked to have.

Features of metaf2xml

processing of messages

The parser module (man page) accepts (= processes) or tolerates (= marks as error) many extensions to the standard; they are marked with "EXTENSION" in the source code. Many common minor errors in the format are corrected before parsing, more combinations of weather phenomenons are allowed, missing information is recognised in many cases, too.

All remarks are processed, some of them are interpreted depending on the issuing country or station, e.g. 'MON INVIS VAL FOSCHIA' and QUL/QUK (Italy), 'JP' (some carribean countries), 'YLO1' (military), everything from the Federal Meteorological Handbook No. 1 and the Air Force Manual 15-111 (19.12.2003), 'RSNK' and 'LAG PK' (data from other observing stations), and many more. Currently, more than 80 types of METAR remarks are recognised, excluding trivial keywords (see also the DTD).

This module can write the data as XML. Alternatively, a callback function can be registered which is passed step by step the same data in the same order as for the XML output.

The data contains solely information from the original message, with 2 exceptions: the relative humidity (actually 4 different values from 4 different formulas) and the ceiling (if there is one); these 2 items are cumbersome to compute with XSLT. For each data element, the corresponding text from the message is provided.

The intention is to gain as much information as possible from a message without interpreting parts of it wrongly, and that no parsing of the output data should be necessary.

source of messages

Messages can be specified simply as text. Additionally, the script metaf.pl (man page) can be used from the command line or as CGI script to download and display in plain language up-to-date weather data (METAR, TAF, SYNOP or BUOY messages) from Internet servers, an SQL database, or a local file.

metaf.pl uses the module src2raw.pm (man page) to extract correctly formatted messages from the files provided by public servers.

display of XML file

The project also provides XSLT style sheets to convert the XML to plain language as text or HTML in English, German, Spanish, and Russian (corrections and additions are welcome). The output in the text format is similar to the one of the program "metar" from the FlightGear project. The HTML output displays each message in a separate table. The leftmost column contains the original text for each element of the message, the top row contains the original message (see also project screenshots or examples below). To convert the content to text or HTML, the program "xsltproc" is used, but others that work similar shouldn't be a problem.

There are also XSLT style sheets to create a summary or overview: only some items of each message are shown in an abbreviated format, one line per message.

command line interface

The script metaf2xml.pl (man page) reads messages, processes them, and writes the XML data to standard output. It can serve as input for "xsltproc" or similar programs to get HTML or text.

The script metaf.pl (man page) can be used to fetch up-to-date messages from other sources.

web interface

Ideally, any XML capable browser should be able to process the XML with the XSLT style sheet specified in the file, and display the formatted result, but not all browsers are XML capable. The script metaf.pl (man page) provides an interface using either XML/XSLT or pure HTML. The XML data can be seen by viewing the source of the web page if "XML" was selected as output format.

source code is available and GPL

Everybody who wants to contribute is invited to do so. If you want to help you might pick a task from the ToDo.

To try it out

The latest version of metaf2xml can by tried out at SourceForge. However, the demo version cannot provide up-to-date messages for stations, as SourceForge does not allow outgoing connections to the internet. The messages are fetched from a database on the SourceForge server instead. The database is updated from time to time, only.

With the demo version with graphics (uses Ajax), the stations are marked with a dot on a map. The map can be viewed in different enlargements and can be moved by click and drag. The requested messages are displayed beneath the map, the latest one on top. The list of stations is created dynamically from the same database.

With the text-based demo version, weather messages can be entered. If the option "ICAO id(s)" or "WMO id(s)" is selected, station id's can be entered, too.

Sources for weather messages

Several organisations and providers offer public access to up-to-date and older weather messages, e.g.:

Useful links

demo version

(see also To try it out)

files from the latest version
man pages (generated from the Perl sources)
project links

Examples for messages in plain language

The result of the parsing of the above example messages can be found in example.xml (XML without XSLT style sheet reference). Using the XSLT style sheets from the project, the output in plain language (here: as HTML, summary first, detailed below) looks as follows:

Warning: The information below may be out-dated, inaccurate, or both. It is not suited for use in aviation.

Values of entries marked with * do not originate directly from the message, but are derived from its data.

station time (UTC) wind (kt) vis weather sky temp (°C) hum pressure (hPa) N/R
METAR SBGL 17., 23:00 WSW 7 >=10 km TS FEW015 FEW030CB BKN100 25 79 %* QNH1013
TAF SBGL 17., 21:30 SSW 10 7 km BKN015 (^26@18., 00:00, v17@18., 23:00)
TEMPO FM 18., 01:00 TL 18., 05:00 4 km TSRA BKN015 FEW025CB
BECMG FM 18., 08:00 TL 18., 10:00 4 km BR BKN008
BECMG FM 18., 12:00 TL 18., 14:00 S 10 6 km NSW BKN012
METAR KJFK 17., 23:51 SE 3 16.1 km CLR 14 (14.4) (^18.9/6h, v14.4/6h) 55 %* (53 %*) QNH1028 SLP1028.0 (-0.2/3h)
TAF KJFK 17., 23:20 VRB 4 >=9.7 km SKC
FM 18., 16:00 S 8 >=9.7 km SKC
FM 19., 02:00 VRB 5 >=9.7 km SKC
METAR RJTT 17., 23:30 N 9 CAVOK 22 69 %* QNH1020 QNH1020
TAF RJTT 17., 20:36 NE 12 >=10 km FEW030
BECMG FM 18., 06:00 TL 18., 09:00 ENE 14
BECMG FM 18., 12:00 TL 18., 15:00 NNE 6

type time (UTC) station vis cloud wind (kt) temp (°C) hum pressure (hPa)/GP (gpm) precip weather low,middle,high clouds cloud lvl N/P
SYNOP NIL AAXX 17., 18:00 74486 ?
SYNOP AAXX 17., 18:00 47662 20 km 2/8 >=2500 m NNE 3 20.3 72 %* SP1015.0 (-0.5/3h) SLP1019.3 0 mm/6h - 0/8 0/8 CI spi/cas/flo

type time (UTC) buoy wind (kt) temp (°C) hum pressure (hPa) N/P
BUOY ZZYY 17.09. xxx3, 13:00 31262 W 1.9 2.1 48214
BUOY ZZYY 17.09. xxx3, 22:00 41955
BUOY ZZYY 17.09. xxx3, 23:36 53904

Warning: The information below may be out-dated, inaccurate, or both. It is not suited for use in aviation.

Values of entries marked with * do not originate directly from the message, but are derived from its data.

SBGL 172300Z 24007KT 9999 TS FEW015 FEW030CB BKN100 25/21 Q1013
METAR METAR Report
SBGL station id: SBGL (Galeao, Brazil, 22° 49' 0" S 43° 15' 0" W 6 m)
172300Z observation time: on the 17., 23:00 UTC
24007KT Wind: from the west-south-west (240° (+4°/-5°)) at 13 km/h 7 kt = 8.1 mph = 3.6 m/s
9999 Visibility: >=10 km >=6.2 miles
TS Weather: thunderstorm
FEW015 FEW030CB BKN100 ceiling*: at 3000 (.. <3030) m 10000 ft
Sky condition: few clouds at 450 (.. <480) m 1500 ft
few clouds at 900 (.. <930) m
(cumulonimbus)
3000 ft
broken clouds at 3000 (.. <3030) m 10000 ft
25/21 Temperature: 25 °C 77.0 °F
Dewpoint: 21 °C 69.8 °F
relative humidity*: 79 %
Q1013 altimeter: 1013 hPa 29.91 in. Hg = 760 mmHg

SBGL 172130Z 1800/1906 21010KT 7000 BKN015 TX26/1800Z TN17/1823Z PROB30 TEMPO 1801/1805 4000 TSRA BKN015 FEW025CB BECMG 1808/1810 4000 BR BKN008 BECMG 1812/1814 19010KT 6000 NSW BKN012 RMK PGZ
TAF 30h aerodrome forecast
SBGL station id: SBGL (Galeao, Brazil, 22° 49' 0" S 43° 15' 0" W 6 m)
172130Z Issue time: on the 17., 21:30 UTC
1800/1906 Forecast period: from the 18., 00:00 UTC till the 19., 06:00 UTC
21010KT Wind: from the south-south-west (210° (+4°/-5°)) at 18.5 km/h 10 kt = 11.5 mph = 5.1 m/s
7000 Visibility: 7000 (.. <8000) m 4.3 miles
BKN015 ceiling*: at 450 (.. <480) m 1500 ft
Sky condition: broken clouds at 450 (.. <480) m 1500 ft
TX26/1800Z max. temperature: 26 °C on the 18., 00:00 UTC 78.8 °F
TN17/1823Z min. temperature: 17 °C on the 18., 23:00 UTC 62.6 °F
trend forecast:
PROB30 TEMPO 1801/1805 with 30 % probability from the 18., 01:00 UTC till the 18., 05:00 UTC temporarily:
4000 Visibility: 4000 (.. <4100) m 2.5 miles
TSRA Weather: thunderstorm with moderate rain
BKN015 FEW025CB ceiling*: at 450 (.. <480) m 1500 ft
Sky condition: broken clouds at 450 (.. <480) m 1500 ft
few clouds at 750 (.. <780) m
(cumulonimbus)
2500 ft
BECMG 1808/1810 from the 18., 08:00 UTC till the 18., 10:00 UTC transition to:
4000 Visibility: 4000 (.. <4100) m 2.5 miles
BR Weather: mist
BKN008 ceiling*: at 240 (.. <270) m 800 ft
Sky condition: broken clouds at 240 (.. <270) m 800 ft
BECMG 1812/1814 from the 18., 12:00 UTC till the 18., 14:00 UTC transition to:
19010KT Wind: from the south (190° (+4°/-5°)) at 18.5 km/h 10 kt = 11.5 mph = 5.1 m/s
6000 Visibility: 6000 (.. <7000) m 3.7 miles
NSW Weather: nil significant weather
BKN012 ceiling*: at 360 (.. <390) m 1200 ft
Sky condition: broken clouds at 360 (.. <390) m 1200 ft
RMK Remarks:
PGZ NOT RECOGNISED: PGZ

KJFK 172351Z 14003KT 10SM CLR 14/05 A3036 RMK AO2 SLP280 T01440050 10189 20144 55002
METAR METAR Report
KJFK station id: KJFK (New York/John F. Kennedy Int., New York, USA, 40° 39' 0" N 73° 47' 0" W 7 m)
172351Z observation time: on the 17., 23:51 UTC
14003KT Wind: from the south-east (140° (+4°/-5°)) at 5.6 km/h 3 kt = 3.5 mph = 1.5 m/s
10SM Visibility: 10 (>9.5 .. 10.5) miles 16.1 km
CLR Sky condition: no clouds reported by automated station
14/05 Temperature: 14 °C 57.2 °F
Dewpoint: 5 °C 41.0 °F
relative humidity*: 55 %
A3036 altimeter: 30.36 in. Hg 1028 hPa = 771 mmHg
RMK Remarks:
AO2 automated station with precipitation discriminator (ASOS)
SLP280 sea level pressure: 1028.0 hPa 30.36 in. Hg = 771 mmHg
T01440050 Temperature: 14.4 °C 57.9 °F
Dewpoint: 5.0 °C 41.0 °F
relative humidity*: 53 %
10189 max. temperature since 6 hour(s): 18.9 °C 66.0 °F
20144 min. temperature since 6 hour(s): 14.4 °C 57.9 °F
55002 pressure change since 3 hour(s): -0.2 hPa, having decreased, then increased

KJFK 172320Z 1800/1906 VRB04KT P6SM SKC FM181600 18008KT P6SM SKC FM190200 VRB05KT P6SM SKC
TAF 30h aerodrome forecast
KJFK station id: KJFK (New York/John F. Kennedy Int., New York, USA, 40° 39' 0" N 73° 47' 0" W 7 m)
172320Z Issue time: on the 17., 23:20 UTC
1800/1906 Forecast period: from the 18., 00:00 UTC till the 19., 06:00 UTC
VRB04KT Wind: from variable directions at 7.4 km/h 4 kt = 4.6 mph = 2.1 m/s
P6SM Visibility: >=6 miles >=9.7 km
SKC Sky condition: sky clear
trend forecast:
FM181600 from the 18., 16:00 UTC:
18008KT Wind: from the south (180° (+4°/-5°)) at 14.8 km/h 8 kt = 9.2 mph = 4.1 m/s
P6SM Visibility: >=6 miles >=9.7 km
SKC Sky condition: sky clear
FM190200 from the 19., 02:00 UTC:
VRB05KT Wind: from variable directions at 9.3 km/h 5 kt = 5.8 mph = 2.6 m/s
P6SM Visibility: >=6 miles >=9.7 km
SKC Sky condition: sky clear

RJTT 172330Z 35009KT CAVOK 22/16 Q1020 NOSIG RMK A3013
METAR METAR Report
RJTT station id: RJTT (Tokyo International Airport, Japan, 35° 33' 12" N 139° 46' 52" E 9 m)
172330Z observation time: on the 17., 23:30 UTC
35009KT Wind: from the north (350° (+4°/-5°)) at 16.7 km/h 9 kt = 10.4 mph = 4.6 m/s
CAVOK cloud and visibility OK
22/16 Temperature: 22 °C 71.6 °F
Dewpoint: 16 °C 60.8 °F
relative humidity*: 69 %
Q1020 altimeter: 1020 hPa 30.12 in. Hg = 765 mmHg
trends within the next 2 hours:
NOSIG no significant change
RMK Remarks:
A3013 altimeter: 30.13 in. Hg 1020 hPa = 765 mmHg

RJTT 172036Z 1721/1824 04012KT 9999 FEW030 BECMG 1806/1809 07014KT BECMG 1812/1815 03006KT
TAF 27h aerodrome forecast
RJTT station id: RJTT (Tokyo International Airport, Japan, 35° 33' 12" N 139° 46' 52" E 9 m)
172036Z Issue time: on the 17., 20:36 UTC
1721/1824 Forecast period: from the 17., 21:00 UTC till the 18., 24:00 UTC
04012KT Wind: from the north-east (40° (+4°/-5°)) at 22.2 km/h 12 kt = 13.8 mph = 6.2 m/s
9999 Visibility: >=10 km >=6.2 miles
FEW030 Sky condition: few clouds at 900 (.. <930) m 3000 ft
trend forecast:
BECMG 1806/1809 from the 18., 06:00 UTC till the 18., 09:00 UTC transition to:
07014KT Wind: from the east-north-east (70° (+4°/-5°)) at 25.9 km/h 14 kt = 16.1 mph = 7.2 m/s
BECMG 1812/1815 from the 18., 12:00 UTC till the 18., 15:00 UTC transition to:
03006KT Wind: from the north-north-east (30° (+4°/-5°)) at 11.1 km/h 6 kt = 6.9 mph = 3.1 m/s

AAXX 17184 74486 NIL
SYNOP NIL Synoptic observation (main hour) (report missing)
section 0:
AAXX fixed land station
1718 observation time: on the 17., 18:00 UTC
4 wind data: kt
74486 station id: 74486 (New York/John F. Kennedy Int., New York, USA, 40° 39' 0" N 73° 47' 0" W 7 m) (North and Central Amerika)
NIL report missing

AAXX 17184 47662 12970 20203 10203 20151 30150 40193 56005 60001 80002
SYNOP Synoptic observation (main hour)
section 0:
AAXX fixed land station
1718 observation time: on the 17., 18:00 UTC
4 wind data: kt
47662 station id: 47662 (Tokyo, Japan, 35° 41' 0" N 139° 46' 0" E 36 m) (Asia)
section 1:
1 precipitation data: in section 1
2 weather data: omitted (no significant phenomenon)
9 base of lowest cloud: >=2500 m >=8200 ft
70 Visibility: 20 (.. <21) km 12.4 miles
2 total cloud cover: 2/8 (2..3/10)
0203 Wind: from the north-north-east (20° (+4°/-5°)) at 5.6 km/h 3 kt = 3.5 mph = 1.5 m/s
10203 20151 Temperature: 20.3 °C 68.5 °F
Dewpoint: 15.1 °C 59.2 °F
relative humidity*: 72 %
30150 station level pressure: 1015.0 hPa 29.97 in. Hg = 761 mmHg
40193 sea level pressure: 1019.3 hPa 30.10 in. Hg = 765 mmHg
56005 pressure change (station level) since 3 hour(s): -0.5 hPa, having decreased, then steady; or decreased, then decreased more slowly
60001 precip. amount since 6 hour(s): 0 mm 0 in.
80002 cloud types: low: no clouds
mid-level: no clouds
high: cirrus (dense, with sproutings, or in tufts) (Ci spissatus, castellanus, or flocus)

ZZYY 31262 17093 13001 522980 042100 6112/ 11119 02801 10021 48214 444 20120 17093 1159/ 518// 60371
BUOY Buoy observation
section 0:
ZZYY buoy
31262 buoy id: 31262 (South America)
17093 1300 observation time: on the 17.9. xxx3, 13:00 UTC
1 wind data: m/s
522980 042100 station position: 22.980° S 42.100° W
6112/ quality of position: data is good
quality of time: data is good
position error (66 % confidence) from: >=250 m >=820 ft
to: <500 m <1640 ft
111 section 1:
19 quality of this section: data is good
02801 Wind: from the west (280° (+4°/-5°)) at 3.6 km/h 1.9 kt = 2.2 mph = 1 m/s
10021 Temperature: 2.1 °C 35.8 °F
48214 sea level pressure: (invalid format: '48214')
444 section 4:
20120 quality of satellite transmission: good
quality of location: values at the beginning of the report are the latest known values
position error (66 % confidence) from: >=250 m >=820 ft
to: <500 m <1640 ft
correction for values for the depth: depth are not corrected
17093 1159/ time of last known position: on the 17.9. xxx3, 11:59 UTC
518 type of buoy: 3-meter discus
// type of drogue: (not available)
60371 anemometer: propeller rotor, height: 37 dm

ZZYY 41955 17093 2200/ 739065 071940 6111/ 22219 00238 444 20110 17093 1828/ 50101 80119 80007 9/015
BUOY Buoy observation
section 0:
ZZYY buoy
41955 buoy id: 41955 (North and Central Amerika)
17093 2200 observation time: on the 17.9. xxx3, 22:00 UTC
/ wind data: (not available)
739065 071940 station position: 39.065° N 71.940° W
6111/ quality of position: data is good
quality of time: data is good
position error (66 % confidence) from: >=500 m >=1640 ft
to: <1500 m <4920 ft
222 section 2:
19 quality of this section: data is good
00238 surface temperature: 23.8 °C 74.8 °F
444 section 4:
20110 quality of satellite transmission: good
quality of location: values at the beginning of the report are the latest known values
position error (66 % confidence) from: >=500 m >=1640 ft
to: <1500 m <4920 ft
correction for values for the depth: depth are not corrected
17093 1828/ time of last known position: on the 17.9. xxx3, 18:28 UTC
501 type of buoy: Standard Lagrangian drifting buoy
01 type of drogue: holey sock
80119 80007 engineering status of buoy: 80119 80007
9/015 length of drogue cable: 15 m

ZZYY 53904 17093 2336/ 135184 142953 6112/ 22219 00285 444 20120 17093 2331/ 50101 80092 80016 9/015
BUOY Buoy observation
section 0:
ZZYY buoy
53904 buoy id: 53904 (South-West Pacific)
17093 2336 observation time: on the 17.9. xxx3, 23:36 UTC
/ wind data: (not available)
135184 142953 station position: 35.184° N 142.953° E
6112/ quality of position: data is good
quality of time: data is good
position error (66 % confidence) from: >=250 m >=820 ft
to: <500 m <1640 ft
222 section 2:
19 quality of this section: data is good
00285 surface temperature: 28.5 °C 83.3 °F
444 section 4:
20120 quality of satellite transmission: good
quality of location: values at the beginning of the report are the latest known values
position error (66 % confidence) from: >=250 m >=820 ft
to: <500 m <1640 ft
correction for values for the depth: depth are not corrected
17093 2331/ time of last known position: on the 17.9. xxx3, 23:31 UTC
501 type of buoy: Standard Lagrangian drifting buoy
01 type of drogue: holey sock
80092 80016 engineering status of buoy: 80092 80016
9/015 length of drogue cable: 15 m

copyright (c) 2006-2014 metaf2xml @ SourceForge.net Logo