[GRASS-dev] still problems with overwrite in scripts

Michael Barton michael.barton at asu.edu
Thu Jun 28 12:16:23 PDT 2012


Works perfectly.

Michael

On Jun 28, 2012, at 12:43 PM, Glynn Clements wrote:

> 
> Michael Barton wrote:
> 
>> My question was about testing for the overwrite flag. But I did try
>> this, as I mentioned in my post to Glynn and get an error wherever I
>> put it. I tried in the string option for output prefix first, of
>> course. But when that didn't work, I tried in the input and
>> pull-down for sharpening algorithm too. No luck anywhere. If it only
>> works in an option specified by G_OPT_R_OUTPUT and G_OPT_V_OUTPUT
>> automatically generates and overwrite flag box without adding it, it
>> seems kind of redundant. Shrug.
> 
> The "overwrite" setting goes in the module section (along with
> keywords), not the options/flags sections.
> 
> In C (this is from r.mapcalc):
> 
>    module = G_define_module();
>    G_add_keyword(_("raster"));
>    G_add_keyword(_("algebra"));
>    module->description = _("Raster map calculator.");
>    module->overwrite = 1;
> 
> In Python (there aren't any scripts which currently require this
> feature, so this is contrived):
> 
> 	#%module
> 	#% description: This is a script
> 	#% keywords: script
> 	#% overwrite: yes
> 	#%end
> 
> It only works in 7.0. In 6.x, g.parser won't recognise the overwrite
> setting, and using it in C will force the overwrite setting on due to
> bug #1658.
> 
> -- 
> Glynn Clements <glynn at gclements.plus.com>

_____________________
C. Michael Barton
Visiting Scientist, Integrated Science Program
National Center for Atmospheric Research &
University Corporation for Atmospheric Research
303-497-2889 (voice)

Director, Center for Social Dynamics & Complexity 
Professor of Anthropology, School of Human Evolution & Social Change
Arizona State University
www: http://www.public.asu.edu/~cmbarton, http://csdc.asu.edu



More information about the grass-dev mailing list