add new metar parser and update weather module

This commit is contained in:
mutantmonkey
2013-01-10 20:24:17 -05:00
parent 7622bd3376
commit 83518a8dbc
35 changed files with 397 additions and 352 deletions

2
test/metar/CYUX.TXT Normal file
View File

@@ -0,0 +1,2 @@
2013/01/11 00:28
CYUX 110028Z AUTO 25010KT 6SM -SN BKN043 OVC065 M28/M31 A2975 RMK SLP077

2
test/metar/DNIM.TXT Normal file
View File

@@ -0,0 +1,2 @@
2012/03/31 08:00
DNIM 310800Z 17005KT 9999 NSC 27/24 Q1013

2
test/metar/DXLK.TXT Normal file
View File

@@ -0,0 +1,2 @@
2010/06/18 06:00
DXLK 180600Z 28002KT 9999 FEW016 SCT120 BKN260 24/23 Q1013

2
test/metar/EDDF.TXT Normal file
View File

@@ -0,0 +1,2 @@
2013/01/11 00:20
EDDF 110020Z 21005KT 9999 SCT020 BKN040 BKN070 02/01 Q1010 NOSIG

2
test/metar/EDDH.TXT Normal file
View File

@@ -0,0 +1,2 @@
2013/01/11 00:20
EDDH 110020Z 32008KT 9999 FEW018 BKN050 M00/M02 Q1012 TEMPO 3500 SN BKN010

2
test/metar/EDDM.TXT Normal file
View File

@@ -0,0 +1,2 @@
2013/01/11 00:20
EDDM 110020Z 26008KT 9999 FEW012 SCT033 BKN045 02/01 Q1009 NOSIG

2
test/metar/EDDT.TXT Normal file
View File

@@ -0,0 +1,2 @@
2013/01/10 21:50
EDDT 102150Z 32007KT 9999 FEW014 BKN036 M00/M03 Q1008 TEMPO BKN012

2
test/metar/ENSO.TXT Normal file
View File

@@ -0,0 +1,2 @@
2013/01/10 18:20
ENSO 101820Z VRB01KT 9999 FEW025 00/M01 Q1017

2
test/metar/HEGN.TXT Normal file
View File

@@ -0,0 +1,2 @@
2013/01/11 01:00
HEGN 110100Z 31008KT CAVOK 09/00 Q1025 NOSIG

2
test/metar/KAXN.TXT Normal file
View File

@@ -0,0 +1,2 @@
2013/01/10 21:53
KAXN 102153Z AUTO 16019G24KT 10SM BKN021 03/M06 A2989 RMK AO2 SLP137 T00331056

2
test/metar/KBCB.TXT Normal file
View File

@@ -0,0 +1,2 @@
2013/01/10 20:15
KBCB 102015Z AUTO 07004KT 10SM CLR 14/01 A3046 RMK AO2

2
test/metar/KBIL.TXT Normal file
View File

@@ -0,0 +1,2 @@
2013/01/11 00:20
KBIL 110020Z 05017KT 10SM FEW019 OVC030 M03/M07 A2957 RMK AO2 T10281072

2
test/metar/KCID.TXT Normal file
View File

@@ -0,0 +1,2 @@
2013/01/10 21:52
KCID 102152Z 11013KT 3SM -RA BR OVC015 01/00 A2998 RMK AO2 RAB12 SLP162 P0001 T00110000

2
test/metar/KCXP.TXT Normal file
View File

@@ -0,0 +1,2 @@
2013/01/11 00:35
KCXP 110035Z AUTO 31006KT 10SM FEW043 M02/M13 A2990 RMK AO2

2
test/metar/KDEN.TXT Normal file
View File

@@ -0,0 +1,2 @@
2013/01/10 21:53
KDEN 102153Z 00000KT 10SM SCT150 OVC200 02/M07 A2959 RMK AO2 SLP007 T00221067

2
test/metar/KIAD.TXT Normal file
View File

@@ -0,0 +1,2 @@
2013/01/10 18:52
KIAD 101852Z 35008KT 10SM FEW250 12/M04 A3052 RMK AO2 SLP335 T01221039

2
test/metar/KLAX.TXT Normal file
View File

