[GRASS-dev] Python SWIG

Glynn Clements glynn at gclements.plus.com
Sun Jun 7 06:48:43 EDT 2009


chris carleton wrote:

> Do you think I could use G_put_map_row_random
> to fill a new raster with the modified values of cells at various
> locations in the region and then use patch to change the original
> raster?

Note that G_put_map_row_random() has been removed in 7.0. Nothing was
using it, and it only works with pre-5.0 rasters (no support for
floating-point or nulls).

> What would the other cell locations contain in a raster map
> written in this way (nulls, zeros, nothing)?

Zeros. When you open a new map with G_open_cell_new_random(), the
output file is filled with zeros. These are then overwritten by
G_put_map_row_random().

> To help clarify,
> I'm writing a GRASS_ABM extension and the agents will need to modify
> the rasters they interact with, but the simulation could run for
> thousands of iterations and I want to maximize speed and minimize
> memory usage. Once I get a working skeleton of ABM functions together
> (move, read raster, change raster, spawn new agents, die) then
> I'll clean up the messy code, document, and let the ABM mailing
> list know about the progress.

You may be better off using a plain file to store intermediate data,
and exporting to a GRASS raster at the end.

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-dev mailing list