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.
23
25 How you might use this
26
27 Here is how you might use the Geo::METAR module.
28
29 One use that I have had for this module is to query the NWS METAR page
30 (using the LWP modules) at http://weather.noaa.gov/cgi-bin/mget‐
31 metar.pl?cccc=KFDY to get an up-to-date METAR. Then, I scan thru the
32 output, looking for what looks like a METAR string (that's not hard in
33 Perl). Oh, KFDY can be any site location code where there is a report‐
34 ing station.
35
36 I then pass the METAR into this module and get the info I want. I can
37 then update my home page with the current temperature, sky conditions,
38 or whatnot.
39
40 Functions
41
42 The following functions are defined in the AcctInfo module. Most of
43 them are public, meaning that you're supposed to use them. Some are
44 private, meaning that you're not supposed to use them -- but I won't
45 stop you. Assume that functions are public unless otherwise documented.
46
47 metar()
48 metar() is the function to whwich you should pass a METAR string.
49 It will take care of decomposing it into its component parts con‐
50 verting the units and so on.
51
52 Example: "$m->metar("KFDY 251450Z 21012G21KT 8SM OVC065 04/M01
53 A3010 RMK 57014");"
54
55 debug()
56 debug() toggles debugging messages. By default, debugging is turned
57 off. Turn it on if you are developing METAR or having trouble with
58 it.
59
60 debug() understands all of the folloing:
61
62 Enable Disable
63 ------ -------
64 1 0
65 'yes' 'no'
66 'on' 'off'
67
68 If you contact me for help, I'll likely ask you for some debugging
69 output.
70
71 Example: "$m->debug(1);"
72
73 dump()
74 dump() will dump the internal data structure for the METAR in a
75 semi-human readable format.
76
77 Example: "$m->dump;"
78
79 version()
80 version() will print out the current version.
81
82 Example: "print $m->version;"
83
84 _tokenize()
85 PRIVATE
86
87 Called internally to break the METAR into its component tokens.
88
89 _process()
90 PRIVATE
91
92 Used to make sense of the tokens found in _tokenize().
93
94 Variables
95
96 After you've called metar(), you'd probably like to get at the individ‐
97 ual values for things like temperature, dew point, and so on. You do
98 that by accessing individual variables via the METAR object.
99
100 This section lists those variables and what they represent.
101
102 If you call dump(), you'll find that it spits all of these out in
103 roughly this order, too.
104
105 VERSION
106 The version of METAR.pm that you're using.
107
108 METAR
109 The actual, raw METAR.
110
111 TYPE
112 Report type: "METAR or SPECI".
113
114 SITE
115 4-letter site code.
116
117 DATE
118 The date on which the report was issued.
119
120 TIME
121 The time at which the report was issued.
122
123 MOD Modifier (AUTO/COR) if any.
124
125 WIND_DIR_ENG
126 The current wind direction in english (Southwest, East, North,
127 etc.)
128
129 WIND_DIR_DEG
130 The current wind direction in degrees.
131
132 WIND_KTS
133 The current wind speed in Knots.
134
135 WIND_MPH
136 The current wind speed in Miles Per Hour.
137
138 WIND_GUST_KTS
139 The current wind gusting speed in Knots.
140
141 WIND_GUST_MPH
142 The current wind gusting speed in Miles Per Hour.
143
144 VISIBILITY
145 Visibility information.
146
147 WIND
148 Wind information.
149
150 RUNWAY
151 Runway information.
152
153 WEATHER
154 Current weather.
155
156 SKY Current sky conditions.
157
158 TEMP_C
159 Temperature in Celsius.
160
161 TEMP_F
162 Temperature in Farenheit.
163
164 C_DEW
165 Dew point in Celsius.
166
167 F_DEW
168 Dew point in Farenheit.
169
170 ALT Altimeter setting (barometric pressure).
171
172 REMARKS
173 Any remarks in the report.
174
176 Test suite is small and incomplete. Needs work yet.
177
178 Older versions of this module were installed as "METAR" instaed of
179 "Geo::METAR"
180
181 Adding a find() method.
182
183 I should add a function called find() which can be passed a big chunk
184 of text (or a ref to one) and a site identifier. It will scan through
185 the text and find the METAR. The result can be fed back into this mod‐
186 ule for processing.
187
188 That'd be cool, I think.
189
191 There currently aren't any known BUGS (features which don't work as
192 advetised). There are lacking features. See the TODO section for more
193 on that.
194
196 There is a TODO file included in the Geo::METAR distribution listing
197 the outstanding tasks that I or others have devised. Please check that
198 list before you submit a bug report or request a new feture. It might
199 already be on the TODO list.
200
202 Copyright 1997-2000, Jeremy D. Zawodny <Jeremy@Zawodny.com>
203
204 Geo::METAR is covered under the GNU Public License (GPL) version 2 or
205 later.
206
207 The Geo::METAR Web site is located at:
208
209 http://www.wcnet.org/~jzawodn/perl/Geo-METAR/
210
212 In addition to my work on Geo::METAR, I've received ideas, help, and
213 patches from the following folks:
214
215 * Otterboy <jong@watchguard.com>
216
217 Random script fixes and initial debugging help
218
219 * Remi Lefebvre <remi@solaria.dhis.org>
220
221 Debian packaging as libgeo-metar-perl.deb.
222
223 * Mike Engelhart <mengelhart@earthtrip.com>
224
225 Wind direction naming corrections.
226
227 * Michael Starling <mstarling@logic.bm>
228
229 Wind direction naming corrections.
230
231 * Hans Einar Nielssen <hans.einar@nielssen.com>
232
233 Wind direction naming corrections.
234
235 * Nathan Neulinger <nneul@umr.edu>
236
237 Lots of enhancements and corrections. Too many to list here.
238
239
240
241perl v5.8.8 2000-11-24 METAR(3)