rio.ro_raster changes the coordinate #332
hamiddashti
started this conversation in
General
Replies: 1 comment 1 reply
-
It has do do with rounding error in floating point aritmetic ref. In the geotiff, it does not store the raw coordinate values, instead it stores the transform. The transform is calculated based on the x/y coordinates in the file and written to the geotiff. There are two places the rounding error could happen:
I think it would be nice for xarray to have a "close enough" option where a certain number of decimal places is enough to consider them equal. Not sure the best place to report this, but you could add your use case here. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
rio.to_raster slightly changes the coordinate. Here is a small netcdf file which I used in the following code to reproduce the issue:
File (13kb)
This might lead to other issues. For example I recently asked a question on stackoverflow using
xarray.where
(here) which I think is related to this problem. Following suggestion in #298 I just reassign the coordinates to solve the problem...I wonder is this a bug or I am doing something wrong here?
Beta Was this translation helpful? Give feedback.
All reactions