On 5/15/2014 1:56 PM, Even Rouault wrote:
Le jeudi 15 mai 2014 16:25:12, Stephen Woodbridge a écrit :
Hi all,

I'm trying to create a VRT file for a GTiff that is Int32 or Float32 to
add a ColorTable but I seem to be missing a key piece of information.
How are the pixel values mapped to the color table entries? via the
histogram?

My GTiff has noData=-32767 and good values the range from say -5 to 100.
So do I create a color table that is based on the 256 buckets in the
histogram?

No way you can use a GDAL color table to map negative values...
Perhaps you should use gdaldem color-relief to generate a RGB output. Note
that gdaldem color-relief is compatible with VRT output : it uses the LUT
mechanism to do so.

OK, I will look at gdaldem, but not wanting to give up on this yet, is there a way to change the NoData pixels from -32767 to say -20 then scale 1.0 and offset the value by 10.

This would make NoData=0

old   => new
 -5        5
  0       10
  1       11
100      110

then I would have all positive values and the range would be manageable?

The scale and offset are already supported in VRT, but I'm not sure if it is possible to remap -32767 values to a new value.

Thanks for your response.

-Steve


So for example I get:

Band 1 Block=256x256 Type=Float32, ColorInterp=Gray
    Min=-32767.000 Max=33.980   Computed Min/Max=-54.985,34.320
    Minimum=-32767.000, Maximum=33.980, Mean=-15887.345, StdDev=16386.592
    256 buckets from -32831.1 to 98.0444:
    1545169 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 27375 1924356
    NoData Value=-32767
    Metadata:
      STATISTICS_MAXIMUM=33.979999542236
      STATISTICS_MEAN=-15887.344614501
      STATISTICS_MINIMUM=-32767
      STATISTICS_STDDEV=16386.59208246


It seems that the NoData value is included in the stats which really
skews the numbers compressing all my values into two buckets! How can I
avoid that? I want to ignore the NoData values and spread my good values
into the remaining buckets. How can I do this?

You can't. There's a ticket I think about the fact we should ignore nodata
value in stats.


Thanks,
    -Steve

_______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev


_______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to