Opened 15 years ago
Last modified 7 years ago
#3085 closed enhancement
Incorrect nodata values when using the -scale option in gdal_translate — at Initial Version
Reported by: | ersts | Owned by: | warmerdam |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | GDAL_Raster | Version: | 1.5.2 |
Severity: | normal | Keywords: | gdal_translate nodata ubuntu |
Cc: | warmerdam, antonio, Kyle Shannon |
Description
When scaling data and converting between data types, I am experiencing unexpected results, specifically with the nodata values in the resulting image. I am running Ubuntu 9.04 with stock GDAL 1.5.2
Example ascii grid: ncols 5
nrows 5
xllcorner -2610321.0830204
yllcorner -3330321.0830204
cellsize 4500.0
NODATA_value -9999.0
-9999.0 -9999.0 1.2E-4 1.2E-4 1.2E-4
-9999.0 -9999.0 1.2E-3 1.2E-3 1.2E-3
-9999.0 -9999.0 1.2E-2 1.2E-2 1.2E-2
-9999.0 -9999.0 1.2E-1 1.2E-1 1.2E-1
-9999.0 -9999.0 5.2E-1 5.2E-1 5.2E-1
with the command: gdal_translate -ot int32 -scale 0 1 0 1000 -a_nodata -9999 -of GTiff test.asc test.tif The nodata value is reported as -9999 but in the image -9999 becomes -9999000
gdal_translate -ot Int16 -scale 0 1 0 1000 -a_nodata -9999 -of GTiff test.asc test.tif The nodata value is reported as -9999 but in the image -9999 becomes -32768
If the scaling option is removed, the nodata values are correct in the destination image