R: [Gdal-dev] trivial (?) optimization for gdal.i:GDALReadRaster( )
Vincent Schut
schut at sarvision.com
Thu Feb 5 11:18:00 EST 2004
Frank / Alessandro
After some playing around I have the following results: opening and reading
gdal datasets works without problems using numarray. However, when I try to
save a numarray dataset to a file using gdal.SaveArray, I get a segfault. I'm
sorry but I don't know how to invoke gdb to debug a python script, so I don't
have much more information.
I tried to dig up the SaveArray function and manually invoke its steps. It
appears that the segfault appears in the gdal.Open function on the created
NUMPY:::<adress> object, which is made using the gdal.OpenArray function.
Try the following very simple test program to get the segfault too:
#!/usr/bin/python
import os, sys
from numarray import *
#from Numeric import *
from gdal import *
from gdalnumeric import *
print 'Creating array...'
sys.stdout.flush()
# create a 3 band array (rgb) with some values in it:
rgbImage = reshape(arange(30000, type='UInt8'),(3,100,100))
print 'Saving array...'
sys.stdout.flush()
#SaveArray( rgbImage, 'numarray_test_1.png', 'PNG', None)
# SaveArray segfaults... split it up:]
filename = GetArrayFilename( rgbImage )
print filename # just for checking
sys.stdout.flush()
# this function creates a segfault:
dataset = Open( filename )
print 'Done...'
sys.stdout.flush()
--
Cheers,
-----------------------------
Vincent Schut
SarVision B.V.
Wageningen, The Netherlands
www.sarvision.com
More information about the Gdal-dev
mailing list