def test_get_taf_alt_ice_turb(self): """ Tests that report global altimeter, icing, and turbulance get removed """ for wx, *data in ((['1'], '', [], []), (['1', '512345', '612345'], '', ['612345'], ['512345']), (['QNH1234', '1', '612345'], '1234', ['612345'], [])): self.assertEqual(core.get_taf_alt_ice_turb(wx), (['1'], *data))
def test_get_taf_alt_ice_turb(self): """ Tests that report global altimeter, icing, and turbulance get removed """ for wx, *data in ( (['1'], '', [], []), (['1', '512345', '612345'], '', ['612345'], ['512345']), (['QNH1234', '1', '612345'], '1234', ['612345'], []) ): self.assertEqual(core.get_taf_alt_ice_turb(wx), (['1'], *data))
def parse_na_line(txt: str, units: Units) -> {str: str}: """ Parser for the North American TAF forcast varient """ retwx = {} wxdata = txt.split(' ') wxdata, _, retwx['wind_shear'] = core.sanitize_report_list(wxdata) wxdata, retwx['type'], retwx['start_time'], retwx['end_time'] = core.get_type_and_times(wxdata) wxdata, retwx['wind_direction'], retwx['wind_speed'],\ retwx['wind_gust'], _ = core.get_wind(wxdata, units) wxdata, retwx['visibility'] = core.get_visibility(wxdata, units) wxdata, retwx['clouds'] = core.get_clouds(wxdata) retwx['other'], retwx['altimeter'], retwx['icing'], retwx['turbulance'] \ = core.get_taf_alt_ice_turb(wxdata) return retwx
def parse_na_line(line: str, units: Units) -> {str: str}: """ Parser for the North American TAF forcast varient """ retwx = {} wxdata = line.split() wxdata, _, retwx['wind_shear'] = core.sanitize_report_list(wxdata) wxdata, retwx['type'], retwx['start_time'], retwx['end_time'] = core.get_type_and_times(wxdata) wxdata, retwx['wind_direction'], retwx['wind_speed'],\ retwx['wind_gust'], _ = core.get_wind(wxdata, units) wxdata, retwx['visibility'] = core.get_visibility(wxdata, units) wxdata, retwx['clouds'] = core.get_clouds(wxdata) retwx['other'], retwx['altimeter'], retwx['icing'], retwx['turbulance'] \ = core.get_taf_alt_ice_turb(wxdata) return retwx
def parse_na_line(txt: str, units: {str: str}) -> ({str: object}, {str: str}): """ Parser for the North American TAF forcast varient """ retwx = {} wxdata = txt.split(' ') wxdata, _, retwx['Wind-Shear'] = core.sanitize_report_list( wxdata, remove_clr_and_skc=False) wxdata, retwx['Type'], retwx['Start-Time'], retwx[ 'End-Time'] = core.get_type_and_times(wxdata) wxdata, units, retwx['Wind-Direction'], retwx['Wind-Speed'],\ retwx['Wind-Gust'], _ = core.get_wind(wxdata, units) wxdata, units, retwx['Visibility'] = core.get_visibility(wxdata, units) wxdata, retwx['Cloud-List'] = core.get_clouds(wxdata) retwx['Other-List'], retwx['Altimeter'], retwx['Icing-List'], retwx['Turb-List'] \ = core.get_taf_alt_ice_turb(wxdata) return retwx, units
def parse_in_line(txt: str, units: Units) -> {str: str}: """ Parser for the International TAF forcast varient """ retwx = {} wxdata = txt.split(' ') wxdata, _, retwx['wind_shear'] = core.sanitize_report_list(wxdata) wxdata, retwx['type'], retwx['start_time'], retwx['end_time'] = core.get_type_and_times(wxdata) wxdata, retwx['wind_direction'], retwx['wind_speed'],\ retwx['wind_gust'], _ = core.get_wind(wxdata, units) if 'CAVOK' in wxdata: retwx['visibility'] = core.make_number('CAVOK') retwx['clouds'] = [] wxdata.pop(wxdata.index('CAVOK')) else: wxdata, retwx['visibility'] = core.get_visibility(wxdata, units) wxdata, retwx['clouds'] = core.get_clouds(wxdata) retwx['other'], retwx['altimeter'], retwx['icing'], retwx['turbulance'] \ = core.get_taf_alt_ice_turb(wxdata) return retwx
def parse_in_line(line: str, units: Units) -> {str: str}: """ Parser for the International TAF forcast varient """ retwx = {} wxdata = line.split() wxdata, _, retwx['wind_shear'] = core.sanitize_report_list(wxdata) wxdata, retwx['type'], retwx['start_time'], retwx['end_time'] = core.get_type_and_times(wxdata) wxdata, retwx['wind_direction'], retwx['wind_speed'],\ retwx['wind_gust'], _ = core.get_wind(wxdata, units) if 'CAVOK' in wxdata: retwx['visibility'] = core.make_number('CAVOK') retwx['clouds'] = [] wxdata.pop(wxdata.index('CAVOK')) else: wxdata, retwx['visibility'] = core.get_visibility(wxdata, units) wxdata, retwx['clouds'] = core.get_clouds(wxdata) retwx['other'], retwx['altimeter'], retwx['icing'], retwx['turbulance'] \ = core.get_taf_alt_ice_turb(wxdata) return retwx