[gdal-dev] gdalinfo and scale/offset

Even Rouault even.rouault at mines-paris.org
Thu Oct 28 14:09:38 EDT 2010


Kyle,

Frank added in GDAL 1.7 a '-unscale' option to gdal_translate, so people can 
always use gdal_translate -unscale to apply the offset and scale (they can even 
do that do a VRT file to save disk space), and then use gdalinfo on the result.

Extract from the gdal_translate man page:

"-unscale : Apply the scale/offset metadata for the bands to convert scaled 
values to unscaled values.  It is also often necessary to reset the output 
datatype with the -ot switch."

Is there a need for such an option in gdalinfo ? I have no strong opinion 
about this. An issue I see is that usually -stats record the computed stats in 
a .aux.xml file for later retrieval. The interaction with a -unscale option 
would be tricky... What happens if the user computes with -unscale and then do 
gdalinfo without it... Or the other way round.

Le jeudi 28 octobre 2010 19:58:55, Kyle Shannon a écrit :
> Hello,
> I have been working  on ticket #3797.  In the example given, gdalinfo is
> the calling the netcdf driver.  I agree with Frank's opinion on this in
> ticket #1660:
> 
> Note that GDALRasterBand has methods to get the offset and scale. The
> normal
> 
> > GDAL practice would be to return them via those methods - not to apply
> > them on the fly. Then it is up to the caller to do so if they wish.
> 
> gdal shouldn't be in charge of scaling the data to what may be a different
> data type, or unpacking it.  But in this case, gdalinfo is the caller.
> Should the functionality of the scaling be added to gdalinfo?  Maybe
> optionally reporting the stats as scaled data?  Any thoughts?
> 
> # ============================
> Kyle Shannon
> Physical Science Technician
> RMRS Fire Sciences Lab
> Fire, Fuels & Smoke - RWU 4405
> 5775 Highway 10 W.
> Missoula, MT 59808
> (406)829-6954
> kshannon at fs.fed.us
> # ============================


More information about the gdal-dev mailing list