Hi,
when I tried to write a python script (add-on) for GRASS GIS I experienced
that there is no overwrite-flag by default in the GUI for that module (generate by
g.parser) which is different from GRASS6x. So is there any possibility to create
that tick-box also in G70?
Furthermore I am using the grass.script.array to write a raster map from
a numpy.array:
my_map = garray.array()
my_map[…] = my_function_mod(input_raster)
my_map.write(options[‘my_output’])
But what if the output (“my_output”) already exists and I want to overwrite
that output (e.g. by setting the modules overwrite flag)?
Any suggestions are welcome, thanks!
cheers,
/Johannes
On 30 September 2013 17:10, Johannes Radinger
<johannesradinger@gmail.com> wrote:
Hi,
Hi
when I tried to write a python script (add-on) for GRASS GIS I experienced
that there is no overwrite-flag by default in the GUI for that module
(generate by
g.parser) which is different from GRASS6x. So is there any possibility to
create
that tick-box also in G70?
Furthermore I am using the grass.script.array to write a raster map from
a numpy.array:
my_map = garray.array()
my_map[...] = my_function_mod(input_raster)
my_map.write(options['my_output'])
But what if the output ("my_output") already exists and I want to overwrite
that output (e.g. by setting the modules overwrite flag)?
overwrite flag should be in the parser, you have to check if overwrite
is active and if your map already exits.
You can check if the overwrite is active with "grass.overwrite()"
Any suggestions are welcome, thanks!
cheers,
/Johannes
--
ciao
Luca
http://gis.cri.fmach.it/delucchi/
www.lucadelu.org
Thank you Luca,
the problem was that in the options settings the parameter gisprompt for
the output did not contain “new”. After changing the line to gispromt: new,
the overwrite option was available.
Thank you for the tip with the “grass.overwrite()” which returns TRUE if
overwrite is set.
/Johannes
···
On Mon, Sep 30, 2013 at 11:17 PM, Luca Delucchi <lucadeluge@gmail.com> wrote:
On 30 September 2013 17:10, Johannes Radinger
<johannesradinger@gmail.com> wrote:
Hi,
Hi
when I tried to write a python script (add-on) for GRASS GIS I experienced
that there is no overwrite-flag by default in the GUI for that module
(generate by
g.parser) which is different from GRASS6x. So is there any possibility to
create
that tick-box also in G70?
Furthermore I am using the grass.script.array to write a raster map from
a numpy.array:
my_map = garray.array()
my_map[…] = my_function_mod(input_raster)
my_map.write(options[‘my_output’])
But what if the output (“my_output”) already exists and I want to overwrite
that output (e.g. by setting the modules overwrite flag)?
overwrite flag should be in the parser, you have to check if overwrite
is active and if your map already exits.
You can check if the overwrite is active with “grass.overwrite()”
Any suggestions are welcome, thanks!
cheers,
/Johannes
–
ciao
Luca
http://gis.cri.fmach.it/delucchi/
www.lucadelu.org