[gdal-dev] Python Bindings ReadAsArray and ReadRaster Errors

Jay L. jlaura at asu.edu
Thu Jan 3 15:16:07 PST 2013


List,

I am attempting to open a multi-band image using the PDS driver.  I have a
working, GDAL readable label that I can run gdalinfo and gdal_translate on
without error.  I am attempting to access a number of bands and operate on
them using NumPy.

band.ReadAsArray() is failing silently in process, returning None.  I am
able to get band.XSize, band.YSize, band.GetNoDataValue() and the total
band count without error.


ReadAsArray via IPython returns the following:

ERROR 3: Failed to read scanline 4.
> ERROR 1: frt0000859f_07_if166l_trr3_fixed.lbl, band 1: IReadBlock failed
> at X offset 0, Y offset 4
> ERROR 1: GetBlockRef failed at X block offset 0, Y block offset 4




I next tried:
array = band.ReadRaster(0,0,band.XSize, band.YSize, 1, GDT_Float64)

Here are the pertinent portions of the stack trace.

  File "csas.py", line 50, in load
>     array = band.ReadRaster(0,0,band.XSize, band.YSize, 1, GDT_Float64)
>   File
> "/Library/Frameworks/GDAL.framework/Versions/1.9/Python/2.7/site-packages/osgeo/gdal.py",
> line 1069, in ReadRaster
>     buf_pixel_space, buf_line_space)
> RuntimeError: frt0000859f_07_if166l_trr3_fixed.lbl, band 236: IReadBlock
> failed at X offset 0, Y offset 34



Note that a conversion to GTiff prior to operating on the image returns the
array as anticipated.

Is this an issue with the PDS driver, a label reading issue, or a dataset /
driver interaction?
Thanks,
Jay
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20130103/2bbbf314/attachment.html>


More information about the gdal-dev mailing list