[GRASS-dev] how to do g.region n=n+(defined by user input option) in a python script?

2014-05-08 Thread Helmut Kudrnovsky
hi, I'm trying to understand how to use g.region n=n+x s=s-x e=e+x w=w-x in a python script, where x is a user option. some code snippets: #%option #% key: region_extension #% type: double #% key_desc: float #% description: region extension #% required : no #% answer: 5000 #%end [...]

Re: [GRASS-dev] how to do g.region n=n+(defined by user input option) in a python script?

2014-05-08 Thread Martin Landa
Hi, 2014-05-08 13:39 GMT+02:00 Helmut Kudrnovsky hel...@web.de: hi, I'm trying to understand how to use g.region n=n+x s=s-x e=e+x w=w-x in a python script, where x is a user option. some code snippets: #%option #% key: region_extension #% type: double #% key_desc: float #%

Re: [GRASS-dev] how to do g.region n=n+(defined by user input option) in a python script?

2014-05-08 Thread Glynn Clements
Helmut Kudrnovsky wrote: regext = options['region_extension'] with current_region = grass.region() n = current_region[n] s = current_region[s] e = current_region[e] w = current_region[w] it could be defined, but then it says Traceback (most recent call last): File

Re: [GRASS-dev] how to do g.region n=n+(defined by user input option) in a python script?

2014-05-08 Thread Markus Neteler
Hi, please consider to add best practice to http://grasswiki.osgeo.org/wiki/GRASS_Python_Scripting_Library#Parsing_the_options_and_flags thanks Markus ___ grass-dev mailing list grass-dev@lists.osgeo.org

Re: [GRASS-dev] how to do g.region n=n+(defined by user input option) in a python script?

2014-05-08 Thread Helmut Kudrnovsky
regext will be a string; you need to use e.g. regext = float(regext) before you can do arithmetic with it. ah, I see it now. Also, unless the purpose of the script is to modify the region for subsequent commands, either use use_temp_region() to localise any changes to the script.