Skip to content

Commit

Permalink
Merge pull request #5 from LimnoTech/time-query-fix-limno
Browse files Browse the repository at this point in the history
update time querying
  • Loading branch information
sjordan29 authored Jun 20, 2024
2 parents 33c5e25 + 9bae1f7 commit 595a33b
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions pygeoapi/provider/xarray_edr.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,23 +124,18 @@ def position(self, **kwargs):
data = self._data

if self.time_field in query_params:
remaining_query = {
key: val for key, val in query_params.items()
if key != self.time_field
}
if isinstance(query_params[self.time_field], slice):
remaining_query = {
key: val for key, val in query_params.items()
if key != self.time_field
}
time_query = {
self.time_field: query_params[self.time_field]
}
data = data.sel(
time_query).sel(remaining_query, method='nearest')
else:
time_query = {
self.time_field: (
data[self.time_field].dt.date ==
query_params[self.time_field]
)
}
data = data.sel(
time_query).sel(remaining_query, method='nearest')
data = data.sel(query_params, method='nearest')
else:
data = data.sel(query_params, method='nearest')
except KeyError:
Expand Down

0 comments on commit 595a33b

Please sign in to comment.