Repository: python-metar/python-metar

Issue:
Unparsed group '09008KT 7SM' when wind is listed after sky groups.
The following METAR produces a ParserError:

METAR KCOF 281855Z FEW029TCU FEW040 SCT250 09008KT 7SM 32/25 A3008 RMK VIRGA E TCU NE AND DSNT ALQDS SLP186

Backtrace:

```
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/jhaiduce/Development/python-metar/metar/Metar.py", line 499, in __init__
    raise ParserError(message)
metar.Metar.ParserError: Unparsed groups in body '09008KT 7SM' while processing 'METAR KCOF 281855Z FEW029TCU FEW040 SCT250 09008KT 7SM 32/25 A3008 RMK VIRGA E TCU NE AND DSNT ALQDS SLP186'
```

Discussion:

Patch:
diff --git a/metar/Metar.py b/metar/Metar.py
index 8da571d..e3cf432 100644
--- a/metar/Metar.py
+++ b/metar/Metar.py
@@ -1050,6 +1050,8 @@ class Metar(object):
         (RUNWAY_RE, _handleRunway, True),
         (WEATHER_RE, _handleWeather, True),
         (SKY_RE, _handleSky, True),
+        (WIND_RE, _handleWind, False),
+        (VISIBILITY_RE, _handleVisibility, True),
         (TEMP_RE, _handleTemp, False),
         (PRESS_RE, _handlePressure, True),
         (RECENT_RE, _handleRecent, True),


Test patch:
diff --git a/test/test_metar.py b/test/test_metar.py
index 9bafe17..19996a7 100644
--- a/test/test_metar.py
+++ b/test/test_metar.py
@@ -654,6 +654,19 @@ def test_cor_auto_mod():
 
     assert m.mod == 'COR AUTO'
 
+def test_wind_after_sky():
+    """
+    Test parsing of a METAR that lists wind after the sky groups
+    """
+
+    code = (
+        "METAR KCOF 281855Z FEW029TCU FEW040 SCT250 09008KT 7SM 32/25 A3008 "
+        "RMK VIRGA E TCU NE AND DSNT ALQDS SLP186"
+    )
+    m = Metar.Metar(code, year=2007)
+
+    assert m.wind_dir.value() == 90
+    assert m.wind_speed.value() == 8
 
 def test_issue136_temperature():
     raisesParserError("METAR EDDM 022150Z 26006KT CAVOK 201/16")