-
Couldn't load subscription status.
- Fork 92
Open
Labels
questionFurther information is requestedFurther information is requested
Description
Code Sample, a copy-pastable example if possible
import rioxarray as rxr
da = rxr.open_rasterio("https://huggingface.co/datasets/Zeel/tmp/resolve/main/1524-1184.tif")
# save locally
da.rio.to_raster("tmp.tif")
# Load
da = rxr.open_rasterio("tmp.tif")
print("Original values", da.x.values[:5])
da = da.assign_coords(x = np.round(da.x, 2))
print("Modified values before saving", da.x.values[:5])
# Save
da.rio.to_raster("tmp2.tif")
# Reload
da = rxr.open_rasterio("tmp2.tif")
print("Modified values after saving and reloading", da.x.values[:5])Output
Original values [9783942.00780707 9783946.78512134 9783951.56243561 9783956.33974987
9783961.11706414]
Modified values before saving [9783942.01 9783946.79 9783951.56 9783956.34 9783961.12]
Modified values after saving and reloading [9783942.01 9783946.7873138 9783951.5646276 9783956.34194139
9783961.11925519]
Expected Output
Original values [9783942.00780707 9783946.78512134 9783951.56243561 9783956.33974987
9783961.11706414]
Modified values before saving [9783942.01 9783946.79 9783951.56 9783956.34 9783961.12]
Modified values after saving and reloading [9783942.01 9783946.79 9783951.56 9783956.34 9783961.12]
Environment Information
Installed fresh in Google colab with pip install rioxarray
Question
If this is not a recommended way to modify the coordinates, please help me with the recommended way.
Metadata
Metadata
Assignees
Labels
questionFurther information is requestedFurther information is requested