File: librarydoc.txt

package info (click to toggle)
python-pymetar 0.12-2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 148 kB
  • ctags: 79
  • sloc: python: 737; makefile: 36
file content (285 lines) | stat: -rw-r--r-- 10,164 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
Help on module pymetar:

NAME
    pymetar - Pymetar v0.12 (c) 2002-2004 Tobias Klausmann

FILE
    pymetar.py

DESCRIPTION
    Pymetar is a python module and command line tool designed to fetch Metar
    reports from the NOAA (http://www.noaa.gov) and allow access to the
    included weather information.
    
    This program is free software; you can redistribute it and/or modify it
    under the terms of the GNU General Public License as published by the
    Free Software Foundation; either version 2 of the License, or (at your
    option) any later version.
    
    This program is distributed in the hope that it will be useful, but
    WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    General Public License for more details.
    
    You should have received a copy of the GNU General Public License along
    with this program; if not, write to the Free Software Foundation, Inc.,
    59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
    
    Please e-mail bugs to: klausman-pymetar@schwarzvogel.de

CLASSES
    exceptions.Exception
        EmptyIDException
        EmptyReportException
        NetworkException
    ReportFetcher
    ReportParser
    WeatherReport
    
    class EmptyIDException(exceptions.Exception)
     |  Methods defined here:
     |  
     |  __init__(self, args=None)
     |  
     |  ----------------------------------------------------------------------
     |  Methods inherited from exceptions.Exception:
     |  
     |  __getitem__(...)
     |  
     |  __str__(...)
    
    class EmptyReportException(exceptions.Exception)
     |  Methods defined here:
     |  
     |  __init__(self, args=None)
     |  
     |  ----------------------------------------------------------------------
     |  Methods inherited from exceptions.Exception:
     |  
     |  __getitem__(...)
     |  
     |  __str__(...)
    
    class NetworkException(exceptions.Exception)
     |  Methods defined here:
     |  
     |  __init__(self, args=None)
     |  
     |  ----------------------------------------------------------------------
     |  Methods inherited from exceptions.Exception:
     |  
     |  __getitem__(...)
     |  
     |  __str__(...)
    
    class ReportFetcher
     |  Fetches a report from a given METAR id, optionally taking into
     |  account a different baseurl and using environment var-specified 
     |  proxies.
     |  
     |  Methods defined here:
     |  
     |  FetchReport(self, StationCode=None, proxy=None)
     |      Fetch a report for a given station ID from the baseurl given
     |      upon creation of the ReportFetcher instance.
     |      If proxy is not None, a proxy URL of the form
     |      protocol://user:password@host.name.tld:port/
     |      is expected, for example:
     |      http://squid.somenet.com:3128/
     |      If no proxy is specified, the environment variable http_proxy 
     |      is inspected. If it isn't set, a direct connection is tried.
     |  
     |  __init__(self, MetarStationCode=None, baseurl='http://weather.noaa.gov/pub/data/observations/metar/decoded/')
     |      Set stationid attribute and base URL to fetch report from
    
    class ReportParser
     |  Parse raw METAR data from a WeatherReport object into actual 
     |  values and return the object with the values filled in.
     |  
     |  Methods defined here:
     |  
     |  ParseReport(self, MetarReport=None)
     |      Take report with raw info only and return it with in 
     |      parsed values filled in. Note: This function edits the
     |      WeatherReport object you supply!
     |  
     |  __init__(self, MetarReport=None)
     |      Set attribute Report as specified on instantation.
     |  
     |  extractCloudInformation(self)
     |      Extract cloud information. Return None or a tuple (sky type as a
     |      string of text and suggested pixmap name)
     |  
     |  extractSkyConditions(self)
     |      Extract sky condition information from the encoded report. Return 
     |      a tuple containing the description of the sky conditions as a 
     |      string and a suggested pixmap name for an icon representing said 
     |      sky condition.
     |  
     |  match_WeatherPart(self, regexp)
     |      Return the matching part of the encoded Metar report.  
     |      regexp: the regexp needed to extract this part.  
     |      Return the first matching string or None.  
     |      WARNING: Some Metar reports may contain several matching 
     |      strings, only the first one is taken into account!
     |  
     |  parseLatLong(self, latlong)
     |      Parse Lat or Long in METAR notation into float values. N and E 
     |      are +, S and W are -. Expects one positional string and returns 
     |      one float value.
     |  
     |  strreverse(self, str)
     |      Reverse a string
    
    class WeatherReport
     |  Incorporates both the unparsed textual representation of the
     |  weather report and the parsed values as soon as they are filled 
     |  in by ReportParser.
     |  
     |  Methods defined here:
     |  
     |  __init__(self, MetarStationCode=None)
     |      Clear all fields and fill in wanted station id.
     |  
     |  getCycle(self)
     |      Return cycle value.
     |      The cycle value is not the frequency or delay between 
     |      observations but the "time slot" in which the observation was made. 
     |      There are 24 cycle slots every day which usually last from N:45 to 
     |      N+1:45. The cycle from 23:45 to 0:45 is cycle 0.
     |  
     |  getDewPointCelsius(self)
     |      Return dewpoint in degrees Celsius.
     |  
     |  getDewPointFahrenheit(self)
     |      Return dewpoint in degrees Fahrenheit.
     |  
     |  getFullReport(self)
     |      Return the complete weather report.
     |  
     |  getHumidity(self)
     |      Return relative humidity in percent.
     |  
     |  getISOTime(self)
     |      Return the time when the observation was made in ISO 8601 format
     |      (e.g. 2002-07-25 15:12:00Z)
     |  
     |  getPixmap(self)
     |      Return a suggested pixmap name, without extension, depending on 
     |      current weather.
     |  
     |  getPressure(self)
     |      Return pressure in hPa.
     |  
     |  getRawMetarCode(self)
     |      Return the encoded weather report.
     |  
     |  getReportURL(self)
     |      Return the URL from which the report was fetched.
     |  
     |  getSkyConditions(self)
     |      Return sky conditions
     |  
     |  getStationAltitude(self)
     |      Return the station's altitude above the sea in meters.
     |  
     |  getStationCity(self)
     |      Return city-part of station name
     |  
     |  getStationCountry(self)
     |      Return country-part of station name
     |  
     |  getStationLatitude(self)
     |      Return the station's latitude in dd-mm[-ss]D format :
     |      dd : degrees
     |      mm : minutes
     |      ss : seconds
     |      D : direction (N, S, E, W)
     |  
     |  getStationLatitudeFloat(self)
     |      Return latitude as a float
     |  
     |  getStationLongitude(self)
     |      Return the station's longitude in dd-mm[-ss]D format :
     |      dd : degrees
     |      mm : minutes
     |      ss : seconds
     |      D : direction (N, S, E, W)
     |  
     |  getStationLongitudeFloat(self)
     |      Return Longitude as a float
     |  
     |  getStationName(self)
     |      Return full station name
     |  
     |  getStationPosition(self)
     |      Return latitude, longitude and altitude above sea level of station
     |      as a tuple. Some stations don't deliver altitude, for those, None 
     |      is returned as altitude.  The lat/longs are expressed as follows:
     |      xx-yyd
     |      where xx is degrees, yy minutes and d the direction.
     |      Thus 51-14N means 51 degrees, 14 minutes north.  d may take the 
     |      values N, S for latitues and W, E for longitudes. Latitude and 
     |      Longitude may include seconds.  Altitude is always given as meters 
     |      above sea level, including a trailing M.
     |      Schipohl Int. Airport Amsterdam has, for example:
     |      ('52-18N', '004-46E', '-2M')
     |      Moenchengladbach (where I live):
     |      ('51-14N', '063-03E', None)
     |      If you need lat and long as float values, look at 
     |      getStationPositionFloat() instead
     |  
     |  getStationPositionFloat(self)
     |      Return latitude and longitude as float values in a 
     |      tuple (lat,long,alt).
     |  
     |  getTemperatureCelsius(self)
     |      Return the temperature in degrees Celsius.
     |  
     |  getTemperatureFahrenheit(self)
     |      Return the temperature in degrees Fahrenheit.
     |  
     |  getTime(self)
     |      Return the time when the observation was made.  Note that this 
     |      is *not* the time when the report was fetched by us
     |      Format:  YYYY.MM.DD HHMM UTC
     |      Example: 2002.04.01 1020 UTC
     |  
     |  getVisibilityKilometers(self)
     |      Return visibility in km.
     |  
     |  getVisibilityMiles(self)
     |      Return visibility in miles.
     |  
     |  getWeather(self)
     |      Return short weather conditions
     |  
     |  getWindCompass(self)
     |      Return wind direction as compass direction
     |      (e.g. NE or SSE)
     |  
     |  getWindDirection(self)
     |      Return wind direction in degrees.
     |  
     |  getWindSpeed(self)
     |      Return the wind speed in meters per second.
     |  
     |  getWindSpeedMilesPerHour(self)
     |      Return the wind speed in miles per hour.
     |  
     |  metar_to_iso8601(self, metardate)
     |      Convert a metar date to an ISO8601 date.

DATA
    CLOUD_RE_STR = '^(CLR|SKC|BKN|SCT|FEW|OVC)([0-9]{3})?$'
    COND_RE_STR = r'^(-|\\+)?(VC|MI|BC|PR|TS|BL|SH|DR|FZ)?(DZ|RA|SN|...S|U...
    __author__ = 'klausman-pymetar@schwarzvogel.de'
    __version__ = '0.12'

VERSION
    0.12

AUTHOR
    klausman-pymetar@schwarzvogel.de