Use get to fetch units attribute to avoid error if missing. (#1539)

This commit is contained in:
David Huard
2024-02-23 01:13:24 -03:00
committed by GitHub
parent c85d6003b4
commit b54bdd80a8
+2 -2
View File
@@ -439,10 +439,10 @@ class XarrayProvider(BaseProvider):
if coord.lower() == 'time':
time_var = coord
continue
if self._data.coords[coord].attrs['units'] == 'degrees_north':
if self._data.coords[coord].attrs.get('units') == 'degrees_north':
y_var = coord
continue
if self._data.coords[coord].attrs['units'] == 'degrees_east':
if self._data.coords[coord].attrs.get('units') == 'degrees_east':
x_var = coord
continue