[Gdal-dev] GDALNumeric.SaveArray : Unable to access numpy arrays of typecode "@"

Gagan Tandon gagant at hotmail.com
Fri Sep 26 12:37:41 EDT 2003


Gillian,

Thankyou very much..
IT WORKED..!!!

Gagan


>From: Gillian Walter <gillian.walter at atlantis-scientific.com>
>Reply-To: gdal-dev at remotesensing.org
>To: gdal-dev at remotesensing.org
>Subject: Re: [Gdal-dev] GDALNumeric.SaveArray : Unable to access numpy 
>arrays of typecode "@"
>Date: Fri, 26 Sep 2003 10:50:44 -0400
>
>Hi,
>
>I had the same problem.  This was Frank's response (his -DHAVE_NUMPY 
>solution worked for me):
>
>This might be an issue with how GDAL is built on windows.  If GDAL doesn't
>"know" how to find Numeric/arrayobject.h to get at the definitions of
>the PaArray_Descr and PyArrayObject structures it just falls back to using
>internal declarations for these presumably copied from an earlier version
>of Python.  To the best of my knowledge the internal (out of date) 
>definitions
>are always used on windows.
>
>Try adding -DHAVE_NUMPY to OPTFLAGS in nmake.opt and see if things work.
>
>The easiest way to verify you are getting system definitions of the numpy
>stuff would be to add a #error directive in the "#ifndef HAVE_NUMPY" 
>section
>of gdal/pymod/gdal_py.h.
>
>- Gillian
>
>Gagan Tandon wrote:
>
>>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 `@' <mailto:%60@%27>.
>>
>>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! 
>><http://g.msn.com/8HMAENIN/2734??PS=> 
>>_______________________________________________ Gdal-dev mailing list 
>>Gdal-dev at remotesensing.org 
>>http://remotesensing.org/mailman/listinfo/gdal-dev
>
>
>
>_______________________________________________
>Gdal-dev mailing list
>Gdal-dev at remotesensing.org
>http://remotesensing.org/mailman/listinfo/gdal-dev







PLEASE SEND ANY HEAVY ATTACHMENT LOADED EMAILS TO THIS EMAIL ID: 
gagan at cs.colostate.edu.
THANKS
Gagan Tandon
Graduate Student                     Research Assistant
Computer Science                   GIS and Remote Sensing
Colorado State University
1500 W Plum Street
Apt 1-I
Fort Collins,CO
ZIP 80521, USA
Phone (R) : (970)-492-9487

_________________________________________________________________
Contact brides & grooms FREE! http://www.shaadi.com/ptnr.php?ptnr=hmltag 
Only on www.shaadi.com. Register now!




More information about the Gdal-dev mailing list