Beispiel #1
0
 def test_metar(self):
     """
     Tests end-to-end METAR translation
     """
     units = structs.Units(**static.core.NA_UNITS)
     data = {
         "altimeter":
         core.make_number("29.92", "2992"),
         "clouds": [core.make_cloud("BKN015CB")],
         "dewpoint":
         core.make_number("M01"),
         "other": [],
         "temperature":
         core.make_number("03"),
         "visibility":
         core.make_number("3"),
         "wind_direction":
         core.make_number("360"),
         "wind_gust":
         core.make_number("20"),
         "wind_speed":
         core.make_number("12"),
         "wind_variable_direction": [
             core.make_number("340"),
             core.make_number("020"),
         ],
         "wx_codes":
         get_wx_codes(["+RA"])[1],
     }
     data.update({
         k: ""
         for k in (
             "raw",
             "remarks",
             "station",
             "time",
             "flight_rules",
             "remarks_info",
             "runway_visibility",
             "sanitized",
         )
     })
     data = structs.MetarData(**data)
     trans = structs.MetarTrans(
         altimeter="29.92 inHg (1013 hPa)",
         clouds="Broken layer at 1500ft (Cumulonimbus) - Reported AGL",
         dewpoint="-1°C (30°F)",
         remarks={},
         temperature="3°C (37°F)",
         visibility="3sm (4.8km)",
         wind="N-360 (variable 340 to 020) at 12kt gusting to 20kt",
         wx_codes="Heavy Rain",
     )
     translated = translate.metar.translate_metar(data, units)
     self.assertIsInstance(translated, structs.MetarTrans)
     self.assertEqual(translated, trans)
Beispiel #2
0
 def test_metar(self):
     """
     Tests end-to-end METAR translation
     """
     units = structs.Units(**static.NA_UNITS)
     data = {
         'altimeter':
         core.make_number('2992'),
         'clouds': [core.make_cloud('BKN015CB')],
         'dewpoint':
         core.make_number('M01'),
         'other': ['+RA'],
         'temperature':
         core.make_number('03'),
         'visibility':
         core.make_number('3'),
         'wind_direction':
         core.make_number('360'),
         'wind_gust':
         core.make_number('20'),
         'wind_speed':
         core.make_number('12'),
         'wind_variable_direction':
         [core.make_number('340'),
          core.make_number('020')]
     }
     data.update({
         k: ''
         for k in ('raw', 'remarks', 'station', 'time', 'flight_rules',
                   'remarks_info', 'runway_visibility', 'sanitized')
     })
     data = structs.MetarData(**data)
     trans = structs.MetarTrans(
         altimeter='29.92 inHg (1013 hPa)',
         clouds='Broken layer at 1500ft (Cumulonimbus) - Reported AGL',
         dewpoint='-1°C (30°F)',
         other='Heavy Rain',
         remarks={},
         temperature='3°C (37°F)',
         visibility='3sm (4.8km)',
         wind='N-360 (variable 340 to 020) at 12kt gusting to 20kt')
     translated = translate.metar(data, units)
     self.assertIsInstance(translated, structs.MetarTrans)
     self.assertEqual(translated, trans)
Beispiel #3
0
 def test_metar(self):
     """Tests that METAR translations are summarized in the proper order"""
     self.assertEqual(
         summary.metar(
             structs.MetarTrans(
                 altimeter="29.92 inHg (1013 hPa)",
                 clouds=
                 "Broken layer at 1500ft (Cumulonimbus) - Reported AGL",
                 dewpoint="-1°C (30°F)",
                 remarks={},
                 temperature="3°C (37°F)",
                 visibility="3sm (4.8km)",
                 wind="N-360 (variable 340 to 020) at 12kt gusting to 20kt",
                 wx_codes="Heavy Rain",
             )),
         ("Winds N-360 (variable 340 to 020) at 12kt gusting to 20kt, "
          "Vis 3sm, Temp 3°C, Dew -1°C, Alt 29.92 inHg, "
          "Heavy Rain, Broken layer at 1500ft (Cumulonimbus)"),
     )
Beispiel #4
0
 def test_metar(self):
     """
     Tests that METAR translations are summarized in the proper order
     """
     self.assertEqual(
         summary.metar(
             structs.MetarTrans(
                 altimeter='29.92 inHg (1013 hPa)',
                 clouds=
                 'Broken layer at 1500ft (Cumulonimbus) - Reported AGL',
                 dewpoint='-1°C (30°F)',
                 other='Heavy Rain',
                 remarks={},
                 temperature='3°C (37°F)',
                 visibility='3sm (4.8km)',
                 wind='N-360 (variable 340 to 020) at 12kt gusting to 20kt')
         ), ('Winds N-360 (variable 340 to 020) at 12kt gusting to 20kt, '
             'Vis 3sm, Temp 3°C, Dew -1°C, Alt 29.92 inHg, '
             'Heavy Rain, Broken layer at 1500ft (Cumulonimbus)'))