Repository: python-metar/python-metar

Issue:
AC code should be added to CLOUD_TYPE
Hi,

in this METAR `METAR LOXZ 141420Z 08006KT 20KM VCSH FEW025SC SCT040SC BKN090AC 21/14 Q1015 BECMG SCT090` parsing is ok but when we want the string representation we got an error 
```
line 1161, in sky_conditions
    what = CLOUD_TYPE[cloud]
KeyError: 'AC'
```  

AC for Alto Cumulus should be added.


Discussion:

Patch:
diff --git a/metar/Metar.py b/metar/Metar.py
index d5836e3..7cbcaac 100755
--- a/metar/Metar.py
+++ b/metar/Metar.py
@@ -209,15 +209,25 @@ SKY_COVER = { "SKC":"clear",
               "///":"",
               "VV":"indefinite ceiling" }
 
-CLOUD_TYPE = { "TCU":"towering cumulus",
-               "CU":"cumulus",
-               "CB":"cumulonimbus",
-               "SC":"stratocumulus",
-               "CBMAM":"cumulonimbus mammatus",
-               "ACC":"altocumulus castellanus",
-               "SCSL":"standing lenticular stratocumulus",
-               "CCSL":"standing lenticular cirrocumulus",
-               "ACSL":"standing lenticular altocumulus" }
+
+CLOUD_TYPE = {
+    "AC": "altocumulus",
+    "ACC": "altocumulus castellanus",
+    "ACSL": "standing lenticular altocumulus",
+    "AS": "altostratus",
+    "CB": "cumulonimbus",
+    "CBMAM": "cumulonimbus mammatus",
+    "CCSL": "standing lenticular cirrocumulus",
+    "CC": "cirrocumulus",
+    "CI": "cirrus",
+    "CS": "cirrostratus",
+    "CU": "cumulus",
+    "NS": "nimbostratus",
+    "SC": "stratocumulus",
+    "ST": "stratus",
+    "SCSL": "standing lenticular stratocumulus",
+    "TCU": "towering cumulus",
+}
 
 ## translation of the present-weather codes into english
 
@@ -1243,7 +1253,9 @@ class Metar(object):
                 text_list.append(SKY_COVER[cover])
             else:
                 if cloud:
-                    what = CLOUD_TYPE[cloud]
+                    what = CLOUD_TYPE.get(
+                        cloud, "unknown CLOUD_TYPE of %s" % (cloud, )
+                    )
                 elif SKY_COVER[cover].endswith(" "):
                     what = "clouds"
                 else:


Test patch:
diff --git a/test/test_metar.py b/test/test_metar.py
index 5630e1b..5482a03 100644
--- a/test/test_metar.py
+++ b/test/test_metar.py
@@ -17,6 +17,19 @@ class MetarTest(unittest.TestCase):
     def raisesParserError(self, code):
         self.assertRaises(Metar.ParserError, Metar.Metar, code )
 
+    def test_issue64_cloudkeyerror(self):
+        """Lookup on CLOUD_TYPE should not keyerror."""
+        report = Metar.Metar(
+          "METAR LOXZ 141420Z 08006KT 20KM VCSH FEW025SC SCT040SC BKN090AC "
+          "21/14 Q1015 BECMG SCT090"
+        )
+        res = report.sky_conditions()
+        ans = (
+            "a few stratocumulus at 2500 feet; scattered stratocumulus at "
+            "4000 feet; broken altocumulus at 9000 feet"
+        )
+        self.assertEqual(res, ans)
+
     def test_issue40_runwayunits(self):
         """Check reported units on runway visual range."""
         report = Metar.Metar(