Skip to content

Commit

Permalink
fix xarray get
Browse files Browse the repository at this point in the history
  • Loading branch information
mathleur committed Mar 6, 2024
1 parent ef80bb5 commit bce6fb4
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions polytope/datacube/backends/xarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,17 @@ def get(self, requests: IndexTree):
path_copy = deepcopy(path)
for key in path_copy:
axis = self._axes[key]
(path, unmapped_path) = axis.unmap_to_datacube(path, unmapped_path)
# TODO: here do nearest point search
path = self.fit_path(path)
key_value_path = {key: path_copy[key]}
(key_value_path, path, unmapped_path) = axis.unmap_path_key(key_value_path, path, unmapped_path)
path.update(key_value_path)

unmapped_path = {}
self.refit_path(path, unmapped_path, path)
for key in path:
path[key] = list(path[key])
for key in unmapped_path:
unmapped_path[key] = list(unmapped_path[key])

subxarray = self.dataarray.sel(path, method="nearest")
subxarray = subxarray.sel(unmapped_path)
value = subxarray.values
Expand Down

0 comments on commit bce6fb4

Please sign in to comment.