Skip to content

Commit

Permalink
introduced rounding of spatial coordinates when accessing an xarray d…
Browse files Browse the repository at this point in the history
…ataset
  • Loading branch information
cnavacch committed Feb 2, 2023
1 parent 2c4cc85 commit ab309b4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
Changelog
=========

Version 1.0.1
=============

- introduced rounding of spatial coordinates when accessing an xarray dataset

Version 1.0.0
=============
- completely new package and module structure
Expand Down
4 changes: 3 additions & 1 deletion src/veranda/raster/mosaic/netcdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from geospade.crs import SpatialRef
from geospade.raster import Tile
from geospade.raster import MosaicGeometry
from geospade import DECIMALS

from veranda.utils import to_list
from veranda.raster.native.netcdf import NetCdf4File
Expand Down Expand Up @@ -777,7 +778,8 @@ def write(self, data, use_mosaic=False, data_variables=None, encoder=None, encod
if not src_tile.intersects(data_geom):
continue
dst_tile = data_geom.slice_by_geom(src_tile, inplace=False)
data_write = data_filt.sel(**{space_dims[0]: dst_tile.y_coords, space_dims[1]: dst_tile.x_coords})
data_write = data_filt.sel(**{space_dims[0]: np.around(dst_tile.y_coords, decimals=DECIMALS),
space_dims[1]: np.around(dst_tile.x_coords, decimals=DECIMALS)})
else:
dst_tile = data_geom
src_tile = data_geom
Expand Down

0 comments on commit ab309b4

Please sign in to comment.