• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

bin/H03-May-2022-1,2581,032

pymetar.egg-info/H03-May-2022-9877

testing/smoketest/H15-Oct-2021-1,3871,116

.gitignoreH A D14-Aug-201894 87

COPYINGH A D27-Aug-201617.7 KiB341282

MANIFESTH A D27-Aug-201679 98

MANIFEST.inH A D27-Aug-201667 21

PKG-INFOH A D15-Oct-20213.9 KiB9877

README.mdH A D13-Aug-20183.4 KiB8163

THANKSH A D22-Jan-20111.4 KiB2523

pymetar.1H A D29-Aug-20191.6 KiB4945

pymetar.pyH A D15-Oct-202136.9 KiB1,126924

pymetar.ronnH A D29-Aug-20191.4 KiB4831

setup.cfgH A D15-Oct-202138 53

setup.pyH A D03-May-20221.3 KiB4022

README.md

1# PyMETAR - a module to fetch and parse METAR reports
2
3**NOTE:** If you're looking for information regarding Python 2 and PyMETAR, see
4the end of this document.
5
6The National Oceanic and Atmospheric Administration (NOAA, http://www.noaa.gov/)
7provides easy access to the weather reports generated by a large number of
8weather stations (mostly at airports) worldwide. Those reports are called METAR
9reports and are delivered as plain text files that look like this:
10
11```
12Duesseldorf, Germany (EDDL) 51-18N 006-46E 41M
13Jul 26, 2002 - 03:50 AM EST / 2002.07.26 0850 UTC
14Wind: from the SW (220 degrees) at 9 MPH (8 KT):0
15Visibility: 3 mile(s):0
16Sky conditions: mostly cloudy
17Weather: mist
18Temperature: 60 F (16 C)
19Dew Point: 57 F (14 C)
20Relative Humidity: 87%
21Pressure (altimeter): 30.00 in. Hg (1016 hPa)
22ob: EDDL 260850Z 22008KT 5000 BR SCT006 BKN012 16/14 Q1016 BECMG BKN015
23cycle: 9
24```
25
26While this is convenient if you just want to quickly look up the data, there's
27some effort involved in parsing all of this into a format that is digestible by
28a program. Plus, you have to remember the base URL of the reports and fetch the
29file.
30
31This is what this library does. All you have to do is find the station you're
32interested in at http://www.aviationweather.gov/metar and feed the 4-letter
33station code to the MetarReport class.
34
35On the user end, the library provides a large number of methods to fetch the
36parsed information in a plethora of formats. Those functions are described in
37the file `librarydoc.txt` which was in turn generated using PyDoc.
38
39PyMETAR uses `urllib2` (and its successors), which in turn makes it easy to honor
40the environment variable `http_proxy`. This simplifies use of a proxy
41tremendously. Thanks go to Davide Di Blasi for both suggesting and implementing
42this. The environment variable is easy to use: just set it to:
43
44```
45http://username:password@proxy.yourdomain.com:port
46```
47
48You can also specify a proxy (with the same syntax) as an argument to the
49fetching function. This is sometimes easier when using PyMETAR in a web
50application environment (such as ZopeWeatherApplet by Jerome Alet). See
51`librarydoc.txt` for details on how to accomplish that.
52
53You can also use IPs instead of hostnames, of course. When in doubt, ask your
54proxy admin.
55
56Due to some peculiarities in the METAR format, I can not rule out the
57possibility that the library barfs on some less common types of reports. If you
58encounter such a report, please save it and the error messages you get as
59completely as possible and send them to me at `klausman-pymetar@schwarzvogel.de`
60--- Thanks a lot!
61
62Of course you may send all the other bugs you encounter to me, too. As this is a
63Python library, chances are that you are Python programmer and can provide a
64patch. If you do so, please, by all means use spaces for indentation, four per
65level, that makes merging the patch a lot easier.
66
67## Python 2, 3, PyPy, PyPy3 and so on
68
69This version of PyMETAR supports Python 3.x and PyPy3 only. The last version to
70have Python2 as its main target was v0.21.
71
72Compatibility with PyPy (2.x), Jython and other interpreters not mentioned
73above is unknown.
74
75I maintain a branch (called Python2) on git which is the state of Pymetar as it
76was for the last version supporting Python 2. That branch is in maintenance
77mode, i.e. it will only receive fixes for security issues or bugs that can be
78fixed without too much fuss. That branch will go away in 2020.
79
80[0] http://python-future.org/
81