[GRASS-dev] Using the new s flag or seed option for r.mapcalc in a python script

Anna Petrášová kratochanna at gmail.com
Sat Jul 26 17:53:49 PDT 2014

On Sat, Jul 26, 2014 at 6:15 PM, Glynn Clements <glynn at gclements.plus.com>

> Anna Petrášová wrote:
> > > > How do I use this new flag / seed parameter for r.mapcalc in python
> > > > scripts?
> > >
> > > I'll update the Python interface.
> >
> > How? If we change the interface, I would like to be able to also pass env
> > to write_command.
> Do you mean passing arbitrary environment variables through
> grass.script.mapcalc() down to the underlying r.mapcalc command?
> Which environment variables would be useful?

For example when you want to parallelize multiple r.mapcalc calls with
different region settings. You would copy the environment, change the
region (e.g. set WIND_OVERRIDE) or even mapset or location and pass it to
r.mapcalc without interfering with the current environment. I can do that
now with run_command('r.mapcalc', ..., env=myEnv), it would be just more
convenient to have it in the grass.script.mapcalc(). In fact, the same
applies to other wrappers in grass.script, for example raster_what.
Currently when querying raster in the gui, the GRASS_REGION is changed to
match the raster before the query and restored afterwards. In my opinion,
it would be just much more elegant (and would require less code) and less
error prone, not to change the environment globally but just for the r.what


> --
> Glynn Clements <glynn at gclements.plus.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20140726/95a3f6b4/attachment.html>

More information about the grass-dev mailing list