[gdal-dev] pct2rgb.py errors out on large rasters with rgba option

Even Rouault even.rouault at mines-paris.org
Sun Jul 17 05:40:12 EDT 2011


Selon jt2000 <thakkar at nexgenwireless.com>:

> /usr/local/bin/pct2rgb.py -rgba raster.grc convert.tif
> *Traceback (most recent call last):
>   File "/usr/local/bin/pct2rgb.py", line 167, in <module>
>     dst_data = Numeric.take(band_lookup,src_data)
>   File "/usr/local/lib/python2.7/site-packages/numpy/core/fromnumeric.py",
> line 103, in take
>     return take(indices, axis, out, mode)
> IndexError: index out of range for array*
>
> There are over 2000 categories in the file.
>
> Any help would be appreciated.

This could occur if some pixel in the imagery data has a value that is not
included in the color table (categories are not used by pct2rgb.py). Indeed it
is possible since your image is of type UInt16, so values can range from 0 to
65535, but the color table has only 2113 entries. This might be a bug in the
driver, or an error in the image...

>
> gdalinfo shows following:
> Driver: NWT_GRC/Northwood Classified Grid Format .grc/.tab
> Files: raster.grc
> Size is 9506, 10282
> Coordinate System is:
> PROJCS["unnamed",
>     GEOGCS["unnamed",
>         DATUM["North_American_Datum_1983",
>             SPHEROID["GRS 80",6378137,298.257222101],
>             TOWGS84[0,0,0,-0,-0,-0,0]],
>         PRIMEM["Greenwich",0],
>         UNIT["degree",0.0174532925199433]],
>     PROJECTION["Transverse_Mercator"],
>     PARAMETER["latitude_of_origin",0],
>     PARAMETER["central_meridian",-93],
>     PARAMETER["scale_factor",0.9996],
>     PARAMETER["false_easting",500000],
>     PARAMETER["false_northing",0],
>     UNIT["Meter",1]]
> Origin = (111765.000000000000000,3467265.000000000000000)
> Pixel Size = (30.000000000000000,-30.000000000000000)
> Corner Coordinates:
> Upper Left  (  111765.000, 3467265.000) ( 97d 4'36.80"W, 31d16'30.24"N)
> Lower Left  (  111765.000, 3158805.000) ( 96d57'54.87"W, 28d29'53.39"N)
> Upper Right (  396945.000, 3467265.000) ( 94d 4'59.78"W, 31d20' 6.94"N)
> Lower Right (  396945.000, 3158805.000) ( 94d 3'12.66"W, 28d33' 7.18"N)
> Center      (  254355.000, 3313035.000) ( 95d32'40.39"W, 29d55'24.74"N)
> Band 1 Block=9506x1 Type=UInt16, ColorInterp=Palette
>   NoData Value=0
>   Categories:
>       0: No Data
>       [Over 2000 Categories listed]
> Color Table (RGB with 2113 entries)
>     0: 255,255,255,255
>     [Rest of the entries]
>
> --
> View this message in context:
>
http://osgeo-org.1803224.n2.nabble.com/pct2rgb-py-errors-out-on-large-rasters-with-rgba-option-tp6590418p6590418.html
> Sent from the GDAL - Dev mailing list archive at Nabble.com.
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>




More information about the gdal-dev mailing list