[GRASS-user] How to create+use reclass or recode rules in a python
script
Glynn Clements
glynn at gclements.plus.com
Thu Dec 1 01:40:43 EST 2011
Moritz Lennert wrote:
> I'm pretty sure someone has already answered this, but cannot get my
> hands on the relevant mail: which grass python lib function should I use
> and how in order to be able to feed r.recode, r.reclass, r.colors, etc
> rules on the fly ?
feed_command() or write_command().
The former returns a Popen object, so you can write to its .stdin
member. You need to call p.stdin.close() and p.wait() once you're
done.
The latter accepts the input as a string via the stdin= parameter,
waits for completion and returns the exit status.
--
Glynn Clements <glynn at gclements.plus.com>
More information about the grass-user
mailing list