Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions modules/weather.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,20 @@ def f_weather(self, origin, match, args):
metar[0].endswith('SM')):
visibility = metar[0]
metar = metar[1:]
#Fix to handle whole numbers + fractions which are separated by a space
#From spec located here: http://www.astro.keele.ac.uk/oldusers/rno/Aviation/metar_codes.html
elif (re.match("\d+$", metar[0]) and re.match("\d/\dSM", metar[1])):
visibility = metar[0] + " " + metar[1]
metar = metar[2:]
else: visibility = None

while metar[0].startswith('R') and (metar[0].endswith('L')
or 'L/' in metar[0]):
metar = metar[1:]

#Fix for runway visual range format. I didn't remove the spec above in case it is also valid
while metar[0].startswith('R') and metar[0].endswith('FT'):
metar = metar[1:]

if len(metar[0]) == 6 and (metar[0].endswith('N') or
metar[0].endswith('E') or
Expand Down