[gdal-dev] NoData value used during unscale in gdal_translate

Even Rouault even.rouault at mines-paris.org
Sat Nov 12 08:26:59 EST 2011

Le samedi 12 novembre 2011 02:48:16, Trent M Hare a écrit :
> Group,
>     It appears when using "-unscale" during a gdal_translate conversion,
> the defined NoData value is used when the offset/scale are applied. Not
> sure if this is intentional?

I also do not consider the current behaviour as the most intuitive one. 
There's an old ticket http://trac.osgeo.org/gdal/ticket/3085 that deals with 
that issue. I would be very tempted to apply (a variation of) the patch I had 
attached to the ticket, that would honour the nodata value of the source band 
if it exists. Perhaps only restricted to the -scale / -unscale case where this 
is the most problematic, in order to limit backward compatibility issues when 
only -a_nodata is used (pure remapping of nodata values can be done with 
gdalwarp). The -srcnodata option I had proposed in the patch could also be 
removed : if people have a dataset with a nodata value set that they want to 
be considered as a regular value, they can preprocess it with a 
"gdal_translate src.tif without_no_data.vrt -a_nodata none -of VRT" to unset 
it, and use that intermediate dataset as the source for the gdal_translate -

What is your current opinion on this issue ?

Best regards,


More information about the gdal-dev mailing list