Help on module pymetar: NAME pymetar - Pymetar v0.14 (c) 2002-2008 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(exceptions.BaseException) EmptyIDException EmptyReportException NetworkException ReportFetcher ReportParser WeatherReport class EmptyIDException(exceptions.Exception) | This gets thrown when the ReportFetcher is called with an empty ID class EmptyReportException(exceptions.Exception) | This gets thrown when the ReportParser gets fed an empty report class NetworkException(exceptions.Exception) | This gets thrown when a network error occurs 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. | | GetReport(self) | Get a previously fetched report again | | MakeReport(self, StationID, RawReport) | Take a string (RawReport) and a station code and turn it | into an object suitable for ReportParser | | __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! 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. | | getWindSpeedBeaufort(self) | Return the wind speed in the Beaufort scale | cf. http://en.wikipedia.org/wiki/Beaufort_scale | | getWindSpeedMilesPerHour(self) | Return the wind speed in miles per hour. FUNCTIONS metar_to_iso8601(metardate) Convert a metar date to an ISO8601 date. parseLatLong(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. DATA CLOUD_RE_STR = '^(CLR|SKC|BKN|SCT|FEW|OVC|NSC)([0-9]{3})?$' COND_RE_STR = '^(-|\\\\+)?(VC|MI|BC|PR|TS|BL|SH|DR|FZ)?\\\n(DZ|RA|S...... __author__ = 'klausman-pymetar@schwarzvogel.de' __revision__ = '80' __version__ = '0.14' VERSION 0.14 AUTHOR klausman-pymetar@schwarzvogel.de