[gdal-dev] GDAL WriteArray Memory Error (Python)

hairymapper tom.holderness at ncl.ac.uk
Fri Jan 14 08:45:39 EST 2011


Hi,

When doing the following in Windows XP, I get an error:

dst_ds.GetRasterBand(band_num).WriteArray ( rasterarray )

Traceback (most recent call last)
...
 File "C:\Python26\lib\site-packages\osgeo\gdal_array.py", line 160, in
BandWriteArray
    array = array.astype( numpy.float64 )
MemoryError

The data being written is a Numpy matrix of byte values (Landsat image
~75mb) and the output dst_ds GDAL data type has been set to byte.

The Windows machine is 32-bit/2GB Ram VirtualBox. 
Initially I though this was due to a lack of ram, so I increased the RAM and
swap file amounts (RAM at 4GB) but there was no difference. Secondly I ran the
test on a Linux machine (32-bit/2GBRam) and it worked fine. 

There's obviously some memory allocation error, what's interesting is the
"array.astype( numpy.float64 )" statement despite the Numpy matrix and
destination dataset both having byte data types. I also wouldn't have
expected to see this kind of error with a relatively small Landsat image.

gdal.VersionInfo() = '1604'
numpy.__version__ = '1.5.0'

Any help would be appreciated,

Thanks.



-- 
View this message in context: http://osgeo-org.1803224.n2.nabble.com/GDAL-WriteArray-Memory-Error-Python-tp5921724p5921724.html
Sent from the GDAL - Dev mailing list archive at Nabble.com.


More information about the gdal-dev mailing list