[gdal-dev] ReadAsArray

Even Rouault even.rouault at spatialys.com
Fri Apr 3 04:13:42 PDT 2015


Le vendredi 03 avril 2015 12:46:48, Yuta Sato a écrit :
> Dear Even Rouault:
> 
> Thank you very much.
> What about setting these parameters "used with .ReadAsArray()", though I
> did not know their meanings?
> buf_xsize=None, buf_ysize=None, buf_obj=None

(Please keep the list CC'ed)

buf_xsize and buf_ysize are the equivalents of nBufXSize and nBufYSize in 
GDALRasterBand::RasterIO()
http://gdal.org/classGDALRasterBand.html#a75d4af97b3436a4e79d9759eedf89af4
i.e. to do downsampling or upsampling of original data.

buf_obj can be used to "recycle" an existing numpy array of the appropriate 
size instead of allocating a new one.

> 
> 
> On Fri, Apr 3, 2015 at 7:43 PM, Even Rouault <even.rouault at spatialys.com>
> 
> wrote:
> > Le vendredi 03 avril 2015 12:22:00, Yuta Sato a écrit :
> > > Dear Respected GDAL Developers and Users:
> > > 
> > > What parameters should I set beforehand in order to accelerate the
> > 
> > reading
> > 
> > > of a GeoTiff file?
> > > 
> > > I am using as follows:
> > > 
> > > data = src_dataset.GetRasterBand(1).ReadAsArray(xoff,yoff,xsize,ysize)
> > > 
> > > Does setting the following parameters accelerate?
> > > 
> > > GDAL_CACHEMAX, GDAL_SWATH_SIZE
> > > 
> > > I'm using gdal python.
> > 
> > Yuta,
> > 
> > Increasing GDAL_CACHEMAX might accelerate in case of repeated reads on
> > windows
> > that are identical or overlapping already read windows. Or if the way you
> > read
> > the raster doesn't follow its block shape : for example if the raster is
> > organized by lines/strips and you read by square blocks, or the reverse
> > situation.
> > 
> > GDAL_SWATH_SIZE is only used by CreateCopy().
> > 
> > Even
> > 
> > --
> > Spatialys - Geospatial professional services
> > http://www.spatialys.com

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list