Skip to content

Commit

Permalink
Metar RAE support.
Browse files Browse the repository at this point in the history
  • Loading branch information
joanpc committed Mar 27, 2015
1 parent c08d03d commit 7daed8d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions noaweather/metar.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Metar:
RE_PRESSURE = re.compile(r'\b(Q|QNH|SLP|A)[ ]?([0-9]{3,4})\b')
RE_TEMPERATURE = re.compile(r'\b(M|-)?([0-9]{1,2})/(M|-)?([0-9]{1,2})\b')
RE_TEMPERATURE2 = re.compile(r'\bT(0|1)([0-9]{3})(0|1)([0-9]{3})\b')
RE_PRECIPITATION = re.compile('(-|\+)?(RE)?(DZ|SG|IC|PL|SH)?(DZ|RA|SN|TS)(NO)?')
RE_PRECIPITATION = re.compile('(-|\+)?(RE)?(DZ|SG|IC|PL|SH)?(DZ|RA|SN|TS)(NO|E)?')

METAR_STATIONS_URL = 'http://www.aviationweather.gov/static/adds/metars/stations.txt'
VATSIM_METAR_STATIONS_URL = 'http://metar.vatsim.net/metar.php?id=all'
Expand Down Expand Up @@ -334,7 +334,9 @@ def parseMetar(self, icao, metar, airport_msl = 0):
precipitation = {}
for precp in self.RE_PRECIPITATION.findall(metar):
intensity, recent, mod, kind, neg = precp
if not neg:
if neg == 'E':
recent = 'RE'
if neg != 'NO':
precipitation[kind] = {'int': intensity ,'mod': mod, 'recent': recent}

weather['precipitation'] = precipitation
Expand Down

0 comments on commit 7daed8d

Please sign in to comment.