From 7daed8d4f95cd7a9f200eea51896a8c292b17258 Mon Sep 17 00:00:00 2001 From: joan Date: Fri, 27 Mar 2015 11:54:20 -0500 Subject: [PATCH] Metar RAE support. --- noaweather/metar.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/noaweather/metar.py b/noaweather/metar.py index dc45054..f1dccc1 100644 --- a/noaweather/metar.py +++ b/noaweather/metar.py @@ -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' @@ -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