Opened 17 years ago

Last modified 17 years ago

#1518 closed defect

Python-NG Bindings -Complex data ReadAsArray — at Version 3

Reported by: tisham@… Owned by: warmerdam
Priority: normal Milestone: 1.4.1
Component: PythonBindings Version: 1.4.0
Severity: normal Keywords:
Cc: hobu

Description (last modified by warmerdam)

Reading complex datasets form Python using the Python-NG bindings produces the following error:

Wow complex
Traceback (most recent call last):
  File "testwin.py", line 17, in <module>
    databuffer = band.ReadAsArray(0,0,10,10,10,10)
  File "c:\Python25\Lib\site-packages\gdal.py", line 657, in ReadAsArray
    buf_xsize, buf_ysize, buf_obj )
  File "c:\Python25\Lib\site-packages\gdal_array.py", line 135, in BandReadAsArray
    ar = numpy.reshape(ar, [1,win_ysize,win_xsize])
  File "c:\python25\lib\site-packages\numpy-1.0.1-py2.5-win32.egg\numpy\core\fromnumeric.py", line 62, in reshape
    return reshape(newshape, order=order)
ValueError: total size of new array must be unchanged



This might be dependent on the numpy-version being used. This bug has been reproduced in Windows with the MingW and VC++ Express compilers and in Linux-Debian with stock numpy install from apt-get.

Change History (2)

comment:1 by warmerdam, 17 years ago

I believe there is a fundamental problem here with how complex values 
are handled by the numpy/gdal_array stuff.   The issue, I think, is that
numpy doesn't have a data type for complex values, so they essentially have
to be treated as a "doubled up" array of the base type (ie. CInt16 needs
to be treated as a doubled up array of Int16).  

This will require some careful thought. 


comment:3 by warmerdam, 17 years ago

Cc: hobu added
Description: modified (diff)
Milestone: 1.4.1
Priority: highestnormal
Version: unspecified1.4.0
Note: See TracTickets for help on using tickets.