metaf2xml: manual for metaf2xml.pl 2.9

NAME

metaf2xml.pl - parse and print METAR/TAF/SYNOP/BUOY/AMDAR messages

SYNOPSIS

 metaf2xml.pl [OPTION]... [MESSAGE]...

DESCRIPTION

This script is an example interface to the Perl module metaf2xml::parser. Messages can be specified as arguments, each message in single or double quotes. If no messages are given as arguments but the option -f is given, messages are read from the specified file. If neither arguments nor option -f are given, messages are read from the standard input.

The input is expected to consist of one message per line and in the format specified by the WMO Manual No. 306, without modifications due to distribution like providing the initial part of messages only once for several messages or appending an "=" (equal sign) to terminate a message, and parts of the WMO header prepended according to the option -H. The program metafsrc2raw.pl can be used to create messages with the required format from files provided by various public Internet servers.

DEPENDENCIES

The Perl module metaf2xml::parser is required.

OPTIONS

-v

print version of metaf2xml.pl and exit

-H 0..5

which parts of the WMO header (T1T2A1A2[ii] CCCC YYGGgg [BBB]) are prepended to each message. See the parameter "wmo_prefix" in metaf2xml::src2raw(3pm) for a description of the WMO header and its parts.

-T {SPECI|TAF}

(initial) default message type (default: METAR). An input line consisting only of one of the keywords METAR, SPECI or TAF changes the default message type for all following messages. If the option -H1, -H2, -H3, -H4 or -H5 is given, the message type for each message is taken from the WMO header.

If a message starts with:

METAR, SPECI or TAF

this will be used as message type for this message

AAXX, BBXX or OOXX

the message type SYNOP will be used for this message

ZZYY

the message type BUOY will be used for this message

AMDAR or ARP

the message type AMDAR will be used for this message

FXXYYY: or FXXYYY/ or FXXYYY-

the message will be processed as a decoded BUFR message

See parse_report() in metaf2xml::parser(3pm) for a description of the format.

-D dtd_file

include DOCTYPE and reference to the DTD dtd_file

-S xslt_file

include reference to the stylesheet xslt_file

-f msg_file

read input from msg_file (- (minus) means standard input)

-o out_file

enables writing the data to out_file (- (minus) means standard output)

Without the option -o, no output is generated.

ARGUMENTS

If any arguments are given, they are processed as messages; the option -f and standard input are not used in this case.

EXIT STATUS

If an invalid option was provided or an error was encountered while writing output or the file specified with -f cannot be opened, the script will exit with status 1, otherwise it will exit with status 0.

EXAMPLES

Parse a METAR message and write the XML to the standard output:

 metaf2xml.pl -o- "QUDO 090600Z 00000KT CAVOK 22/15 Q1021 NOSIG"

or the same for a SYNOP message:

 metaf2xml.pl -o- "AAXX 17124 74486 32566 63616 10067 20022 39972"

Parse several METAR, TAF, SYNOP, BUOY and AMDAR messages and write the XML to the file example.xml:

 metaf2xml.pl -o example.xml << EOF
METAR
SBGL 172300Z 24007KT 9999 TS FEW015 FEW030CB BKN100 25/21 Q1013
TAF
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
METAR
KJFK 172351Z 14003KT 10SM CLR 14/05 A3036 RMK AO2 SLP280 T01440050 10189 20144 55002
TAF
KJFK 172320Z 1800/1906 VRB04KT P6SM SKC FM181600 18008KT P6SM SKC FM190200 VRB05KT P6SM SKC
METAR
RJTT 172330Z 35009KT CAVOK 22/16 Q1020 NOSIG RMK A3013
TAF
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
AMDAR 1605 ASC AFZA51 2624S 02759E 160414 F156 MS048 278/034 TB0 S031 333 F/// VG010
EOF

SEE ALSO

metaf2xml::parser(3pm), metaf2xml::src2raw(3pm), metafsrc2raw(1), metaf(1), https://metaf2xml.sourceforge.io/

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

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.