NAME

Weather::WMO - routines for parsing WMO abbreviated header lines

DESCRIPTION

Weather::WMO is a module for parsing WMO abbreviated header lines in World Meterological Organization-formatted weather products.

EXAMPLE

require Weather::WMO;

$line = "FPUS61 KOKX 171530";

unless (Weather::WMO::valid($line)) {
    die "\'$line\' is not a valid header.\n";
}

$WMO = new Weather::WMO($line);

print "WMO\t", $WMO->WMO, "\n";
print "product\t", $WMO->product, "\n";     # FPUS61
print "station\t", $WMO->station, "\n";     # KOKX
print "time\t", $WMO->time, "\n";           # "171530"

# other constructors
$WMO = new Weather::WMO qw(FPUS51 KNYC 041200 PAA);

$WMO = new Weather::WMO;
$WMO->WMO="FPUS51 KNYC 041200 (PAA)";

METHODS

PRODUCT

An exported text constant. PRODUCT = 'PRODUCT'.

new

The object constructor:

$obj = new Weather::WMO SCALAR

where SCALAR is the WMO header (without any trailing spaces, newlines or carriage returns).

An alternative constructor may be used:

$obj = new Weather::WMO LIST

where LIST contains the individual parts of the WMO header (see the examples above).

valid

Weather::WMO::valid SCALAR

Returns true if the header specified in SCALAR looks like a valid WMO header line. Otherwise false.

cmp

Compares two WMO objects.

$obj1->cmp $obj2

Returns true if obj2 is the same "product" as obj1.

WMO

When called without arguments it returns the WMO header as a string.

When called with arguments, it assigns a value to the WMO header (if none has already been assigned).

product

Returns the "product" portion (T1T2A1A2ii) of the WMO header.

station

Returns the "station" portion of the WMO header.

time

Returns the timestamp of the WMO header, in WMO format (DDHHMM where DD is the day of the month and HHMM is the time, in UGC).

This time can be converted to a Perl-friendly format using the Weather::Product::int_time function.

addendum

Returns the "addendum" (or BBB) portion of the WMO header.

region

Returns the geographical region code of the weather product, if applicable. Otherwise it returns undef.

T1, T2, T1T2, TT, A1, A2, A1A2, ii, BBB

Returns the equivalent portion of the WMO header.

KNOWN BUGS

This module only performs simple string validation and parsing of WMO header lines. It does not check if the product or station is actually valid, or if the timestamp is valid.

"Non-standard" header lines used by a specific weather service may not be handled properly.

SEE ALSO

Weather::Product and Weather::Product::NWS, which make use of this module.

For more information about what WMO heading lines are, see http://www.nws.noaa.gov/oso/head.shtml

DISCLAIMER

I am not a meteorologist nor am I associated with any weather service. This module grew out of a hack which would fetch weather reports every morning and send them to my pager. So I said to myself "Why not do this the right way..." and spent a bit of time surfing around the web looking for documentation about this stuff....

AUTHOR

Robert Rothenberg <wlkngowl@unix.asb.com>