I am using Python 2.6.5 (32bit) with Numpy 1.3 and Gdal 1.9.1 installed on Windows 7 64bit. I am trying to read an 800 MB Imagine (.img) raster dataset into a Numpy array to do some raster algebra, but as soon as I run the following code, Python.exe crashes.
from osgeo import gdal g = gdal.Open(r'path\to\dataset', gdal.GA_Readonly) b = g.GetRasterBand(1) data = b.ReadAsArray()
Python.exe crashes on the
b.ReadAsArray() call. I did some Google searching and found articles dated from Gdal 1.6 that mentioned this issue with Windows 7 64bit, but they also mentioned that it had been fixed in the latest development versions at that time.
Has anyone else had this issue? Any workarounds?
I decided to debug the code in PyDev to try to determine where it is failing. From what I can tell (still not getting any error messages) it is failing on line 22 of gdal_array.py.
_mod = imp.load_module('_gdal_array', fp, pathname, description)
When I step into the line of code above, it brings me into the init.py module of numpy. When I reach the end of the numpy.__init__.py module, it steps out back to the above line of code. Then, when I hit the step into button, which should bring me to the next line within gdal_array.py, the script just terminates with no error messages or anything.
I uninstalled GDAL 1.9.1 and installed GDAL 1.6.1 from the Python Cheeseshop and OSGeo's Windows Binaries. Still had the same issue.