Skip to content

Commit c2a6b57

Browse files
authored
Merge pull request #46 from mivek/fix/station_parse
Fix TAF with stations starting with FM
2 parents cc8fad3 + f2ede7c commit c2a6b57

File tree

4 files changed

+24
-2
lines changed

4 files changed

+24
-2
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Change Log
22

3+
## [1.6.4] - 2023-06-TBD
4+
5+
### Fixed
6+
7+
- Parsing of `TAF` with stations starting by `FM`.
8+
39
## [1.6.3] - 2023-03-12
410

511
### Fixed

metar_taf_parser/parser/parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ def _extract_lines_tokens(self, taf_code: str):
299299
"""
300300
single_line = taf_code.replace('\n', ' ')
301301
clean_line = re.sub(r'\s{2,}', ' ', single_line)
302-
lines = re.sub(r'\s(PROB\d{2}\sTEMPO|TEMPO|INTER|BECMG|FM|PROB)', '\n\g<1>', clean_line).splitlines()
302+
lines = re.sub(r'\s(PROB\d{2}\sTEMPO|TEMPO|INTER|BECMG|FM(?![A-Z]{2}\s)|PROB)', '\n\g<1>', clean_line).splitlines()
303303
lines_token = [self.tokenize(line) for line in lines]
304304

305305
if len(lines_token) > 1:

metar_taf_parser/tests/parser/test_parser.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -801,6 +801,22 @@ def test_parse_with_icings_turbulence_trends(self):
801801
self.assertEqual(1, len(taf.becmgs()[5].icings))
802802
self.assertEqual(2, len(taf.becmgs()[5].turbulence))
803803

804+
def test_parse_with_station_begining_with_FM(self):
805+
taf = TAFParser().parse(
806+
"""TAF FMMI 082300Z 0900/1006 16006KT 9999 FEW017 BKN020 PROB30
807+
TEMPO 0908/0916 4500 RADZ
808+
BECMG 0909/0911 10010KT
809+
BECMG 0918/0920 16006KT
810+
"""
811+
)
812+
813+
self.assertIsNotNone(taf)
814+
self.assertEqual('FMMI', taf.station)
815+
816+
self.assertEqual(8, taf.day)
817+
self.assertEqual(23, taf.time.hour)
818+
self.assertEqual(0, taf.time.minute)
819+
804820

805821
class RemarkParserTestCase(unittest.TestCase):
806822

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = metar-taf-parser-mivek
3-
version = 1.6.3
3+
version = 1.6.4
44
author = Jean-Kevin KPADEY
55
author_email = [email protected]
66
description = Python project parsing metar and taf message

0 commit comments

Comments
 (0)