diff --git a/metar_taf_parser/parser/parser.py b/metar_taf_parser/parser/parser.py index c328160..395ed34 100644 --- a/metar_taf_parser/parser/parser.py +++ b/metar_taf_parser/parser/parser.py @@ -18,6 +18,11 @@ def parse_delivery_time(abstract_weather_code, time_string): Parses the delivery time of a METAR/TAF. It will return False if it is not a delivery time but a validity time. If the delivery time is not specified, we can assume the start of the validity time is the delivery time. + + This occurred in the line TEMPO 2308/2312 9999/8000 RA/DZ BKN020, where the delivery time is + 2300/2312, but the validity time that follows, 9999/9000 was parsed as a delivery time, + causing the parser to give erroneous results. + :param abstract_weather_code: The TAF or METAR object :param time_string: The string representing the delivery time :return: None @@ -313,7 +318,7 @@ def _extract_lines_tokens(self, taf_code: str): """ single_line = taf_code.replace('\n', ' ') clean_line = re.sub(r'\s{2,}', ' ', single_line) - lines = re.sub(r'\s(PROB\d{2}\sTEMPO|TEMPO|INTER|BECMG|FM(?![A-Z]{2}\s)|PROB)', '\n\g<1>', clean_line).splitlines() + lines = re.sub(r'\s(PROB\d{2}\sTEMPO|TEMPO|INTER|BECMG|FM(?![A-Z]{2}\s)|PROB)', r'\n\g<1>', clean_line).splitlines() lines_token = [self.tokenize(line) for line in lines] if len(lines_token) > 1: