[GRASS-user] How GRASS loads raster images into memory?

Pietro Zambelli peter.zamb at gmail.com
Fri Aug 16 07:51:47 PDT 2013


On Friday 16 Aug 2013 18:08:53 Andranik Hayrapetyan wrote:
> Good day,
> 
> I would like to understand how GRASS loads raster images into memory to
> perform calculations on them.
> Does it load the entire image into memory and only then do the calculation
> on them, or it loads image into memory by portions sequentially?

As far as I know, there are no functions in the C-API of GRASS to load the 
whole raster map into the memory... And in general is not a good idea...

You can read/write a raster row by row with:

http://grass.osgeo.org/programming7/raster_2get__row_8c.html
http://grass.osgeo.org/programming7/raster_2put__row_8c.html

Then exist the Raster RowIO that provide a row cache to avoid to read several 
time always the same row from the hard disk.

http://grass.osgeo.org/programming7/rowio_2setup_8c.html


And last but not least the Raster Segment, that split the map not by row but 
in several tiles and provide a tile cache, allowing to open a map in 
read-write mode.

http://grass.osgeo.org/programming7/structSEGMENT.html
http://grass.osgeo.org/programming7/segment_2local__proto_8h.html
http://grass.osgeo.org/programming7/segment_2get_8c.html
http://grass.osgeo.org/programming7/segment_2put_8c.html

Regards

Pietro




More information about the grass-user mailing list