[GRASS-dev] still problems with overwrite in scripts
Michael Barton
michael.barton at asu.edu
Thu Jun 28 09:26:07 PDT 2012
Thanks, but neither are relevant (or work) in my case. See below.
> 2012/6/26 Michael Barton <Michael.Barton at asu.edu>:
>> What is the test for the parser based overwrite flag?
>
> as I told you the flag is added by parser automatically when there is
> at least one option which is dedicated for output, eg. G_OPT_V_OUTPUT
> or G_OPT_F_OUTPUT.
I don't want a pull down list of existing files. I just want a string option so that users can enter a prefix to create 3 output files.
So %# type: string.
Of course this does not automatically add the overwrite flag
>
> Martin
>
> --
> Martin Landa <landa.martin gmail.com> * http://geo.fsv.cvut.cz/~landa
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.
I wrote a workaround using an -o flag. But if there is some other way to do this, let me know.
It will help when the g.parser docs are updated from the current BASH centric examples to use G_OPT_R_OUTPUT, G_OPT_V_OUTPUT, and other such function that currently only show up in the C part of the programmer's manual.
Michael
> Hi,
>
> 2012/6/26 Michael Barton <Michael.Barton at asu.edu>:
>> Is there some special way to specify an overwrite flag in a script? Or is it
>> just:
>
> overwrite flag should be added automatically by the parser when the
> module produces any output. In really special cases you can force
> adding overwrite flag by
>
> #%module
> ...
> #% overwrite: yes
> #%end
>
> Martin
>
> --
> Martin Landa <landa.martin gmail.com> * http://geo.fsv.cvut.cz/~landa
On Jun 28, 2012, at 1:10 AM, Martin Landa wrote:
> Hi,
>
> 2012/6/28 Michael Barton <michael.barton at asu.edu>:
>> #%option G_OPT_R_INPUT
>> #% key: ms3
>> #% description: Input raster map for red channel
>> #%end
>>
>> So there is no way to add "new" unless I redo the options section.
>
> but this is standard option for input not output! "new" refers to
> `gisprompt`. Eg.
>
> #% gisprompt: new,cell,raster
>
> but is added automatically e.g. for G_OPT_R_OUTPUT.
>
>> I added "#% overwrite: yes" by itself,
>>
>> as...
>>
>> #%option
>> #% overwrite: yes
>> #%end
>
> wrong, see my previous answer (just read it carefully)
>
> #%module
> ...
> #% overwrite: yes
> #%end
>
> Martin
>
> --
> Martin Landa <landa.martin gmail.com> * http://geo.fsv.cvut.cz/~landa
_____________________
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