Re: [GRASS-dev] Overwrite flag in Grass70 python scripts with grass.script.array array ?

2013-10-01 Thread Johannes Radinger
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 lucadel...@gmail.comwrote:

 On 30 September 2013 17:10, Johannes Radinger
 johannesradin...@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

___
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

[GRASS-dev] Overwrite flag in Grass70 python scripts with grass.script.array array ?

2013-09-30 Thread Johannes Radinger
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
___
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

Re: [GRASS-dev] Overwrite flag in Grass70 python scripts with grass.script.array array ?

2013-09-30 Thread Luca Delucchi
On 30 September 2013 17:10, Johannes Radinger
johannesradin...@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
___
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev