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

Glynn Clements glynn at gclements.plus.com
Mon Jul 28 08:59:28 PDT 2014


Anna Petrášová wrote:

> > > 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
> module.

Okay, done in r61428.

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


More information about the grass-dev mailing list