[gdal-dev] Precision about scale/offset element in VRT file
Frank Warmerdam
warmerdam at pobox.com
Fri Mar 23 13:45:10 EDT 2012
On Fri, Mar 23, 2012 at 10:29 AM, Chaitanya kumar CH
<chaitanya.ch at gmail.com> wrote:
> Output pixel value = (raw pixel value * scale) + offset
Exactly.
The reason for scale and offset to exist is that "real world" measures
like elevation, temperature, pressure are often represented in raster
datasets as integer values rescaled from some original floating
point values. This is done for compactness in raster format and
because many raster formats don't support floating point pixels at
all.
So for instance, if you have a dataset with temperatures between
-20 and 100 you might record them in byte values such with an
offset -20 and scale 2.0 which would provide for half degree
precision over the range in byte values.
So a temperature of 80 would be represented as byte value
of "50". The real temperature would be:
50 * 2 - 20 = 80
Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush | Geospatial Software Developer
More information about the gdal-dev
mailing list