[gdal-dev] ReadAsArray: putting data in an already existent array

Diego Gnesi Bartolani diego.gnesi at gmail.com
Fri Mar 22 10:47:49 PDT 2013


    I'm programming in Python and I need to "scan" a large image with GDAL
reading n rows at the time. I'm using the ReadAsArray method, but every
time I execute it I get a new array. I think this solution consumes a lot
of resources.
Is there a method or option to pass to ReadAsArray an array that already
exists, in order to change it's value, like in the following pseudo-code:

band1 = ds.GetRasterBand(1)
my_arr = band1.ReadAsArrray([params])
[Do something with my_arr]
band1.ReadAsArray([params to get other rows], save_to=my_arr)

Of course, my_arr must have the correct size for storing incoming data.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20130322/9ecf1f20/attachment.html>

More information about the gdal-dev mailing list