def test_metar(self): """ Tests converting METAR data into into a single spoken string """ 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', speak='020') ] } data.update({k: None for k in ( 'raw', 'remarks', 'station', 'time', 'flight_rules', 'remarks_info', 'runway_visibility', 'sanitized' )}) data = structs.MetarData(**data) spoken = ('Winds three six zero (variable three four zero to zero two zero) ' 'at 12kt gusting to 20kt. Visibility three miles. ' 'Temperature three degrees Celsius. Dew point minus one degree Celsius. ' 'Altimeter two nine point nine two. Heavy Rain. ' 'Broken layer at 1500ft (Cumulonimbus)') ret = speech.metar(data, units) self.assertIsInstance(ret, str) self.assertEqual(ret, spoken)
def speech(self) -> str: """ Report summary designed to be read by a text-to-speech program """ if not self.data: self.update() return speech.metar(self.data, self.units)
def test_metar(self): """ Tests converting METAR data into into a single spoken string """ 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", speak="020"), ], } data.update({ k: None for k in ( "raw", "remarks", "station", "time", "flight_rules", "remarks_info", "runway_visibility", "sanitized", ) }) data = structs.MetarData(**data) spoken = ( "Winds three six zero (variable three four zero to zero two zero) " "at 12kt gusting to 20kt. Visibility three miles. " "Temperature three degrees Celsius. Dew point minus one degree Celsius. " "Altimeter two nine point nine two. Heavy Rain. " "Broken layer at 1500ft (Cumulonimbus)") ret = speech.metar(data, units) self.assertIsInstance(ret, str) self.assertEqual(ret, spoken)