[gdal-dev] Question on scaling between tif and vrt

Even Rouault even.rouault at mines-paris.org
Mon May 19 14:48:02 PDT 2014


Le lundi 19 mai 2014 23:42:06, Stephen Woodbridge a écrit :
> Hi all,
> 
> I have a .tif file with -ot Int16 and an associated .vrt file that is
> applying a color palette and is type Byte.
> 
> How does if decide on how to scale the pixel values?
> 
> Does it compute the range and then just scale and offset that values to
> the new range?

Not completely sure to understand what you really mean, but I'd say no scaling 
nor offseting.
Color table is plain and stupid. You need to provide as many entries in the 
color tables as values in the input file, and the index of the color table must 
match the value of the pixel in the source band. And this is not possible in 
your case since the minimum value is negative (as said in previous related 
discussion), and the color table entries are indexed starting at 0.

--> use LUT

> 
> Below are the gdalinfo for each.
> 
> Thanks,
>    -Steve
> 
> gdalinfo -stats MODIS_SST_EAST-201405190900.tif
> Driver: GTiff/GeoTIFF
> Files: MODIS_SST_EAST-201405190900.tif
>         MODIS_SST_EAST-201405190900.tif.aux.xml
> Size is 8800, 6600
> Coordinate System is:
> GEOGCS["WGS 84",
>      DATUM["WGS_1984",
>          SPHEROID["WGS 84",6378137,298.257223563,
>              AUTHORITY["EPSG","7030"]],
>          AUTHORITY["EPSG","6326"]],
>      PRIMEM["Greenwich",0],
>      UNIT["degree",0.0174532925199433],
>      AUTHORITY["EPSG","4326"]]
> Origin = (-125.000000000000000,54.931818190930159)
> Pixel Size = (0.009090548548341,-0.009058565004476)
> Metadata:
>    AREA_OR_POINT=Area
> Image Structure Metadata:
>    INTERLEAVE=BAND
> Corner Coordinates:
> Upper Left  (-125.0000000,  54.9318182) (125d 0' 0.00"W, 54d55'54.55"N)
> Lower Left  (-125.0000000,  -4.8547108) (125d 0' 0.00"W,  4d51'16.96"S)
> Upper Right ( -45.0031728,  54.9318182) ( 45d 0'11.42"W, 54d55'54.55"N)
> Lower Right ( -45.0031728,  -4.8547108) ( 45d 0'11.42"W,  4d51'16.96"S)
> Center      ( -85.0015864,  25.0385537) ( 85d 0' 5.71"W, 25d 2'18.79"N)
> Band 1 Block=8800x1 Type=Int16, ColorInterp=Gray
>    Min=-10004.000 Max=6035.000
>    Minimum=-10004.000, Maximum=6035.000, Mean=-673.234, StdDev=268.660
>    Overviews: 4400x3300, 2200x1650, 1100x825, 550x413, 275x207
>    Metadata:
>      STATISTICS_MAXIMUM=6035
>      STATISTICS_MEAN=-673.23378700069
>      STATISTICS_MINIMUM=-10004
>      STATISTICS_STDDEV=268.66013989253
> 
> gdalinfo -stats -noct MODIS_SST_EAST-201405190900.vrt
> Driver: VRT/Virtual Raster
> Files: /maps/wms/data/MODIS_SST_EAST/MODIS_SST_EAST-201405190900.vrt
>         /maps/wms/data/MODIS_SST_EAST/MODIS_SST_EAST-201405190900.tif
> Size is 8800, 6600
> Coordinate System is `'
> Origin = (-125.000000000000000,54.936579299999998)
> Pixel Size = (0.009090548056818,-0.009058564515152)
> Corner Coordinates:
> Upper Left  (-125.0000000,  54.9365793)
> Lower Left  (-125.0000000,  -4.8499465)
> Upper Right ( -45.0031771,  54.9365793)
> Lower Right ( -45.0031771,  -4.8499465)
> Center      ( -85.0015886,  25.0433164)
> Band 1 Block=128x128 Type=Byte, ColorInterp=Palette
>    Minimum=0.000, Maximum=255.000, Mean=1.885, StdDev=21.797
>    Metadata:
>      STATISTICS_MAXIMUM=255
>      STATISTICS_MEAN=1.8849891356749
>      STATISTICS_MINIMUM=0
>      STATISTICS_STDDEV=21.796961177215
>    Color Table (RGB with 256 entries)
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev

-- 
Geospatial professional services
http://even.rouault.free.fr/services.html


More information about the gdal-dev mailing list