Skip to content

Commit

Permalink
remove FutureWarning from Xarray providers
Browse files Browse the repository at this point in the history
  • Loading branch information
tomkralidis committed Apr 11, 2024
1 parent 35bdcb6 commit f6d0c73
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
12 changes: 6 additions & 6 deletions pygeoapi/provider/xarray_.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,9 @@ def query(self, properties=[], subsets={}, bbox=[], bbox_crs=4326,
_to_datetime_string(data.coords[self.time_field].values[-1])
],
"driver": "xarray",
"height": data.dims[self.y_field],
"width": data.dims[self.x_field],
"time_steps": data.dims[self.time_field],
"height": data.sizes[self.y_field],
"width": data.sizes[self.x_field],
"time_steps": data.sizes[self.time_field],
"variables": {var_name: var.attrs
for var_name, var in data.variables.items()}
}
Expand Down Expand Up @@ -385,9 +385,9 @@ def _get_coverage_properties(self):
'x_axis_label': self.x_field,
'y_axis_label': self.y_field,
'time_axis_label': self.time_field,
'width': self._data.dims[self.x_field],
'height': self._data.dims[self.y_field],
'time': self._data.dims[self.time_field],
'width': self._data.sizes[self.x_field],
'height': self._data.sizes[self.y_field],
'time': self._data.sizes[self.time_field],
'time_duration': self.get_time_coverage_duration(),
'bbox_units': 'degrees',
'resx': np.abs(self._data.coords[self.x_field].values[1]
Expand Down
8 changes: 4 additions & 4 deletions pygeoapi/provider/xarray_edr.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,11 @@ def position(self, **kwargs):
raise ProviderNoDataError()

try:
height = data.dims[self.y_field]
height = data.sizes[self.y_field]
except KeyError:
height = 1
try:
width = data.dims[self.x_field]
width = data.sizes[self.x_field]
except KeyError:
width = 1
time, time_steps = self._parse_time_metadata(data, kwargs)
Expand Down Expand Up @@ -215,8 +215,8 @@ def cube(self, **kwargs):
except KeyError:
raise ProviderNoDataError()

height = data.dims[self.y_field]
width = data.dims[self.x_field]
height = data.sizes[self.y_field]
width = data.sizes[self.x_field]
time, time_steps = self._parse_time_metadata(data, kwargs)

out_meta = {
Expand Down

0 comments on commit f6d0c73

Please sign in to comment.