1METAR(3) User Contributed Perl Documentation METAR(3)
2
3
4
6 Geo::METAR - Process aviation weather reports in the METAR format.
7
9 use Geo::METAR;
10 use strict;
11
12 my $m = new Geo::METAR;
13 $m->metar("KFDY 251450Z 21012G21KT 8SM OVC065 04/M01 A3010 RMK 57014");
14 print $m->dump;
15
16 exit;
17
19 METAR reports are available on-line, thanks to the National Weather
20 Service. Since reading the METAR format isn't easy for non-pilots,
21 these reports are relatively useles to the common man who just wants a
22 quick glace at the weather. This module tries to parse the METAR
23 reports so the data can be used to create readable weather reports
24 and/or process the data in applications.
25
27 How you might use this
28 Here is how you might use the Geo::METAR module.
29
30 One use that I have had for this module is to query the NWS METAR page
31 (using the LWP modules) at
32 http://weather.noaa.gov/cgi-bin/mgetmetar.pl?cccc=EHSB to get an up-to-
33 date METAR. Then, I scan thru the output, looking for what looks like a
34 METAR string (that's not hard in Perl). Oh, EHSB can be any site
35 location code where there is a reporting station.
36
37 I then pass the METAR into this module and get the info I want. I can
38 then update my webcam page with the current temperature, sky
39 conditions, or whatnot. See for yourself at http://webcam.idefix.net/
40
41 See the BUGS section for a remark about multiple passes with the same
42 Geo::METAR object.
43
44 Functions
45 The following functions are defined in the METAR module. Most of them
46 are public, meaning that you're supposed to use them. Some are private,
47 meaning that you're not supposed to use them -- but I won't stop you.
48 Assume that functions are public unless otherwise documented.
49
50 metar()
51 metar() is the function to whwich you should pass a METAR string.
52 It will take care of decomposing it into its component parts
53 converting the units and so on.
54
55 Example: "$m->metar("KFDY 251450Z 21012G21KT 8SM OVC065 04/M01
56 A3010 RMK 57014");"
57
58 debug()
59 debug() toggles debugging messages. By default, debugging is turned
60 off. Turn it on if you are developing METAR or having trouble with
61 it.
62
63 debug() understands all of the folloing:
64
65 Enable Disable
66 ------ -------
67 1 0
68 'yes' 'no'
69 'on' 'off'
70
71 If you contact me for help, I'll likely ask you for some debugging
72 output.
73
74 Example: "$m->debug(1);"
75
76 dump()
77 dump() will dump the internal data structure for the METAR in a
78 semi-human readable format.
79
80 Example: "$m->dump;"
81
82 version()
83 version() will print out the current version.
84
85 Example: "print $m->version;"
86
87 _tokenize()
88 PRIVATE
89
90 Called internally to break the METAR into its component tokens.
91
92 _process()
93 PRIVATE
94
95 Used to make sense of the tokens found in _tokenize().
96
97 Variables
98 After you've called metar(), you'd probably like to get at the
99 individual values for things like temperature, dew point, and so on.
100 You do that by accessing individual variables via the METAR object.
101
102 This section lists those variables and what they represent.
103
104 If you call dump(), you'll find that it spits all of these out.
105
106 VERSION
107 The version of METAR.pm that you're using.
108
109 METAR
110 The actual, raw METAR.
111
112 TYPE
113 Report type in English ("Routine Weather Report" or "Special
114 Weather Report")
115
116 SITE
117 4-letter site code.
118
119 DATE
120 The date (just the day of the month) on which the report was
121 issued.
122
123 TIME
124 The time at which the report was issued.
125
126 MOD Modifier (AUTO/COR) if any.
127
128 WIND_DIR_ENG
129 The current wind direction in english (Southwest, East, North,
130 etc.)
131
132 WIND_DIR_ABB
133 The current wind direction in abbreviated english (S, E, N, etc.)
134
135 WIND_DIR_DEG
136 The current wind direction in degrees.
137
138 WIND_KTS
139 The current wind speed in Knots.
140
141 WIND_MPH
142 The current wind speed in Miles Per Hour.
143
144 WIND_GUST_KTS
145 The current wind gusting speed in Knots.
146
147 WIND_GUST_MPH
148 The current wind gusting speed in Miles Per Hour.
149
150 WIND_VAR
151 The wind variation in English
152
153 WIND_VAR_1
154 The first wind variation direction
155
156 WIND_VAR_2
157 The second wind variation direction
158
159 VISIBILITY
160 Visibility information.
161
162 WIND
163 Wind information.
164
165 RUNWAY
166 Runway information.
167
168 WEATHER
169 Current weather (array)
170
171 WEATHER_LOG
172 Current weather log (array)
173
174 SKY Current cloud cover (array)
175
176 TEMP_C
177 Temperature in Celsius.
178
179 TEMP_F
180 Temperature in Fahrenheit.
181
182 DEW_C
183 Dew point in Celsius.
184
185 DEW_F
186 Dew point in Fahrenheit.
187
188 HOURLY_TEMP_F
189 Hourly current temperature, fahrenheit
190
191 HOURLY_TEMP_C
192 Hourly current temperature, celcius
193
194 HOURLY_DEW_F
195 Hourly dewpoint, fahrenheit
196
197 HOURLY_DEW_C
198 Hourly dewpoint, celcius
199
200 ALT Altimeter setting (barometric pressure).
201
202 REMARKS
203 Any remarks in the report.
204
206 Test suite is small and incomplete. Needs work yet.
207
208 Older versions of this module were installed as "METAR" instaed of
209 "Geo::METAR"
210
212 The Geo::METAR is only initialized once, which means you'll get left-
213 over crud in variables when you call the metar() function twice.
214
215 What is an invalid METAR in one country is a standard one in the next.
216 The standard is interpreted and used by meteorologists all over the
217 world, with local variations. This means there will always be METARs
218 that will trip the parser.
219
221 There is a TODO file included in the Geo::METAR distribution listing
222 the outstanding tasks that I or others have devised. Please check that
223 list before you submit a bug report or request a new feture. It might
224 already be on the TODO list.
225
227 Copyright 1997-2000, Jeremy D. Zawodny <Jeremy [at] Zawodny.com>
228
229 Copyright 2007, Koos van den Hout <koos@kzdoos.xs4all.nl>
230
231 Geo::METAR is covered under the GNU Public License (GPL) version 2 or
232 later.
233
234 The Geo::METAR Web site is located at:
235
236 http://idefix.net/~koos/perl/Geo-METAR/
237
239 In addition to our work on Geo::METAR, We've received ideas, help, and
240 patches from the following folks:
241
242 * Ethan Dicks <ethan.dicks [at] gmail.com>
243
244 Testing of Geo::METAR at the South Pole. Corrections and pointers
245 to interesting cases to test.
246
247 * Otterboy <jong [at] watchguard.com>
248
249 Random script fixes and initial debugging help
250
251 * Remi Lefebvre <remi [at] solaria.dhis.org>
252
253 Debian packaging as libgeo-metar-perl.deb.
254
255 * Mike Engelhart <mengelhart [at] earthtrip.com>
256
257 Wind direction naming corrections.
258
259 * Michael Starling <mstarling [at] logic.bm>
260
261 Wind direction naming corrections.
262
263 * Hans Einar Nielssen <hans.einar [at] nielssen.com>
264
265 Wind direction naming corrections.
266
267 * Nathan Neulinger <nneul [at] umr.edu>
268
269 Lots of enhancements and corrections. Too many to list here.
270
272 lcdproc at http://www.lcdproc.org/ uses Geo::METAR in lcdmetar.pl to
273 display weather data on an lcd.
274
275
276
277perl v5.28.0 2008-01-02 METAR(3)