logo       

GDALNumeric.SaveArray : Unable to access numpy arrays of typecode "@": msg#00156

gis.gdal.devel

Subject: GDALNumeric.SaveArray : Unable to access numpy arrays of typecode "@"

Dear Friends,

I am using Numeric 23.0 version and python 2.3 on a windows XP machine. I have build GDAL from MS VC++ and Visual Studio .net and installed on my machine. The GDAL version is 1.1.9.

Basic Problem : I am trying to save a Numpy array(infact the primary issue is to save any 2d array (not just NUMPY) to a "TIF" file) to a TIF file. When I run the following commands, I get an error stating that it cannot access Numpy array of typecode "@"  (weird..??)

DUMP OF PYTHON INTERPRETER.

>>> k = Numeric.zeros((2,2),"f")

>>> k
array([[ 0.,  0.],
       [ 0.,  0.]],'f')               // I have tried with array k = array([[1.2, 2.3], [2.5,1.7]],"f")


>>> import gdalnumeric

>>> gdalnumeric.SaveArray(k,"k.tif")
ERROR 1: Unable to access numpy arrays of typecode `@'.

Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "C:\GDAL\pymod\gdalnumeric.py", line 97, in SaveArray
    return driver.CreateCopy( filename, OpenArray(src_array,prototype) )
  File "C:\GDAL\pymod\gdal.py", line 330, in CreateCopy
    target_ds = _gdal.GDALCreateCopy( self._o, filename, source_ds._o,
AttributeError: 'NoneType' object has no attribute '_o'

---- END OF PYTHON INTERPRETER

I am wondering whether this is a version problem with Numeric python or is it a problem with the building of GDAL using MS VC++ 7.0  or is it something else. I would be delighted if any one can give me clues on how to save a 2d array to a TIF file, since thats the primary problem.

Thanks

Gagan Tandon



Gagan Tandon
Research Assistant
GIS and Remote Sensing
Colorado State University 





Attention all artisans! Sell Diwali creations online. Register now!
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise