[Qgis-developer] raster algebra plugin - numpy/Numeric problem
Barry Rowlingson
b.rowlingson at lancaster.ac.uk
Fri Jan 9 13:44:29 EST 2009
Okay, so I'm getting my new raster algebra plugin working. Runs fine
at home on Windows with Qgis 1.0.0-preview2.
I try it on Linux, on Qgis 1.0.0-Kore. Fails because of API changes,
so I fix those. Then it fails while playing with raster data from
gdal.
What seems to be happening is that on Windows, everything uses numpy
arrays - so when I get raster data via python-gdal I get a numpy array
back, which I then manipulate using numpy functions, and pass it back
to python-gdal to write a new geoTiff. But with Ubuntu, I get a
Numeric array back, manipulate it with numpy functions, and then pass
a numpy array to python-gdal which promptly complains that the object
doesn't have a 'typecode' method (which only Numeric arrays have).
I think the change happened between python-gdal 1.4 and 1.5. Is it
worth working round the Numeric array problem or does anyone know if
things are going to be updated soon? What does Ubuntu Intrepid Ibex
have? What python-gdal is available for MacOS?
The workaround involves making sure I pass the right sort of array to
the writing functions, but that involves knowing what python-gdal
expects and copying the data when converting it to Numeric array.
Something worth avoiding. Oh well.
Sorry this is less of a qgis problem and more of a python-gdal one...
But I'm sure you guys know the answer...
Barry
More information about the Qgis-developer
mailing list