<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<div>I'm currently writing optimisations for a raster viewer program which uses gdal as it's base. It's currently written purely in python, and has some major speed issues which cause problems when we are reading many files at a time. After making some optimisations
in the python, and getting quite a minimal speed increase, I proceeded to profile the program quite heavily and found that our getImage method was our slowest call. I had already performed some optimisations on this function so decided to write a C-Extension
so that we could get some speed increases through a lower level language.</div>
<div><br>
</div>
<div>This has worked for the most part, however there is still one issue, we have found a speed increase of ~2s for some of our larger files in the bulk of the code. But this is negated by the GDALRasterIO call, which is actually about 3s slower than the python
ReadAsArray.</div>
<div><br>
</div>
<div>This doesn't make any sense to me as ReadAsArray is a wrapper around a C++ call to GDALRasterIO, and thus should be slower than having a call straight to GDALRasterIO.</div>
<div><br>
</div>
<div>I was hoping someone here might know of a way to read the rasters more efficiently. I have tried to implement a method using ReadBlock rather than RasterIO, but due to the replication that RasterIO does it didn't work at all. (I'm currently trying to figure
out a way to do that replication without losing too much speed).</div>
<div><br>
</div>
<div>The RasterIO call i'm using is</div>
<div><br>
</div>
<div>band->RasterIO(GF_Read, this->ovleft, this->ovtop, this->ovxsize,</div>
<div> this->ovysize, dataTmp, this->ovxsize, this->ovysize,</div>
<div> band->GetRasterDataType(), 0, 0);</div>
<div><br>
</div>
<div>The old python call was:</div>
<div><br>
</div>
<div>dataTmp = band.ReadAsArray(ovleft, ovtop, </div>
<div> ovxsize, ovysize,</div>
<div> dspRastXSize, dspRastYSize)</div>
<div><br>
</div>
<div><br>
</div>
<div>Thanks in advance</div>
<div><br>
</div>
<div>Gareth Jones</div>
</div>
</body>
</html>