Skip to content

Commit 8e97a62

Browse files
committed
Fix the calm wind regex
This PR fixes #61 and the regex of the calm wind which is represented by `00000KT` and not `0000KT`. Visibility should not be parsed aas wind.
1 parent bf1d375 commit 8e97a62

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

metar_taf_parser/command/common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def execute(self, container: AbstractWeatherContainer, visibility_string: str):
7979

8080

8181
class WindCommand:
82-
regex = r'^(VRB|00|[0-3]\d{2})(\d{2})G?(\d{2,3})?(KT|MPS|KM\/H)?'
82+
regex = r'^(VRB|000|[0-3]\d{2})(\d{2})G?(\d{2,3})?(KT|MPS|KM\/H)?'
8383

8484
def __init__(self):
8585
self._pattern = re.compile(WindCommand.regex)

metar_taf_parser/tests/parser/test_parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ def test_parse_runway_deposit(self):
290290

291291
def test_parse_empty_wind(self):
292292

293-
metar = MetarParser().parse('KATW 022045Z 0000KT 10SM SCT120 00/M08 A2996')
293+
metar = MetarParser().parse('KATW 022045Z 00000KT 10SM SCT120 00/M08 A2996')
294294

295295
self.assertEqual('KATW', metar.station)
296296
self.assertIsNotNone(metar.wind)

0 commit comments

Comments
 (0)