Repository: python-metar/python-metar

Issue:
Wind Speeds default to m/s when units are not provided
For example

```python
from metar import Metar
m = Metar.Metar(" KDSM 310507Z COR 34026G45 2SM +TSRA SCT018 BKN023CB BKN041 21/17 A2991 "
"RMK AO2 PK WND 36051/0458 LTG DSNT W-NE RAB06 CONS LTGICCGCC OHD-W-N TS "
"OHD-W-N MOV SE P0000 T02060167")
print(m.wind_gust)
# 45 mps
```

FMH1  12.6.5 The wind group shall always end with KT to indicate that wind speeds are reported in knots.

The code `Datatypes/speed` presently defaults to MPS when units are not provided.  Perhaps we should default to knots?  Thoughts?

Discussion:

Patch:
diff --git a/metar/Metar.py b/metar/Metar.py
index 094d931..cf6026f 100644
--- a/metar/Metar.py
+++ b/metar/Metar.py
@@ -618,6 +618,14 @@ class Metar(object):
             self.wind_dir = direction(wind_dir)
         wind_speed = d["speed"].replace("O", "0")
         units = d["units"]
+        # Ambiguous METAR when no wind speed units are provided
+        if units is None and self.station_id is not None:
+            # Assume US METAR sites are reporting in KT
+            if len(self.station_id) == 3 or self.station_id.startswith("K"):
+                units = "KT"
+        # If units are still None, default to MPS
+        if units is None:
+            units = "MPS"
         if units == "KTS" or units == "K" or units == "T" or units == "LT":
             units = "KT"
         if wind_speed.startswith("P"):


Test patch:
diff --git a/test/test_metar.py b/test/test_metar.py
index b6eb84f..ed43504 100644
--- a/test/test_metar.py
+++ b/test/test_metar.py
@@ -367,7 +367,8 @@ def test_141_parseWind_nonstd():
     assert report("09010T").wind_speed.string() == "10 knots"
     assert report("09010LT").wind_speed.string() == "10 knots"
     assert report("09010KTS").wind_speed.string() == "10 knots"
-    assert report("09010").wind_speed.string() == "10 mps"
+    # Default wind speed units are knots since US station_id is used
+    assert report("09010").wind_speed.string() == "10 knots"
 
     assert report("VRBOOK").wind_speed.value() == 0
     assert report("VRBOOK").wind() == "calm"
@@ -390,6 +391,12 @@ def test_141_parseWind_nonstd():
     assert report("MMMMMG01KT").wind() == "missing"
 
 
+def test_issue139_no_wind_unit():
+    """Check the default wind speed units for international sites."""
+    report = Metar.Metar("CXXX 101651Z 09010G20")
+    assert report.wind_speed.string() == "10 mps"
+
+
 def test_issue51_strict():
     """Check that setting strict=False prevents a ParserError"""
     with warnings.catch_warnings(record=True) as w: