Hello all,<br><br>I&#39;ve got a python script that reads and extracts elevation subdatasets from an HDF5 raster.&nbsp; There are hundreds of these and I&#39;m running into issues where system memory usage grows increasingly until I get a system &quot;memory could not be read&quot; error.&nbsp; All the subdatasets are 600x600 and result in 1.4MB GeoTiffs.&nbsp; Extracting 6 of these in a row, I get a memory usage as high as 160MB.&nbsp; I believe I made it through about 20 of these before the system choked.&nbsp; <br>
<br>How can I get the memory usage under control?&nbsp; I&#39;m not concerned about a minimal footprint, just one that won&#39;t crash python.&nbsp; I&#39;ve tried various combinations of del statements at the end of the loop and they seem to make no difference.&nbsp; I&#39;ve also tried removing the Numeric.multiply line just to make sure I wasn&#39;t creating any circular references.&nbsp; Not sure what else to do, any advice appreciated.<br>
<br>-Jamie<br><br>On WinXP with FWTools version 2.10.<br><br>Here&#39;s a basic rundown of the script:<br><br>###########<br><br>for i in hdf_sub:<br>&nbsp; outfile = i+&#39;.tif&#39;<br><br>&nbsp; indataset = gdal.Open(i)<br>&nbsp; inband = indataset.GetRasterBand(1)<br>
<br>&nbsp; format = &quot;GTiff&quot;<br>&nbsp; outdataset.driver.Create(outfile, inband.XSize, inband.YSize, 1, gdal.GDT_Float32)<br>&nbsp; outband = outdataset.GetRasterBand(1)<br><br>&nbsp; ## Set the geotransform &amp; projection ##<br>&nbsp; ......blah...blah<br>
<br>&nbsp; ## Read data into Numeric array<br>&nbsp; temp_out = inband.ReadAsArray(0, 0, inband.XSize, inband.YSize)<br><br>&nbsp; ## Make all values negative<br>&nbsp; ## Tried without this line, made no difference <br>&nbsp; temp_out = Numeric.multiply(temp_out, -1)<br>
<br>&nbsp; ## The data is stored reversed on the y-axis, reverse and write<br>&nbsp; outband.WriteArray(temp_out[::-1])<br><br>###########<br><br><br>