Skip to content

Commit

Permalink
fixed issue with non-unique stack dimension labelling when multiple f…
Browse files Browse the repository at this point in the history
…iles are present
  • Loading branch information
cnavacch committed Aug 22, 2022
1 parent 4609476 commit c0dfd0e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/veranda/raster/mosaic/geotiff.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,9 +444,13 @@ def _to_xarray(self, data, band_names=None) -> xr.Dataset:
"""
dims = [self._file_dim] + self._ref_space_dims

# retrieve file register with unique stack dimension
ref_tile_id = list(self.file_register[self._tile_dim])[0]
file_register_uni = self._file_register.loc[self._file_register[self._tile_dim] == ref_tile_id]

coord_dict = dict()
for coord in self._file_coords:
coord_dict[coord] = self._file_register[coord]
coord_dict[coord] = file_register_uni[coord]

coord_dict[self._ref_space_dims[0]] = self._data_geom.y_coords
coord_dict[self._ref_space_dims[1]] = self._data_geom.x_coords
Expand Down

0 comments on commit c0dfd0e

Please sign in to comment.