def test_get_type_and_times(self): """ Tests TAF line type, start time, and end time extraction """ for wx, *data in ( (['1'], 'FROM', '', ''), (['INTER', '1'], 'INTER', '', ''), (['TEMPO', '0101/0103', '1'], 'TEMPO', '0101', '0103'), (['PROB30', '0101/0103', '1'], 'PROB30', '0101', '0103'), (['FM120000', '1'], 'FROM', '1200', ''), (['FM1200/1206', '1'], 'FROM', '1200', '1206'), (['FM120000', 'TL120600', '1'], 'FROM', '1200', '1206') ): self.assertEqual(core.get_type_and_times(wx), (['1'], *data))
def test_get_type_and_times(self): """ Tests TAF line type, start time, and end time extraction """ for wx, *data in ( (['1'], 'FROM', '', ''), (['INTER', '1'], 'INTER', '', ''), (['TEMPO', '0101/0103', '1'], 'TEMPO', '0101', '0103'), (['PROB30', '0101/0103', '1'], 'PROB30', '0101', '0103'), (['FM120000', '1'], 'FROM', '1200', ''), (['FM1200/1206', '1'], 'FROM', '1200', '1206'), (['FM120000', 'TL120600', '1'], 'FROM', '1200', '1206') ): self.assertEqual(core.get_type_and_times(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