[GRASS-dev] inconsistency between G_OPT_V_INPUT and G_OPT_R_INPUT

Pietro peter.zamb at gmail.com
Wed May 13 06:47:06 PDT 2015


Hi Martin,

On Wed, May 13, 2015 at 11:08 AM, Martin Landa <landa.martin at gmail.com> wrote:
> Hi,
>
> 2015-05-13 8:03 GMT+02:00 Pietro <peter.zamb at gmail.com>:
>> #% description: Name of vector map with interested segments of rivers
>
> <- label

Therefore I should use label instead of description, something like:

{{{
#!/usr/bin/env python
# -- coding: utf-8 --
#%module
#% description: Test
#% keywords: test
#%end
#%option G_OPT_R_INPUT
#% key: discharge
#% label: Name of river discharge [m3/s]
#% required: yes
#%end
#%option G_OPT_V_INPUT
#% key: river
#% label: Name of vector map with interested segments of rivers
#% required: yes
#%end
from __future__ import print_function
import sys

# import grass libraries
from grass.script import core as gcore


def main(opts, flgs):
    print(opts, flgs)

if __name__ == "__main__":
    options, flags = gcore.parser()
    sys.exit(main(options, flags))
}}}

The GUI is now fine and the command output looks:

{{{$ r.example --h

Description:
 Test

Keywords:
 test

Usage:
 r.example discharge=name river=name [--help] [--verbose] [--quiet]
   [--ui]

Flags:
 --h   Print usage summary
 --v   Verbose module output
 --q   Quiet module output
 --ui  Force launching GUI dialog

Parameters:
  discharge   Name of river discharge [m3/s]
               Name of input raster map
      river   Name of vector map with interested segments of rivers
               Or data source for direct OGR access
}}}


>> As you can see the description of the parameter add the default
>> description set in G_OPT_V_INPUT and in a new line the description
>> added manually in the definition of the module parameters. Instead the
>> G_OPT_R_INPUT shows only the description set manually.
>
> right, G_OPT_V_INPUT has defined both label and description [1]. This
> the source of inconsistency. There are more standard options which
> defines both label and description.

Do you think this inconsistency should be fix, or just reported
somewhere on a Wiki page?

All the best.

Pietro


More information about the grass-dev mailing list