Skip to content

Commit

Permalink
remove warnings for Xarray based backends (#325)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomkralidis authored Apr 11, 2024
1 parent 1acc415 commit a46ff25
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
12 changes: 6 additions & 6 deletions msc_pygeoapi/provider/candcsu6_xarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,8 @@ def _get_coverage_properties(self):
'crs_type': 'GeographicCRS',
'x_axis_label': self.x_field,
'y_axis_label': self.y_field,
'width': self._data.dims[self.x_field],
'height': self._data.dims[self.y_field],
'width': self._data.sizes[self.x_field],
'height': self._data.sizes[self.y_field],
'bbox_units': 'degrees',
'resx': np.abs(self._data.coords[self.x_field].values[1]
- self._data.coords[self.x_field].values[0]),
Expand Down Expand Up @@ -266,7 +266,7 @@ def _get_coverage_properties(self):
self._data.coords[self.time_field].values[-1]
)
]
properties['time'] = self._data.dims[self.time_field]
properties['time'] = self._data.sizes[self.time_field]

properties['fields'] = [name for name in self._data.variables
if len(self._data.variables[name].shape) >= 3]
Expand Down Expand Up @@ -490,8 +490,8 @@ def query(self, properties=[], subsets={},
],
'time': [None, None],
"driver": "xarray",
"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_steps": 1,
"variables": {var_name: var.attrs
for var_name, var in data.variables.items()}
Expand All @@ -504,7 +504,7 @@ def query(self, properties=[], subsets={},
self._to_datetime_string(
data.coords[self.time_field].values[-1])
]
out_meta['time_steps'] = data.dims[self.time_field]
out_meta['time_steps'] = data.sizes[self.time_field]

self.filename = self.data.split('/')[-1].replace(
'*', '-'.join(properties))
Expand Down
12 changes: 6 additions & 6 deletions msc_pygeoapi/provider/climate_xarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,8 @@ def _get_coverage_properties(self):
'crs_type': 'GeographicCRS',
'x_axis_label': self.x_field,
'y_axis_label': self.y_field,
'width': self._data.dims[self.x_field],
'height': self._data.dims[self.y_field],
'width': self._data.sizes[self.x_field],
'height': self._data.sizes[self.y_field],
'bbox_units': 'degrees',
'resx': np.abs(self._data.coords[self.x_field].values[1]
- self._data.coords[self.x_field].values[0]),
Expand Down Expand Up @@ -270,7 +270,7 @@ def _get_coverage_properties(self):
self._data.coords[self.time_field].values[-1]
)
]
properties['time'] = self._data.dims[self.time_field]
properties['time'] = self._data.sizes[self.time_field]

properties['fields'] = [name for name in self._data.variables
if len(self._data.variables[name].shape) >= 3]
Expand Down Expand Up @@ -531,8 +531,8 @@ def query(self, properties=[], subsets={},
],
'time': [None, None],
"driver": "xarray",
"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_steps": 1,
"variables": {var_name: var.attrs
for var_name, var in data.variables.items()}
Expand All @@ -545,7 +545,7 @@ def query(self, properties=[], subsets={},
self._to_datetime_string(
data.coords[self.time_field].values[-1])
]
out_meta['time_steps'] = data.dims[self.time_field]
out_meta['time_steps'] = data.sizes[self.time_field]

self.filename = self.data.split('/')[-1].replace(
'*', '-'.join(properties))
Expand Down
6 changes: 3 additions & 3 deletions msc_pygeoapi/provider/spei_xarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,9 @@ def query(self, properties=['spei'], subsets={},
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

0 comments on commit a46ff25

Please sign in to comment.