예제 #1
0
 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)
예제 #2
0
 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)
예제 #3
0
    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
예제 #4
0
 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()
예제 #5
0
 def _post_update(self):
     self.data, self.units = metar.parse(self.station, self.raw)
     self.translations = translate.metar(self.data, self.units)
예제 #6
0
 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()