[gdal-dev] Scale / offset query

Tobias Reinicke ramotswa at gmail.com
Thu Oct 25 11:01:47 PDT 2018


Hello All,

I am getting stuck in a bit of a scale / offset hole and can't seem to
figure out a simple way of doing this  - although I'm sure it's there.
For background - I am trying to convert a series of temporal netcdf files
(i.e. total column CO concentrations across different times) into colour
ramp applied PNG's. The outputting PNG's need to be a specific height /
width, and need to represent the data in epsg:4326, and need the bottom
left corner to be 0, -90 (rather than -180, -90) - and finally a colour
ramp needs to be a applied.

I can manage all this - with a combination of gdalwarp with t_srs, te and
ts flags, and then gdaldem color-relief with my own colour ramp.

However - and this might be obvious to many of you - I just haven't worked
with scaled data much before;
When I put the netcdf file into QGIS I can see the CO concentration values
represented as min / max colour scales.  These values (again, obviously for
some) represent the 16bit value of the pixel, times the scale value of that
band, plus the offset value of that band (as can be seen by gdalinfo), and
the scale and offset are different for each NC file I have.

Now when I do gdalwarp I know I am resampling the data, and I (therefore?)
lose the scale / offset information, and so for image 1, the min 16bit
value (-32766) represent a different CO concentration than the min 16bit
value of image 2, (also -32766) - and so applying any colour ramps to that
makes no sense.

Is there a way to pass the scale / offset information from the original NC
file to the output of gdal_warp?

Apologies for the long question - it's quite hard to describe actually.

Thanks in advance,
Toby
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20181025/cef93ed1/attachment.html>


More information about the gdal-dev mailing list