def test_corrected(dbcursor): """Test that the COR does not get dropped from the raw METAR.""" code = ( "KSAT 121751Z COR VRB03KT 10SM SCT043 32/19 A3002 RMK AO2 SLP144 " "T03220194 10328 20228 58011 $=" ) mtr = metarcollect.METARReport(code, year=2020, month=10) iemob, _ = mtr.to_iemaccess(dbcursor) assert mtr.code == iemob.data["raw"]
def test_issue89_peakwind(dbcursor): """Are we roundtripping peak wind.""" code = ( "KALO 010001Z AUTO 17027G37KT 10SM FEW030 SCT110 19/16 A2979 RMK AO2 " "PK WND 18049/2025 RAE48 SLP088 P0005 60014 T01890156 58046" ) mtr = metarcollect.METARReport(code, year=2017, month=1) iemob, _ = mtr.to_iemaccess(dbcursor) assert iemob.data["peak_wind_time"] == utc(2016, 12, 31, 20, 25)
def test_190118_ice(dbcursor): """Process a ICE Report.""" mtr = metarcollect.METARReport( ( "KABI 031752Z 30010KT 6SM BR FEW009 OVC036 02/01 A3003 RMK AO2 " "SLP176 60001 I1000 T00170006 10017 21006 56017" ) ) assert mtr.ice_accretion_1hr is not None iemob, _ = mtr.to_iemaccess(dbcursor) assert iemob.data["ice_accretion_1hr"] == TRACE_VALUE
def test_metarreport(self): """Can we do things with the METARReport""" utcnow = datetime.datetime(2013, 8, 8, 12, 53).replace(tzinfo=pytz.utc) mtr = metarcollect.METARReport(('SPECI CYYE 081253Z 01060G60KT 1/4SM ' 'FG SKC 10/10 A3006 RMK P0000 ' 'FG6 SLP188=')) mtr.time = utcnow mtr.iemid = 'CYYE' mtr.network = 'CA_BC_ASOS' iemob, _ = mtr.to_iemaccess(self.cursor) self.assertEqual(iemob.data['station'], 'CYYE') self.assertEqual(iemob.data['phour'], 0.0001) self.assertEquals(mtr.wind_message(), "gust of 60 knots (69.1 mph) from N @ 1253Z")
def test_metarreport(dbcursor): """Can we do things with the METARReport""" utcnow = utc(2013, 8, 8, 12, 53) mtr = metarcollect.METARReport( ( "SPECI CYYE 081253Z 01060KT 1/4SM FG SKC 10/10 A3006 RMK P0000 " "FG6 SLP188=" ) ) assert mtr.wind_gust is None mtr.time = utcnow mtr.iemid = "CYYE" mtr.network = "CA_BC_ASOS" iemob, _ = mtr.to_iemaccess(dbcursor) assert iemob.data["station"] == "CYYE" assert iemob.data["phour"] == TRACE_VALUE assert mtr.wind_message() == "gust of 0 knots (0.0 mph) from N @ 1253Z" # can we round trip the gust iemob.load(dbcursor) assert iemob.data["gust"] is None