def test_parse(self): """ Tests returned structs from the parse function """ report = 'KJFK 032151Z 16008KT 10SM FEW034 FEW130 BKN250 27/23 A3013 RMK AO2 SLP201' data, units = metar.parse(report[:4], report) self.assertIsInstance(data, structs.MetarData) self.assertIsInstance(units, structs.Units) self.assertEqual(data.raw, report)
def test_parse(self): """ Tests returned structs from the parse function """ report = 'KJFK 032151Z 16008KT 10SM FEW034 FEW130 BKN250 27/23 A3013 RMK AO2 SLP201' data, units = metar.parse(report[:4], report) self.assertIsInstance(data, structs.MetarData) self.assertIsInstance(units, structs.Units) self.assertEqual(data.raw, report)
def update(self, report: str = None) -> bool: """Updates raw, data, and translations by fetching and parsing the METAR report Returns True is a new report is available, else False """ if report is not None: self.raw = report else: raw = self.service.fetch(self.station) if raw == self.raw: return False self.raw = raw self.data, self.units = metar.parse(self.station, self.raw) self.translations = translate.metar(self.data, self.units) self.last_updated = datetime.utcnow() return True
def _post_update(self): self.data, self.units = metar.parse(self.station, self.raw) self.translations = translate.metar(self.data, self.units) self.last_updated = datetime.utcnow()
def _post_update(self): self.data, self.units = metar.parse(self.station, self.raw) self.translations = translate.metar(self.data, self.units)
def _post_update(self): self.data, self.units = metar.parse(self.station, self.raw) self.translations = translate.metar(self.data, self.units) self.last_updated = datetime.utcnow()