def test_taf(self): """ Tests that TAF line translations are summarized in the proper order """ self.assertEqual( summary.taf( structs.TafLineTrans( altimeter="29.92 inHg (1013 hPa)", clouds="Broken layer at 1500ft (Cumulonimbus) - Reported AGL", icing="Light icing from 10000ft to 15000ft", other="Heavy Rain", turbulence="Occasional moderate turbulence in clouds from 5500ft to 8500ft", visibility="3sm (4.8km)", wind_shear="Wind shear 2000ft from 070 at 40kt", wind="N-360 at 12kt gusting to 20kt", ) ), ( "Winds N-360 at 12kt gusting to 20kt, Vis 3sm, Alt 29.92 inHg, " "Heavy Rain, Broken layer at 1500ft (Cumulonimbus), " "Wind shear 2000ft from 070 at 40kt, " "Occasional moderate turbulence in clouds from 5500ft to 8500ft, " "Light icing from 10000ft to 15000ft" ), )
def test_taf(self): """ Tests end-to-end TAF translation """ units = structs.Units(**static.core.NA_UNITS) line_data = { "altimeter": core.make_number("29.92", "2992"), "clouds": [core.make_cloud("BKN015CB")], "icing": ["611005"], "other": [], "turbulence": ["540553"], "visibility": core.make_number("3"), "wind_direction": core.make_number("360"), "wind_gust": core.make_number("20"), "wind_shear": "WS020/07040KT", "wind_speed": core.make_number("12"), "wx_codes": get_wx_codes(["+RA"])[1], } line_data.update({ k: "" for k in ( "raw", "end_time", "start_time", "transition_start", "probability", "type", "flight_rules", "sanitized", ) }) data = {"max_temp": "TX20/1518Z", "min_temp": "TN00/00", "remarks": ""} data.update({ k: "" for k in ("raw", "station", "time", "start_time", "end_time") }) data = structs.TafData(forecast=[structs.TafLineData(**line_data)], **data) line_trans = structs.TafLineTrans( altimeter="29.92 inHg (1013 hPa)", clouds="Broken layer at 1500ft (Cumulonimbus) - Reported AGL", icing="Light icing from 10000ft to 15000ft", turbulence= "Occasional moderate turbulence in clouds from 5500ft to 8500ft", visibility="3sm (4.8km)", wind_shear="Wind shear 2000ft from 070 at 40kt", wind="N-360 at 12kt gusting to 20kt", wx_codes="Heavy Rain", ) trans = structs.TafTrans( forecast=[line_trans], max_temp="Maximum temperature of 20°C (68°F) at 15-18:00Z", min_temp="Minimum temperature of 0°C (32°F) at 00:00Z", remarks={}, ) translated = translate.taf.translate_taf(data, units) self.assertIsInstance(translated, structs.TafTrans) for line in translated.forecast: self.assertIsInstance(line, structs.TafLineTrans) self.assertEqual(translated, trans)
def test_taf(self): """ Tests end-to-end TAF translation """ units = structs.Units(**static.NA_UNITS) line_data = { 'altimeter': core.make_number('2992'), 'clouds': [core.make_cloud('BKN015CB')], 'icing': ['611005'], 'other': ['+RA'], 'turbulance': ['540553'], 'visibility': core.make_number('3'), 'wind_direction': core.make_number('360'), 'wind_gust': core.make_number('20'), 'wind_shear': 'WS020/07040KT', 'wind_speed': core.make_number('12') } line_data.update({ k: '' for k in ('raw', 'end_time', 'start_time', 'probability', 'type', 'flight_rules', 'sanitized') }) data = {'max_temp': 'TX20/1518Z', 'min_temp': 'TN00/00', 'remarks': ''} data.update({ k: '' for k in ('raw', 'station', 'time', 'start_time', 'end_time') }) data = structs.TafData(forecast=[structs.TafLineData(**line_data)], **data) line_trans = structs.TafLineTrans( altimeter='29.92 inHg (1013 hPa)', clouds='Broken layer at 1500ft (Cumulonimbus) - Reported AGL', icing='Light icing from 10000ft to 15000ft', other='Heavy Rain', turbulance= 'Occasional moderate turbulence in clouds from 5500ft to 8500ft', visibility='3sm (4.8km)', wind_shear='Wind shear 2000ft from 070 at 40kt', wind='N-360 at 12kt gusting to 20kt') trans = structs.TafTrans( forecast=[line_trans], max_temp='Maximum temperature of 20°C (68°F) at 15-18:00Z', min_temp='Minimum temperature of 0°C (32°F) at 00:00Z', remarks={}) translated = translate.taf(data, units) self.assertIsInstance(translated, structs.TafTrans) for line in translated.forecast: self.assertIsInstance(line, structs.TafLineTrans) self.assertEqual(translated, trans)
def test_taf(self): """ Tests that TAF line translations are summarized in the proper order """ self.assertEqual( summary.taf( structs.TafLineTrans( altimeter='29.92 inHg (1013 hPa)', clouds= 'Broken layer at 1500ft (Cumulonimbus) - Reported AGL', icing='Light icing from 10000ft to 15000ft', other='Heavy Rain', turbulance= 'Occasional moderate turbulence in clouds from 5500ft to 8500ft', visibility='3sm (4.8km)', wind_shear='Wind shear 2000ft from 070 at 40kt', wind='N-360 at 12kt gusting to 20kt')), ('Winds N-360 at 12kt gusting to 20kt, Vis 3sm, Alt 29.92 inHg, ' 'Heavy Rain, Broken layer at 1500ft (Cumulonimbus), ' 'Wind shear 2000ft from 070 at 40kt, ' 'Occasional moderate turbulence in clouds from 5500ft to 8500ft, ' 'Light icing from 10000ft to 15000ft'))