[Gdal-dev] Troubles with gdalnumeric

Philip Riggs priggs at warnercnr.colostate.edu
Thu Feb 23 16:40:23 EST 2006


I have succeeded in importing the module, but the first issue was:

Traceback (most recent call last):
   File "<stdin>", line 1, in ?
   File "/Library/Frameworks/Python.framework/Versions/2.4/lib/ 
python2.4/site-packages/gdalnumeric.py", line 113, in LoadFile
     return DatasetReadAsArray( ds, xoff, yoff, xsize, ysize )
   File "/Library/Frameworks/Python.framework/Versions/2.4/lib/ 
python2.4/site-packages/gdalnumeric.py", line 130, in DatasetReadAsArray
     return BandReadAsArray( ds.GetRasterBand(1), xoff, yoff, xsize,  
ysize)
   File "/Library/Frameworks/Python.framework/Versions/2.4/lib/ 
python2.4/site-packages/gdalnumeric.py", line 167, in BandReadAsArray
     typecode = GDALTypeCodeToNumericTypeCode( datatype )
   File "/Library/Frameworks/Python.framework/Versions/2.4/lib/ 
python2.4/site-packages/gdalnumeric.py", line 205, in  
GDALTypeCodeToNumericTypeCode
     return Int16
NameError: global name 'Int16' is not defined

I corrected this by inserting the definitions for typecode values.  
Will this break anything?

After correcting this I have the following error:

Traceback (most recent call last):
   File "<stdin>", line 1, in ?
   File "/Library/Frameworks/Python.framework/Versions/2.4/lib/ 
python2.4/site-packages/gdalnumeric.py", line 113, in LoadFile
     return DatasetReadAsArray( ds, xoff, yoff, xsize, ysize )
   File "/Library/Frameworks/Python.framework/Versions/2.4/lib/ 
python2.4/site-packages/gdalnumeric.py", line 130, in DatasetReadAsArray
     return BandReadAsArray( ds.GetRasterBand(1), xoff, yoff, xsize,  
ysize)
   File "/Library/Frameworks/Python.framework/Versions/2.4/lib/ 
python2.4/site-packages/gdalnumeric.py", line 175, in BandReadAsArray
     buf_obj = zeros( shape, typecode )
NameError: global name 'zeros' is not defined

I have found no zeros function in any gdal related .py file. What  
should this do and where should it be?

Thank you
Philip



More information about the Gdal-dev mailing list