@@ -0,0 +1,2 @@
2013/01/10 23:53
KLAX 102353Z 28025G31KT 10SM FEW070 SCT110 13/02 A2995 RMK AO2 PK WND 28033/2337 SLP141 T01280022 10150 20122 50002

2
test/metar/KLGA.TXT Normal file
View File

@@ -0,0 +1,2 @@
2013/01/10 23:51
KLGA 102351Z 31007KT 10SM SCT250 07/M04 A3052 RMK AO2 SLP335 T00721039 10089 20072 53014

2
test/metar/KMCO.TXT Normal file
View File

@@ -0,0 +1,2 @@
2013/01/11 00:53
KMCO 110053Z 10005KT 10SM FEW250 20/18 A3029 RMK AO2 SLP255 T02000178

2
test/metar/KMGJ.TXT Normal file
View File

@@ -0,0 +1,2 @@
2013/01/10 23:54
KMGJ 102354Z AUTO 00000KT 10SM CLR 00/M04 A3051 RMK AO2 SLP336 T00001044 10078 21006 53014 TSNO

2
test/metar/KMIA.TXT Normal file
View File

@@ -0,0 +1,2 @@
2013/01/11 00:53
KMIA 110053Z 08011KT 10SM FEW060 SCT250 24/19 A3026 RMK AO2 SLP246 T02390194

2
test/metar/KSAN.TXT Normal file
View File

@@ -0,0 +1,2 @@
2013/01/10 21:51
KSAN 102151Z 30017G22KT 10SM SCT040 BKN060 BKN180 13/01 A3003 RMK AO2 PK WND 28027/2140 SLP167 T01330011

2
test/metar/KSFO.TXT Normal file
View File

@@ -0,0 +1,2 @@
2013/01/11 00:56
KSFO 110056Z 29017KT 10SM FEW033 SCT049 09/02 A3012 RMK AO2 SLP199 T00940017

2
test/metar/LRAR.TXT Normal file
View File

@@ -0,0 +1,2 @@
2013/01/10 18:30
LRAR 101830Z 11003KT 2000 0800N R27/1000VP2000D BCFG SCT005 M02/M02 Q1011 09890392

2
test/metar/MMUN.TXT Normal file
View File

@@ -0,0 +1,2 @@
2013/01/10 23:44
MMUN 102344Z 11007KT 7SM SCT015TCU SCT080 26/23 A3006 RMK SLP178 52010 906 8/230 HZY AS W

2
test/metar/OEMM.TXT Normal file
View File

@@ -0,0 +1,2 @@
2010/07/15 11:00
OEMM 151100Z 02009KT CAVOK 48/01 Q0997

2
test/metar/TBOB.TXT Normal file
View File

@@ -0,0 +1,2 @@
2011/06/09 09:00
TBOB 090900Z 11006KT 9999 SCT014 SCT038 28/25 Q1014 NOSIG

2
test/metar/UUOK.TXT Normal file
View File

@@ -0,0 +1,2 @@
2013/01/10 16:00
UUOK 101600Z 16004MPS 9999 OVC013 M13/M16 Q1014 NOSIG RMK 12CLRD60

2
test/metar/YSSY.TXT Normal file
View File

@@ -0,0 +1,2 @@
2013/01/11 00:30
YSSY 110030Z 05007KT 350V080 CAVOK 28/17 Q1007 NOSIG

2
test/metar/ZBDT.TXT Normal file
View File

@@ -0,0 +1,2 @@
2008/03/23 23:00
ZBDT 232300Z 333004MPS CAVOK M04/M14 Q1020 NOSIG

2
test/metar/ZPLJ.TXT Normal file
View File

@@ -0,0 +1,2 @@
2012/09/28 04:00
ZPLJ 280400Z 24002MPS 210V290 9999 -SHRA FEW023 FEW040TCU SCT040 19/15 Q1026 NOSIG

25
test/test_metar.py Normal file
View File

@@ -0,0 +1,25 @@
"""
Tests for phenny's metar.py
"""
import unittest
import metar
import glob
class MetarTest(unittest.TestCase):
def test_files(self):
for station in glob.glob('test/metar/*.TXT'):
with open(station) as f:
w = metar.parse(f.read())
assert w.station is not None
assert w.time is not None
assert w.cover is not None
assert w.temperature > -100
assert w.temperature < 100
assert w.dewpoint > -100
assert w.dewpoint < 100
assert w.pressure is not None