On 6/16/07, Ali Santacruz <[EMAIL PROTECTED]> wrote:

Hi dear list,

I am designing an application that uses GDAL (which seems to bind to
Numeric) to read an image and convert it to an array. The code runs without
problem in the console, then I compile it (apparently without problems), but
when I try to launch the application, it fails and the next error appears in
the .log:



Traceback (most recent call last):

  File "ViewGdal_0.0-1.py", line 10, in ?

  File "gdal\__init__.pyc", line 11, in ?

  File "gdal\gdalnumeric.pyc", line 85, in ?                     #from
Numeric import *

  File "Numeric.pyc", line 93, in ?                                 #from
Precision import *

  File "Precision.pyc", line 26, in ?                                
#_code_table
= _fill_table(typecodes)

  File "Precision.pyc", line 23, in _fill_table                   #table[key]
= _get_precisions(value)

  File "Precision.pyc", line 18, in _get_precisions

TypeError: data type not understood



This refers to the next in Precision.py in Numeric:



typecodes = {'Character':'c', 'Integer':'1sil', 'UnsignedInteger':'bwu',
'Float':'fd', 'Complex':'FD'}

def _get_precisions(typecodes):

    lst = []

    for t in typecodes:

        lst.append( (zeros( (1,), t ).itemsize()*8, t) )
#this is line 18

    return lst



As far as I understand (I've been working with Python for just a couple of
months), there is a problem with the typecodes. What can I do to solve this
problem?



I've not found a version of GDAL that binds to Numpy. I am using GDAL from
hobutools (v. 1.75), Numeric v. 24.2, Python 2.4.3 on WinXP.


Looks like GDAL supports numpy

These facilities have evolved somewhat over time. In the past the package
was known as "Numeric" and imported using "import Numeric". A new generation
is imported using "import *numpy*". Currently the old generation bindings
only support the older Numeric package, and the new generatio bindings only
support the new generation *numpy* package. They are mostly compatible, and
by importing gdalnumeric you will get whichever is appropriate to the
current bindings type.

I would look for a package with a more recent version of GDAL that supports
numpy. Apart from that, I can't help you.

Chuck
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to