View on
MetaCPAN
Jeremy D. Zawodny > Geo-METAR-1.14 > Geo::METAR

Download:
Geo-METAR-1.14.tar.gz

Dependencies

Annotate this POD

Related Modules

LWP::UserAgent
LWP::Simple
more...
By perlmonks.org

CPAN RT

New  1
Open  2
View/Report Bugs
Module Version: 1.14   Source   Latest Release: Geo-METAR-1.15

NAME ^

Geo::METAR - Process aviation weather reports in the METAR format.

SYNOPSIS ^

  use Geo::METAR;
  use strict;

  my $m = new Geo::METAR;
  $m->metar("KFDY 251450Z 21012G21KT 8SM OVC065 04/M01 A3010 RMK 57014");
  print $m->dump;

  exit;

DESCRIPTION ^

METAR reports are available on-line, thanks to the National Weather Service. Since reading the METAR format isn't easy for non-pilots, these reports are relatively useles to the common man who just wants a quick glace at the weather.

USAGE ^

How you might use this

Here is how you might use the Geo::METAR module.

One use that I have had for this module is to query the NWS METAR page (using the LWP modules) at http://weather.noaa.gov/cgi-bin/mgetmetar.pl?cccc=KFDY to get an up-to-date METAR. Then, I scan thru the output, looking for what looks like a METAR string (that's not hard in Perl). Oh, KFDY can be any site location code where there is a reporting station.

I then pass the METAR into this module and get the info I want. I can then update my home page with the current temperature, sky conditions, or whatnot.

Functions

The following functions are defined in the AcctInfo module. Most of them are public, meaning that you're supposed to use them. Some are private, meaning that you're not supposed to use them -- but I won't stop you. Assume that functions are public unless otherwise documented.

metar()

metar() is the function to whwich you should pass a METAR string. It will take care of decomposing it into its component parts converting the units and so on.

Example: $m->metar("KFDY 251450Z 21012G21KT 8SM OVC065 04/M01 A3010 RMK 57014");

debug()

debug() toggles debugging messages. By default, debugging is turned off. Turn it on if you are developing METAR or having trouble with it.

debug() understands all of the folloing:

        Enable       Disable
        ------       -------
          1             0
        'yes'         'no'
        'on'          'off'

If you contact me for help, I'll likely ask you for some debugging output.

Example: $m->debug(1);

dump()

dump() will dump the internal data structure for the METAR in a semi-human readable format.

Example: $m->dump;

version()

version() will print out the current version.

Example: print $m->version;

_tokenize()

PRIVATE

Called internally to break the METAR into its component tokens.

_process()

PRIVATE

Used to make sense of the tokens found in _tokenize().

Variables

After you've called metar(), you'd probably like to get at the individual values for things like temperature, dew point, and so on. You do that by accessing individual variables via the METAR object.

This section lists those variables and what they represent.

If you call dump(), you'll find that it spits all of these out in roughly this order, too.

VERSION

The version of METAR.pm that you're using.

METAR

The actual, raw METAR.

TYPE

Report type: "METAR or SPECI".

SITE

4-letter site code.

DATE

The date on which the report was issued.

TIME

The time at which the report was issued.

MOD

Modifier (AUTO/COR) if any.

WIND_DIR_ENG

The current wind direction in english (Southwest, East, North, etc.)

WIND_DIR_DEG

The current wind direction in degrees.

WIND_KTS

The current wind speed in Knots.

WIND_MPH

The current wind speed in Miles Per Hour.

WIND_GUST_KTS

The current wind gusting speed in Knots.

WIND_GUST_MPH

The current wind gusting speed in Miles Per Hour.

VISIBILITY

Visibility information.

WIND

Wind information.

RUNWAY

Runway information.

WEATHER

Current weather.

SKY

Current sky conditions.

TEMP_C

Temperature in Celsius.

TEMP_F

Temperature in Farenheit.

C_DEW

Dew point in Celsius.

F_DEW

Dew point in Farenheit.

ALT

Altimeter setting (barometric pressure).

REMARKS

Any remarks in the report.

NOTES ^

Test suite is small and incomplete. Needs work yet.

Older versions of this module were installed as "METAR" instaed of "Geo::METAR"

Adding a find() method.

I should add a function called find() which can be passed a big chunk of text (or a ref to one) and a site identifier. It will scan through the text and find the METAR. The result can be fed back into this module for processing.

That'd be cool, I think.

BUGS ^

There currently aren't any known BUGS (features which don't work as advetised). There are lacking features. See the TODO section for more on that.

TODO ^

There is a TODO file included in the Geo::METAR distribution listing the outstanding tasks that I or others have devised. Please check that list before you submit a bug report or request a new feture. It might already be on the TODO list.

AUTHOR AND COPYRIGHT ^

Copyright 1997-2000, Jeremy D. Zawodny <Jeremy@Zawodny.com>

Geo::METAR is covered under the GNU Public License (GPL) version 2 or later.

The Geo::METAR Web site is located at:

  http://www.wcnet.org/~jzawodn/perl/Geo-METAR/

CREDITS ^

In addition to my work on Geo::METAR, I've received ideas, help, and patches from the following folks:

  * Otterboy <jong@watchguard.com>

    Random script fixes and initial debugging help

  * Remi Lefebvre <remi@solaria.dhis.org>

    Debian packaging as libgeo-metar-perl.deb.

  * Mike Engelhart <mengelhart@earthtrip.com>

    Wind direction naming corrections.

  * Michael Starling <mstarling@logic.bm>

    Wind direction naming corrections.

  * Hans Einar Nielssen <hans.einar@nielssen.com>

    Wind direction naming corrections.

  * Nathan Neulinger <nneul@umr.edu>

    Lots of enhancements and corrections. Too many to list here.
syntax highlighting: