DragonFly On-Line Manual Pages
metaf(1) metaf2xml Documentation metaf(1)
NAME
metaf.pl - download and display METAR/TAF/SYNOP/BUOY/AMDAR messages
SYNOPSIS
as a standalone script used from the command line:
metaf.pl 'type_metaf=...&type_synop=...&type_buoy=...&type_amdar=...&lang=...&format=...&src_metaf=...&src_synop=...&src_buoy=...&src_amdar=...&mode=...&hours=...&msg_metaf=...&msg_synop=...&msg_buoy=...&msg_amdar=...'
or
metaf.pl type_metaf=... type_synop=... type_buoy=... type_amdar=... lang=... format=... src_metaf=... src_synop=... src_buoy=... src_amdar=... mode=... hours=... msg_metaf='...' msg_synop='...' msg_buoy='...' msg_amdar='...'
or as a CGI script used by an HTML form (HTTP method GET):
<form method="GET" action="metaf.pl">
<input name="type_metaf" ... >
<input name="type_synop" ... >
<input name="type_buoy" ... >
<input name="type_amdar" ... >
<input name="lang" ... >
<input name="format" ... >
<input name="src_metaf" ... >
<input name="src_synop" ... >
<input name="src_buoy" ... >
<input name="src_amdar" ... >
<input name="mode" ... >
<input name="hours" ... >
<input name="msg_metaf" ... >
<input name="msg_synop" ... >
<input name="msg_buoy" ... >
<input name="msg_amdar" ... >
</form>
DESCRIPTION
This script can download and display in plain language up-to-date or
historical weather information (METAR, TAF, SYNOP, BUOY or AMDAR
messages) from Internet servers, an SQL database, or a local file. It
can be used from the command line, or with GET or POST requests if it
is installed to be called via CGI by a web server.
If the script is called from a web server and the file $CGI_LOG_FILE is
writable by the user running the web server (e.g. "wwwrun"), metaf.pl
will log the requests there.
DEPENDENCIES
The Perl modules "CGI", "metaf2xml::parser" and "metaf2xml::src2raw"
are required.
The Perl module "DBI" and the module "DBD" (for the configured type of
data source) are required if an SQL database is used as the data
source.
The program "curl" is required to download weather messages from
Internet servers.
The program "xsltproc" is required if the script is to convert the XML
to HMTL or text.
ABBREVIATIONS
noaa
National Oceanic and Atmospheric Administration
nws the National Weather Service department of the NOAA
iws the Internet Weather Source of the NWS
adds
the Aviation Digital Data Service of the NWS
addsds
the experimental data server of the Aviation Digital Data Service
of the NWS
cod College of DuPage
fsu Florida State University
OPTIONS
-v print version of metaf.pl and exit
ARGUMENTS
The following variables can be set from CGI parameters or on the
command line:
type_metaf
type of content in "msg_metaf": metar (default), taf, icao (ICAO
id(s) to fetch)
type_synop
type of content in "msg_synop": synop (default), wmo (WMO id(s) to
fetch), ship (SYNOP SHIP id(s) to fetch), mobil (SYNOP MOBIL id(s)
to fetch)
type_buoy
type of content in "msg_buoy": buoy (default), wmo (WMO id(s) to
fetch)
type_amdar
type of content in "msg_amdar": amdar (default), ac (aircraft id(s)
to fetch)
lang
language for output of script and display of parsed message: de
(default), en, es, ru
format
output format: html (default), text, or xml (with style sheet
reference)
src_metaf
source for METAR/TAF messages to be fetched: noaa (NOAA/IWS)[1]
(default), adds[2], addsds[2], ogimet[2], nws[1], cod[1] (no TAF),
fsu[1] (no TAF). It is ignored if a source in "DB_DATA_SOURCES"[3]
could be opened or $CGI_DATA_DIR/metaf.txt[4] exists.
Note: cod and fsu are not available in the web-based interfaces.
src_synop
source for SYNOP messages to be fetched: nws[1] (default),
ogimet[2], cod[1], fsu[1]. It is ignored if a source in
"DB_DATA_SOURCES"[3] could be opened or $CGI_DATA_DIR/synop.txt[4]
exists.
Note: fsu is not available in the web-based interfaces.
src_buoy
source for BUOY messages to be fetched: nws[1] (default),
ogimet[2]. It is ignored if a source in "DB_DATA_SOURCES"[3] could
be opened or $CGI_DATA_DIR/buoy.txt[4] exists.
src_amdar
source for AMDAR messages to be fetched: nws[1] (default), fsu[1].
It is ignored if a source in "DB_DATA_SOURCES"[3] could be opened
or $CGI_DATA_DIR/amdar.txt[4] exists.
mode
which messages to fetch and how to display: latest/detailed
(default), all/summary
hours
for mode summary: number of hours to fetch messages for (0..72,
default: 24)
Note: The exact time range for which data is received depends on
the source of messages.
msg_metaf
METAR/TAF message to be processed, or ICAO id(s)
msg_synop
SYNOP message to be processed, or WMO id(s)
msg_buoy
BUOY message to be processed, or WMO id(s)
msg_amdar
AMDAR message to be processed, or aircraft id(s)
[1]: Files will be fetched from the server and searched. Note: The
parameter hours is used to select files by their time stamp or name;
the selected files do not necessarily contain only messages for the
choosen hours.
[2]: the HTML form provided by the server will be used
[3]: For the description of the configuration variable $DB_DATA_SOURCES
see the USAGE NOTES for "DB_DATA_SOURCES" below.
[4]: For the format required for the files in $CGI_DATA_DIR see the
USAGE NOTES for "CGI_DATA_DIR" below.
USAGE NOTES
The length of the body of the POST request (not the length of query
string of the URL) is restricted to 600 bytes.
The following variables can be adapted to local needs; this is
typically done during the installation:
METAF2XML_XSL
directory for the XSL style sheets
CGI_DATA_DIR
directory for files with pre-processed METAR/TAF/SYNOP/BUOY/AMDAR
messages
The messages in these files must have 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,
with the report type "TT" prepended. This format can be obtained
using:
metafsrc2raw.pl -F<FORMAT> -H1 [FILE] ...
CGI_LOG_FILE
complete path for log file
CURL
path and options for "curl"
CURL_PROXY_OPTS
options for "curl" if an HTTP proxy should be used
DB_DATA_SOURCES
space delimited strings to describe possible data sources
If the string "sqlite" is in the list, the file
$CGI_DATA_DIR/sqlite.db is used as database. For other strings,
the file $CGI_DATA_DIR/"string".db should contain the connect
string ("DBI:"...) in the first line. The database username is
"metaf2xml", it has no password; the user "metaf2xml" should have
only SELECT rights.
The first data source which can be opened is used. If the last data
source fails to open or "DB_DATA_SOURCES" is empty, the parameters
"src_"* are used.
However, if a string ends in "/f", this is the last data source to
try and the parameters "src_"* are not used, either. If this
source fails to open, the script will exit with the HTTP error 503.
The Perl module "DBI" and the module "DBD" for the configured data
source are required if a database is to be used.
If there are any CGI errors the type of error is reported and the
script terminates.
All parameters are checked to have one of the allowed values.
If the parameter "lang" is not set the first allowed value of the HTTP
header "Accept-Language" is used.
The parameters "msg_"* are truncated to 2000 characters. Letters are
converted to upper case. Any characters that are not allowed in a
message are removed.
If the METAR/TAF message starts with "METAR", "SPECI", or "TAF", the
parameter "type_metaf" is ignored.
If the SYNOP message starts with "AAXX", "BBXX" or "OOXX", the
parameter "type_synop" is ignored.
If the BUOY message starts with "ZZYY", the parameter "type_buoy" is
ignored.
If the AMDAR message starts with "AMDAR", the parameter "type_amdar" is
ignored.
If "type_metaf" is icao and one or more airport ICAO codes are given,
messages for the specified airports are fetched from the specified
source.
If "type_synop" is wmo, ship or mobil and one or more ids are given,
messages for the specified stations are fetched from the specified
source.
If "type_buoy" is wmo and one or more WMO ids are given, messages for
the specified buoys are fetched from the specified source.
If "type_amdar" is ac and one or more aircraft ids are given, messages
for the specified aircrafts are fetched from the specified source.
EXIT STATUS
If an invalid option was provided, the script will exit with status 1,
otherwise it will exit with status 0.
EXAMPLES
Parse a METAR message and print the result as HTML:
metaf.pl msg_metaf="YUDO 090600Z 00000KT CAVOK 22/15 Q1021"
Fetch up-to-date METAR and TAF messages (from NOAA/IWS), SYNOP messages
(from NOAA/NWS land) for Rio (SBGL, 83746), New York (KJFK, 74486), and
Tokyo (RJTT, 47662) and BUOY messages from a buoy nearby (from
NOAA/NWS) and print the result as XML:
metaf.pl format=xml type_metaf=icao type_synop=wmo type_buoy=wmo msg_metaf="SBGL KJFK RJTT" msg_synop="83746 74486 47662" msg_buoy="31550 41997 53596"
SEE ALSO
metaf2xml::parser(3pm), metaf2xml::src2raw(3pm), metafsrc2raw(1),
<http://metaf2xml.sourceforge.net/>
COPYRIGHT and LICENSE
copyright (c) 2006-2015 metaf2xml @ <http://metaf2xml.sourceforge.net/>
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, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA, or see
<http://www.gnu.org/licenses/>.
metaf2xml 1.58 2015-12-23 metaf(1)