How does GDAL readasarray work with raster data?

How does GDAL readasarray work with raster data?

I am using the GDAL ReadAsArray method to work with raster data using numpy (specifically reclassification). As my rasters are large, I process the arrays in blocks, iterating though each block and processing with a similar method to the GeoExamples example.

Why does readasarray crash Python when using GDAL?

When I reinstalled GDAL and Python Bindings all from gisinternals.com, I was able to successfully ReadAsArray. Thank you to all who commented and answered and I apologize for my ignorance. It’s possible it’s a memory issue. When you use ReadAsArray it brings the data into memory, and while 800mb isn’t massive, it’s not tiny either.

Why does Python crash when reading imagine dataset?

I am using Python 2.6.5 (32bit) with Numpy 1.3 and Gdal 1.9.1 installed on Windows 7 64bit. I am trying to read an 800 MB Imagine (.img) raster dataset into a Numpy array to do some raster algebra, but as soon as I run the following code, Python.exe crashes.

Why do I need to do many reads in a raster?

This is all to do with how many disk seeks are required to retrieve a block. If the block is too large then it is harder to write it to disk contiguously, meaning more seeks. Likewise, if it is too small, you will need to do many reads to process the whole raster.

What’s the effect of block cache on GDAL?

My suspicion is you’re really bumping up against GDAL’s block cache, and that’s a knob that’s going to have a significant impact on your processing speed curve. See SettingConfigOptions, specifically GDAL_CACHEMAX, for more detail on this and investigate how changing that value to something significantly larger interacts with your simulation.

Where to find settingconfigoptions in Python GDAL?

See SettingConfigOptions, specifically GDAL_CACHEMAX, for more detail on this and investigate how changing that value to something significantly larger interacts with your simulation. Thanks for contributing an answer to Geographic Information Systems Stack Exchange!

Why are GeoTIFF blocks too big in GDAL?

If the block is too large then it is harder to write it to disk contiguously, meaning more seeks. Likewise, if it is too small, you will need to do many reads to process the whole raster. It also helps to ensure the total size is a power of two. 256×256 is incidentally the default geotiff block size in gdal, so perhaps they drew the same conclusion

Why does python.exe crash on the b.readasarray call?

Python.exe crashes on the b.ReadAsArray () call. I did some Google searching and found articles dated from Gdal 1.6 that mentioned this issue with Windows 7 64bit, but they also mentioned that it had been fixed in the latest development versions at that time. Has anyone else had this issue?