[GRASS-dev] help

Glynn Clements glynn at gclements.plus.com
Tue Apr 22 15:56:40 PDT 2014


Markus Neteler wrote:

> .. indeed a nice feature! But would it be nice to have not only:

> ... this part of the script but for the truly lazy also the respective
> grass.run_command() call included?

If you're generating a "front end" for a module, exec_command() may be
more appropriate.

> Something like
> 
> coords = options['coordinates']
> grass.run_command('r.profile',
>                input = input_map,
>                output = output_file,
>                profile = coords)

Choosing variable names has a minor complication, in that there are a
couple of option names which are Python keywords (e.g. "from").

If you just want to get rid of the dictionary syntax, the options
could be stored in an object which supports both attribute-style and
key-style access, so you could use either options.coordinates or
options['coordinates'].

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


More information about the grass-dev mailing list