foo bar

Danny's Code Dump


This is where I keep my code when I'm too lazy to package it properly. You can use it for your own purposes, but you may not re-distribute it. All rights are reserved, with the exception that it is always allowed to re-license code on this page that I wrote myself under the GPL (GNU General Public License), version 2 only. Code re-licensed under the GPL may be re-distributed.
df.code@notabilis.org

Click here to return to Danny's code dump.

METAR.py
A python class that can fetch METAR records from the NOAA archive and decode them. ICAO airport codes are classified by geographical area (nation, continent); this class neither knows the full name nor the precise location of an airport.

For example, the following METAR record:

PASP 081554Z 00000KT 5SM -SN OVC060 M12/M14 A2987 RMK ESTIMATED PASS OPEN NOSPECI
Yields the following output:
clouds       = OVC060 (overcast 1828.8m)
temperature  = M12/M14 (-12)
visibility   = 5SM
airport      = PASP (Alaska, Northern Pacific)
weather      = -SN (light snow)
time         = 081554Z
wind         = 00000KT
dewpoint_parsed = -14
METAR        = PASP 081554Z 00000KT 5SM -SN OVC060 M12/M14 A2987 RMK ESTIMATED PASS OPEN NOSPECI
period       = 2007020816
Download: METAR.tar.gz (4.58KiB gzipped tarball, MD5: 80267d872cf0c4a33ba1b29b01f3fab8)