METAR(3pm)
π METAR(3pm) β the vibe check on aviation weather π
okay so bestie, welcome to the METAR page from section 3pm of the User Contributed Perl Documentation. It's giving "weather girlie who actually knows Perl". Let's go π¦
β¨ NAME β¨
Geo::METAR β it processes aviation weather reports in the METAR format. that's it, that's the whole job π
πΈ 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 π
so METAR reports are available on-line, and we have the National Weather Service to thank for that π«Ά. but here's the thing β reading the METAR format is not easy for non-pilots. like, these reports are relatively useles to the common man who just wants a quick glace at the weather. tragic, honestly.
this module tries to parse the METAR reports so the data can be used to create readable weather reports and/or process the data in applications. main character energy fr fr β¨
π USAGE π
How you might use this
here's how you might use the Geo::METAR module, bestie.
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=EHSB
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, EHSB 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 webcam page with the current temperature, sky conditions, or whatnot. See for yourself at http://webcam.idefix.net/
π heads up! See the BUGS section for a remark about multiple passes with the same Geo::METAR object. not me making the same mistake twice π
Functions
the following functions are defined in the METAR 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 following:
- enable with
1β disable with0 - enable with
'yes'β disable with'no' - enable with
'on'β disable with'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. slay π
this section lists those variables and what they represent.
If you call dump(), you'll find that it spits all of these out.
VERSIONβ The version of METAR.pm that you're using.METARβ The actual, raw METAR.TYPEβ Report type in English ("Routine Weather Report" or "Special Weather Report")SITEβ 4-letter site code.DATEβ The date (just the day of the month) 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_ABBβ The current wind direction in abbreviated English (S, E, N, 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_MSβ The current wind speed in Metres Per Second.WIND_GUST_KTSβ The current wind gusting speed in Knots.WIND_GUST_MPHβ The current wind gusting speed in Miles Per Hour.WIND_GUST_MSβ The current wind gusting speed in Metres Per Second.WIND_VARβ The wind variation in EnglishWIND_VAR_1β The first wind variation directionWIND_VAR_ENG_1β The first wind variation direction in EnglishWIND_VAR_2β The second wind variation directionWIND_VAR_ENG_2β The second wind variation direction in EnglishVISIBILITYβ Visibility information.WINDβ Wind information.RUNWAYβ Runway information.WEATHERβ Current weather (array)WEATHER_LOGβ Current weather log (array)SKYβ Current cloud cover (array)TEMP_Cβ Temperature in Celsius.TEMP_Fβ Temperature in Fahrenheit.DEW_Cβ Dew point in Celsius.DEW_Fβ Dew point in Fahrenheit.HOURLY_TEMP_Fβ Hourly current temperature, fahrenheitHOURLY_TEMP_Cβ Hourly current temperature, celciusHOURLY_DEW_Fβ Hourly dewpoint, fahrenheitHOURLY_DEW_Cβ Hourly dewpoint, celciusALTβ Altimeter setting (barometric pressure).ALT_HPβ Altimeter setting in hectopascals.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 β iykyk.
π BUGS π
TheGeo::METARis only initialized once, which means you'll get left-over crud in variables when you call themetar()function twice. bestie. bestie no π
What is an invalid METAR in one country is a standard one in the next. The standard is interpreted and used by meteorologists all over the world, with local variations. This means there will always be METARs that will trip the parser. not the parser being a hater π
π 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. π
π AUTHORS AND COPYRIGHT π
Copyright 1997-2000, Jeremy D. Zawodny <Jeremy [at] Zawodny.com>
Copyright 2007, Koos van den Hout <koos@kzdoos.xs4all.nl>
Geo::METAR is covered under the GNU Public License (GPL) version 2 or later.
The Geo::METAR Web site is located at:
http://idefix.net/~koos/perl/Geo-METAR/
πΈ CREDITS πΈ
In addition to our work on Geo::METAR, We've received ideas, help, and patches from the following folks β absolute icons, every single one π«Ά
- Ethan Dicks
<ethan.dicks [at] gmail.com>- Testing of
Geo::METARat the South Pole. Corrections and pointers to interesting cases to test. (south pole testing?? main character energy fr)
- Testing of
- Otterboy
<jong [at] watchguard.com>- Random script fixes and initial debugging help
- Remi Lefebvre
<remi [at] solaria.dhis.org>- Debian packaging as
libgeo-metar-perl.deb.
- Debian packaging as
- Mike Engelhart
<mengelhart [at] earthtrip.com>- Wind direction naming corrections.
- Michael Starling
<mstarling [at] logic.bm>- Wind direction naming corrections.
- Hans Einar Nielssen
<hans.einar [at] nielssen.com>- Wind direction naming corrections.
- Nathan Neulinger
<nneul [at] umr.edu>- Lots of enhancements and corrections. Too many to list here.
β RELATED PROJECTS β
lcdproc at http://www.lcdproc.org/ uses Geo::METAR in lcdmetar.pl to display weather data on an lcd. iconic behavior honestly π
and that's the whole page bestie!! this was perl v5.36.0, dated 2022-11-19, and you've been reading the METAR(3pm) man page β thanks for coming to my TED talk, go parse some weather π¦οΈπβ¨
π¦ where this page comes from
- debian bookworm: libgeo-metar-perl 1.15-5 Β· GPL-2.0-only
- debian trixie: libgeo-metar-perl 1.15-5 Β· GPL-2.0-only
- ubuntu noble: libgeo-metar-perl 1.15-5 Β· GPL-2.0-only
- ubuntu resolute: libgeo-metar-perl 1.15-5 Β· GPL-2.0-only
- ubuntu stonking: libgeo-metar-perl 1.15-5 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms