Hi Diego,
I haven't checked this out, but my guess is that you should make a
(python)list of the arrays if you need to keep them.  If you don't need to
keep them, you might try to del(ete) myarray before the next ReadAsArray
call.
Of course there is a lower level function which accepts an address as you
suggest, but the question is whether it should be exposed.
Because of the potential for errors, exposing it might not be the best.
You could expose it yourself, probably, but I very much suggest trying my
suggestion first.
Good luck,
Jan

On Fri, Mar 22, 2013 at 6:47 PM, Diego Gnesi Bartolani <
diego.gn...@gmail.com> wrote:

> Hi,
>
>     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.
>
> Thanks,
>
> Diego
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev@lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>
_______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to