From b54bdd80a816d4f40df7e07d0c76ed0dd1ea50ad Mon Sep 17 00:00:00 2001 From: David Huard Date: Fri, 23 Feb 2024 01:13:24 -0300 Subject: [PATCH] Use get to fetch units attribute to avoid error if missing. (#1539) --- pygeoapi/provider/xarray_.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pygeoapi/provider/xarray_.py b/pygeoapi/provider/xarray_.py index 44398c7..4a1f396 100644 --- a/pygeoapi/provider/xarray_.py +++ b/pygeoapi/provider/xarray_.py @@ -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