BUG: xray fails to read netCDF files where coordinates do not refer to valid variables
Instead, we should verify that that coordinates refer to valid variables and fail gracefully.

As reported by @mgarvert.

diff --git a/xray/conventions.py b/xray/conventions.py
index 315f0452e..ce30dd5db 100644
--- a/xray/conventions.py
+++ b/xray/conventions.py
@@ -696,9 +696,12 @@ def decode_cf_variables(variables, attributes, concat_characters=True,
             v, concat_characters=concat, mask_and_scale=mask_and_scale,
             decode_times=decode_times)
         if decode_coords:
-            coordinates = new_vars[k].attrs.pop('coordinates', None)
-            if coordinates is not None:
-                coord_names.update(coordinates.split())
+            var_attrs = new_vars[k].attrs
+            if 'coordinates' in var_attrs:
+                var_coord_names = var_attrs['coordinates'].split()
+                if all(k in variables for k in var_coord_names):
+                    coord_names.update(var_coord_names)
+                    del var_attrs['coordinates']
 
     if decode_coords and 'coordinates' in attributes:
         attributes = OrderedDict(attributes)
diff --git a/xray/test/test_conventions.py b/xray/test/test_conventions.py
index 8fd02bb15..f00991e22 100644
--- a/xray/test/test_conventions.py
+++ b/xray/test/test_conventions.py
@@ -347,6 +347,12 @@ class TestDecodeCF(TestCase):
         actual = conventions.decode_cf(original)
         self.assertDatasetIdentical(expected, actual)
 
+    def test_invalid_coordinates(self):
+        # regression test for GH308
+        original = Dataset({'foo': ('t', [1, 2], {'coordinates': 'invalid'})})
+        actual = conventions.decode_cf(original)
+        self.assertDatasetIdentical(original, actual)
+
 
 class CFEncodedInMemoryStore(InMemoryDataStore):
     def store(self, variables, attributes):
['xray/test/test_conventions.py', 'xray/conventions.py']