metaf2xml::src2raw 2.1

NAME

metaf2xml::src2raw - convert data from different sources to standard format

SYNOPSIS

 use metaf2xml::src2raw 2.001;

 metaf2xml::src2raw::start_file($format,$suppressNIL,$wmo_prefix);
 while (1) {
   my $line = <>;
   @msgs = metaf2xml::src2raw::next_line($line);
   # process contents of @msgs ...
   last unless defined $line;
 }

 metaf2xml::src2raw::start_bufr($wmo_prefix,$file_name,$filter_cb);
 while (1) {
   my ($hdr, $data, $desc, $assoc, $msg) = next_bufr(1);
   last unless defined $hdr;
   # process returned data ...
 }
 next_bufr();

DESCRIPTION

This Perl module contains functions to convert METAR, TAF, SYNOP, BUOY or AMDAR information provided in files on various public Internet servers to messages delimited by a newline 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. It prepends parts of the WMO header according to the argument wmo_prefix. The output can then be used by the module metaf2xml::parser.

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

isu

Iowa State University

SUBROUTINES/METHODS

start_file($format,$suppressNIL,$wmo_prefix)

This function must be called before processing a file. The following arguments are expected:

format

origin of the input data: metar_cycle_iws, staf_cycle_iws, taf_cycle_iws, metaf_nws, metaf_cod, metaf_fsu, metaf_isu, synop_nws, synop_cod, synop_fsu, synop_isu, buoy_nws, buoy_isu, amdar_nws, amdar_fsu, amdar_isu

suppressNIL

if true, messages that only contain NIL are not returned

wmo_prefix

which parts of the WMO header (TTAA[II] CCCC DDHHMM [BBB]) to prepend to each message:

0

(no header) (default)

1

TT (report type:

SA

METAR

SP

SPECI

FT

TAF with forecast period >= 12 hours

FC

TAF with forecast period < 12 hours

SM

SYNOP at main hours (00:00, 06:00, 12:00, 18:00 UTC)

SI

SYNOP at intermediate (main + 3) hours

SN

SYNOP at non-standard (other than main and intermediate) hours

SS

BUOY

UD

AMDAR

)

2

TTAA[II] (like 1 plus region for the stations and optional report number)

3

TTAA[II] CCCC (like 2 plus report dissemination location)

4

TTAA[II] CCCC DDHHMM (like 3 plus report dissemination time)

5

TTAA[II] CCCC DDHHMM [BBB] (like 4 plus optional indicator if the report is delayed/corrected/amended/segmented)

The function will return 0 on success, or a string describing the error which occurred.

next_line($line)

This function must be called for each line in a file and once with the argument undef at the end of file.

The following arguments are expected:

line

string that contains a line from the file, or undef after the last line of the file

The return value is an array of 0, 1 or 2 messages, or an array with one element which is undef if start_file() was not called (never, or after next_line() was called with undef).

start_bufr($wmo_prefix,$file_name,$filter_cb)

This function must be called to start processing a BUFR file. The following arguments are expected:

wmo_prefix

This is the same as for start_file, except for the prepended values of TT (report type:

IS

SYNOP in BUFR format

IO

BUOY in BUFR format

IU

AMDAR in BUFR format

)

file_name

The file name for a (plain) file with binary BUFR messages.

filter_cb

Reference to a filter callback function.

The following arguments are passed to the callback function:

$bufr

The current Geo::BUFR object.

The callback function should return one the following values:

false

Message should not be filtered out.

true

Message should be filtered out.

The function will return 0 on success, or a string describing the error which occurred.

next_bufr($get_more)

This function must be called for each line in a file and once with an value of false to end processing.

The following arguments are expected:

get_more

false if processing of current file should be ended, true otherwise

The returned value is a decoded BUFR message, or undef if start_bufr() was not called (never, or after next_bufr() was called with false).

DEPENDENCIES

If binary BUFR messages are to be processed, the Perl module Geo::BUFR is required.

SEE ALSO

metaf2xml::parser(3pm), metafsrc2raw(1), metaf(1), http://metaf2xml.sourceforge.net/

COPYRIGHT and LICENSE

copyright (c) 2011-2016 metaf2xml @ SourceForge.net Logo

This file is part of metaf2xml.

metaf2xml 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.

metaf2xml 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 metaf2xml. If not, see http://www.gnu.org/licenses/.

metaf2xml::src2raw 2.1