[GRASS-dev] help
Markus Neteler
neteler at osgeo.org
Tue Apr 22 05:40:06 PDT 2014
On Thu, Mar 20, 2014 at 7:45 PM, Vaclav Petras <wenzeslaus at gmail.com> wrote:
> I actually forgot one useful thing which is not documented anywhere, as
far
> as I know: You can run some module which has similar parameters as the
> module (script) you want to write (or you can just use any module) with
the
> parameter --script and you will get the template for your script. This is
> useful for building a nice interface for your script (command line
> processing ).
.. indeed a nice feature! But would it be nice to have not only:
r.profile --script
#!/usr/bin/env python
############################################################################
#
# MODULE: r.profile_wrapper
...
#% key: null
#% type: string
#% required: no
#% multiple: no
#% description: Character to represent no data cell
#% answer: *
#%end
import sys
import grass.script as grass
def main():
# put code here
return 0
if __name__ == "__main__":
options, flags = grass.parser()
sys.exit(main())
... this part of the script but for the truly lazy also the respective
grass.run_command() call included?
Something like
coords = options['coordinates']
grass.run_command('r.profile',
input = input_map,
output = output_file,
profile = coords)
or, perhaps better, the code snippet compliant with pyGRASS
http://grasswiki.osgeo.org/wiki/Python/pygrass
?
(maybe an answer to http://trac.osgeo.org/grass/ticket/2226 )
Markus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20140422/0c1b0b90/attachment.html>
More information about the grass-dev
mailing list