浏览代码

python scripts: use standard option
standardize option names


git-svn-id: https://svn.osgeo.org/grass/grass/trunk@47426 15284696-431f-4ddb-bdfa-cd5b030d7da7

Martin Landa 13 年之前
父节点
当前提交
452a0d081f
共有 65 个文件被更改,包括 639 次插入1358 次删除
  1. 8 13
      scripts/d.correlate/d.correlate.py
  2. 3 10
      scripts/d.polar/d.polar.py
  3. 21 38
      scripts/d.rast.edit/d.rast.edit.py
  4. 10 16
      scripts/d.rast.leg/d.rast.leg.py
  5. 7 13
      scripts/d.shadedmap/d.shadedmap.py
  6. 44 74
      scripts/d.vect.thematic/d.vect.thematic.py
  7. 2 11
      scripts/db.dropcolumn/db.dropcolumn.py
  8. 10 14
      scripts/db.droptable/db.droptable.py
  9. 1 1
      scripts/db.in.ogr/db.in.ogr.py
  10. 13 16
      scripts/db.out.ogr/db.out.ogr.py
  11. 12 12
      scripts/db.test/db.test.py
  12. 6 19
      scripts/i.fusion.brovey/i.fusion.brovey.py
  13. 11 25
      scripts/i.image.mosaic/i.image.mosaic.py
  14. 8 17
      scripts/i.in.spotvgt/i.in.spotvgt.py
  15. 13 22
      scripts/i.landsat.rgb/i.landsat.rgb.py
  16. 12 31
      scripts/i.oif/i.oif.py
  17. 5 22
      scripts/i.spectral/i.spectral.py
  18. 28 47
      scripts/i.tasscap/i.tasscap.py
  19. 10 22
      scripts/m.proj/m.proj.py
  20. 9 17
      scripts/r.blend/r.blend.py
  21. 12 30
      scripts/r.buffer/r.buffer.py
  22. 4 10
      scripts/r.colors.stddev/r.colors.stddev.py
  23. 5 15
      scripts/r.fillnulls/r.fillnulls.py
  24. 16 30
      scripts/r.grow/r.grow.py
  25. 4 16
      scripts/r.in.aster/r.in.aster.py
  26. 4 11
      scripts/r.in.srtm/r.in.srtm.py
  27. 4 6
      scripts/r.in.wms/r.in.gdalwarp.py
  28. 1 5
      scripts/r.in.wms/r.in.wms.py
  29. 3 7
      scripts/r.mask/r.mask.py
  30. 6 22
      scripts/r.out.xyz/r.out.xyz.py
  31. 2 11
      scripts/r.pack/r.pack.py
  32. 8 13
      scripts/r.plane/r.plane.py
  33. 13 22
      scripts/r.reclass.area/r.reclass.area.py
  34. 14 18
      scripts/r.rgb/r.rgb.py
  35. 50 58
      scripts/r.shaded.relief/r.shaded.relief.py
  36. 3 12
      scripts/r.tileset/r.tileset.py
  37. 3 12
      scripts/r.unpack/r.unpack.py
  38. 4 25
      scripts/v.centroids/v.centroids.py
  39. 7 30
      scripts/v.colors/v.colors.py
  40. 6 6
      scripts/v.convert.all/v.convert.all.py
  41. 9 21
      scripts/v.db.addcolumn/v.db.addcolumn.py
  42. 15 21
      scripts/v.db.addtable/v.db.addtable.py
  43. 11 23
      scripts/v.db.dropcolumn/v.db.dropcolumn.py
  44. 6 26
      scripts/v.db.droprow/v.db.droprow.py
  45. 4 16
      scripts/v.db.droptable/v.db.droptable.py
  46. 10 27
      scripts/v.db.join/v.db.join.py
  47. 14 20
      scripts/v.db.reconnect.all/v.db.reconnect.all.py
  48. 10 21
      scripts/v.db.renamecolumn/v.db.renamecolumn.py
  49. 18 39
      scripts/v.db.univar/v.db.univar.py
  50. 15 41
      scripts/v.db.update/v.db.update.py
  51. 8 30
      scripts/v.dissolve/v.dissolve.py
  52. 9 24
      scripts/v.in.e00/v.in.e00.py
  53. 9 20
      scripts/v.in.geonames/v.in.geonames.py
  54. 10 18
      scripts/v.in.gns/v.in.gns.py
  55. 6 21
      scripts/v.in.lines/v.in.lines.py
  56. 12 19
      scripts/v.in.mapgen/v.in.mapgen.py
  57. 2 2
      scripts/v.in.sites.all/v.in.sites.all.py
  58. 3 7
      scripts/v.in.wfs/v.in.wfs.py
  59. 10 19
      scripts/v.krige/v.krige.py
  60. 6 30
      scripts/v.out.gps/v.out.gps.py
  61. 3 21
      scripts/v.rast.stats/v.rast.stats.py
  62. 13 30
      scripts/v.report/v.report.py
  63. 18 39
      scripts/v.what.vect/v.what.vect.py
  64. 8 12
      scripts/wxpyimgview/wxpyimgview.py
  65. 8 12
      scripts/wxpyimgview/wxpyimgview_gui.py

+ 8 - 13
scripts/d.correlate/d.correlate.py

@@ -13,21 +13,16 @@
 #               License (>=v2). Read the file COPYING that comes with GRASS
 #               for details.
 #
-# TODO GRASS 7: rename parameters to map1, map2 or better multiple map=map1[,map2[...]]
 #############################################################################
 
-#%Module
-#%  description: Prints a graph of the correlation between data layers (in pairs).
-#%  keywords: display
-#%  keywords: diagram
-#%End
-#%option
-#% key: layers
-#% type: string
-#% gisprompt: old,cell,raster
-#% description: raster input map
-#% required: yes
-#% multiple: yes
+#%module
+#% description: Prints a graph of the correlation between raster maps (in pairs).
+#% keywords: display
+#% keywords: raster
+#% keywords: diagram
+#% keywords: correlation
+#%end
+#%option G_OPT_R_MAPS
 #%end
 
 import sys

+ 3 - 10
scripts/d.polar/d.polar.py

@@ -23,13 +23,8 @@
 #%  keywords: display
 #%  keywords: diagram
 #%End
-#%option
-#% key: map
-#% type: string
-#% key_desc: name
-#% gisprompt: old,cell,raster
+#%option G_OPT_R_MAP
 #% description: Name of raster angle map
-#% required : yes
 #%End
 #%option
 #% key: undef
@@ -37,11 +32,9 @@
 #% description: Pixel value to be interpreted as undefined (different from NULL)
 #% required : no
 #%End
-#%option
+#%option G_OPT_F_OUTPUT
 #% key: eps
-#% type: string
-#% gisprompt: new_file,file,output
-#% description: Name of optional EPS output file
+#% description: Name for optional EPS output file
 #% required : no
 #%end
 #%flag

+ 21 - 38
scripts/d.rast.edit/d.rast.edit.py

@@ -18,78 +18,61 @@
 #
 #############################################################################/
 
-#%Module
-#% description: Interactively edit cell values in a raster map.
+#%module
+#% description: Edits cell values in a raster map.
 #% keywords: display
 #% keywords: raster
-#%End
-#%Option
-#% key: input
-#% type: string
-#% required: yes
-#% multiple: no
-#% key_desc: name
-#% description: Name of input raster map
-#% gisprompt: old,cell,raster
-#%End
-#%Option
-#% key: output
-#% type: string
-#% required: yes
-#% multiple: no
-#% key_desc: name
-#% description: Name for output raster map
-#% gisprompt: new,cell,raster
-#%End
-#%Option
+#% keywords: edit
+#%end
+#%option G_OPT_R_INPUT
+#%end
+#%option G_OPT_R_OUTPUT
+#%end
+#%option G_OPT_R_INPUT
 #% key: aspect
-#% type: string
 #% required: no
-#% multiple: no
-#% key_desc: name
-#% description: Name of aspect raster map
-#% gisprompt: old,cell,raster
-#%End
-#%Option
+#% description: Name of input aspect raster map
+#%end
+#%option
 #% key: width
 #% type: integer
 #% required: no
 #% multiple: no
 #% description: Width of display canvas
 #% answer: 640
-#%End
-#%Option
+#%end
+#%option
 #% key: height
 #% type: integer
 #% required: no
 #% multiple: no
 #% description: Height of display canvas
 #% answer: 480
-#%End
-#%Option
+#%end
+#%option
 #% key: size
 #% type: integer
 #% required: no
 #% multiple: no
 #% description: Minimum size of each cell
 #% answer: 12
-#%End
-#%Option
+#%end
+#%option
 #% key: rows
 #% type: integer
 #% required: no
 #% multiple: no
 #% description: Maximum number of rows to load
 #% answer: 100
-#%End
-#%Option
+#%end
+#%option
 #% key: cols
 #% type: integer
 #% required: no
 #% multiple: no
 #% description: Maximum number of columns to load
 #% answer: 100
-#%End
+#%end
 
 import sys
 import math

+ 10 - 16
scripts/d.rast.leg/d.rast.leg.py

@@ -36,10 +36,10 @@
 # Glynn Clements 10/2008: converted to Python
 ##############################################################################
 
-#%Module
-#%  description: Displays a raster map and its legend on a graphics window
-#%  keywords: display
-#%End
+#%module
+#% description: Displays a raster map and its legend on a graphics window
+#% keywords: display
+#%end
 #%flag
 #%  key: f
 #%  description: Flip legend
@@ -48,25 +48,19 @@
 #%  key: n
 #%  description: Omit entries with missing label
 #%end
-#%option
-#% key: map
-#% type: string
-#% gisprompt: old,cell,raster
+#%option G_OPT_R_MAP
 #% description: Name of raster map to display
-#% required : yes
 #%end
 #%option
 #% key: lines
 #% type: integer
 #% description: Number of lines to appear in the legend
-#% required : no
+#% required: no
 #%end
-#%option
-#% key: rast
-#% type: string
-#% gisprompt: old,cell,raster
-#% description: Name of raster map to generate legend from
-#% required : no
+#%option G_OPT_R_INPUT
+#% key: raster
+#% description: Name of input raster map to generate legend from
+#% required: no
 #%end
 
 import sys

+ 7 - 13
scripts/d.shadedmap/d.shadedmap.py

@@ -14,23 +14,17 @@
 #
 #############################################################################
 
-#%Module
-#% description: Drapes a color raster over a shaded relief map using d.his
+#%module
+#% description: Drapes a color raster over a shaded relief map.
 #% keywords: display
-#%End
-#%option
+#%end
+#%option G_OPT_R_INPUT
 #% key: reliefmap
-#% type: string
-#% gisprompt: old,cell,raster
-#% description: Name of shaded relief or aspect map
-#% required : yes
+#% description: Name of shaded relief or aspect raster map
 #%end
-#%option
+#%option G_OPT_R_INPUT
 #% key: drapemap
-#% type: string
-#% gisprompt: old,cell,raster
-#% description: Name of raster to drape over relief map
-#% required : yes
+#% description: Name of raster to drape over relief raster map
 #%end
 #%option
 #% key: brighten

+ 44 - 74
scripts/d.vect.thematic/d.vect.thematic.py

@@ -16,189 +16,159 @@
 #############################################################################
 
 
-#%Module
+#%module
 #% description: Displays thematic vector map
 #% keywords: display
 #% keywords: vector
 #% keywords: thematic
 #% keywords: legend
-#%End
-#%option
-#% guisection: Files
-#% key: map
-#% type: string
-#% gisprompt: old,vector,vector
-#% description: Name of vector map
-#% required : yes
 #%end
-#%option
-#% guisection: Theme
-#% key: type
-#% type: string
-#% description: Feature type
-#% options: area,point,centroid,line,boundary
-#% answer: area
-#% required : yes
+#%option G_OPT_V_MAP
 #%end
-#%option
-#% guisection: Theme
-#% key: column
-#% gisprompt: old_dbcolumn,dbcolumn,dbcolumn
-#% type: string
+#%option G_OPT_V_FIELD
+#%end
+#%option G_OPT_DB_COLUMN
 #% description: Name of attribute column to use for thematic display (must be numeric)
-#% required : yes
+#% required: yes
+#%end
+#%option G_OPT_V_TYPE
+#% answer: area
 #%end
 #%option
-#% guisection: Theme
 #% key: themetype
 #% type: string
 #% options: graduated_colors,graduated_points,graduated_lines
 #% answer: graduated_colors
 #% description: Type of thematic display
-#% required : yes
+#% required: yes
+#% guisection: Theme
 #%end
 #%option
-#% guisection: Theme
 #% key: themecalc
 #% type: string
 #% options: interval,std_deviation,quartiles,custom_breaks
 #% answer: interval
 #% description: Thematic divisions of data for display
-#% required : yes
+#% required: yes
+#% guisection: Theme
 #%end
 #%option
-#% guisection: Theme
 #% key: breakpoints
 #% type: string
 #% label: Break points for custom breaks option
 #% description: Separate values by spaces (0 10 20 30 ...)
-#% required : no
-#%end
-#%option
+#% required: no
 #% guisection: Theme
-#% key: layer
-#% type: integer
-#% gisprompt: old_layer,layer,layer
-#% description: Layer number
-#% answer: 1
-#% required : no
 #%end
 #%option
-#% guisection: Points
 #% key: icon
 #% type: string
 #% description: Vector point icon for point data
 #% options: basic/box,basic/circle,basic/cross2,basic/diamond,basic/star,basic/cross1,basic/x
 #% answer: basic/circle
-#% required : no
+#% required: no
+#% guisection: Points
 #%end
 #%option
-#% guisection: Points
 #% key: size
 #% type: double
 #% label: Icon size for point data
 #% description: Minimum icon size/line width for graduated points/lines)
 #% answer: 5
-#% required : no
+#% required: no
+#% guisection: Points
 #%end
 #%option
-#% guisection: Points
 #% key: maxsize
 #% type: double
 #% description: Maximum icon size/line width for graduated points and lines
 #% answer: 20
-#% required : no
+#% required: no
+#% guisection: Points
 #%end
 #%option
-#% guisection: Theme
 #% key: nint
 #% type: integer
 #% description: Number of classes for interval theme (integer)
 #% answer: 4
-#% required : no
+#% required: no
+#% guisection: Theme
 #%end
 #%option
-#% guisection: Color
 #% key: colorscheme
 #% type: string
 #% label: Color scheme for graduated color mapping
 #% description: Select 'single_color' for graduated point/line display
 #% options: blue-red,red-blue,green-red,red-green,blue-green,green-blue,cyan-yellow,yellow-cyan,custom_gradient,single_color
 #% answer: blue-red
-#% required : yes
+#% required: yes
+#% guisection: Color
 #%end
 #% option
-#% guisection: Color
 #% key: pointcolor
 #% type: string
 #% label: Color for graduated points map
 #% description: GRASS named color or R:G:B triplet. Set color scheme to single color
 #% answer: 255:0:0
-#% required : no
+#% required: no
+#% guisection: Color
 #%end
 #% option
-#% guisection: Color
 #% key: linecolor
 #% type: string
 #% label: Color for graduated lines or point/area outlines
 #% description: GRASS named color or R:G:B triplet. Set color scheme to single color.
 #% answer: 0:0:0
-#% required : no
+#% required: no
+#% guisection: Color
 #%end
 #% option
-#% guisection: Color
 #% key: startcolor
 #% type: string
 #% label: Beginning color for custom color gradient
 #% description: Must be expressed as R:G:B triplet
 #% answer: 255:0:0
-#% required : no
+#% required: no
+#% guisection: Color
 #%end
 #% option
-#% guisection: Color
 #% key: endcolor
 #% type: string
 #% label: Ending color for custom color gradient
 #% description: Must be expressed as R:G:B triplet
 #% answer: 0:0:255
-#% required : no
+#% required: no
+#% guisection: Color
 #%end
 #% option
-#% guisection: Misc
 #% key: monitor
 #% type: string
-#% description: Select x11 display monitor for legend
-#% options: x0,x1,x2,x3,x4,x5,x6,none
-#% answer: x1
-#% required : no
+#% description: Select WXGUI display monitor for legend
+#% options: wx0,wx1,wx2,wx3,wx4,wx5,wx6,none
+#% answer: wx1
+#% required: no
+#% guisection: Misc
 #%end
 #%flag 
 #% guisection: Files
-#%key: g
+#% key: g
 #%description: Save thematic map commands to group file for GIS Manager
 #%end
-#%option
+#%option G_OPT_DB_WHERE
 #% guisection: Theme
-#% key: where
-#% type: string
-#% description: WHERE conditions of SQL statement without 'where' keyword
-#% required : no
 #%end
 #%option
-#% guisection: Files
 #% key: psmap
 #% type: string
 #% label: Root for the name of psmap instruction files to be in current directory
 #% description: If not set, no psmap instruction files will be created)
-#% required : no
-#%end
-#%option
+#% required: no
 #% guisection: Files
-#% key: group
-#% type: string
-#% gisprompt: new_file,file,group
+#%end
+#%option G_OPT_I_GROUP
 #% description: Name of group file where thematic map commands will be saved
-#% required : no
+#% required: no
+#% guisection: Files
 #%end
 #%flag 
 #% guisection: Theme

+ 2 - 11
scripts/db.dropcolumn/db.dropcolumn.py

@@ -28,21 +28,12 @@
 #%  description: Force removal (required for actual deletion of files)
 #%end
 
-#%option
-#% key: table
-#% type: string
-#% key_desc : name
-#% description: Table from which to drop attribute column
+#%option G_OPT_DB_TABLE
 #% required : yes
-#% gisprompt: old_dbtable,dbtable,dbtable
 #%end
 
-#%option
-#% key: column
-#% type: string
-#% description: Name of the column
+#%option G_OPT_DB_COLUMN
 #% required : yes
-#% gisprompt: old,dbcolumn,dbcolumn
 #%end
 
 import sys

+ 10 - 14
scripts/db.droptable/db.droptable.py

@@ -15,24 +15,20 @@
 #############################################################################
 
 
-#%Module
-#%  description: Drops an attribute table.
-#%  keywords: database
-#%  keywords: attribute table
-#%End
+#%module
+#% description: Drops an attribute table.
+#% keywords: database
+#% keywords: attribute table
+#%end
 
 #%flag
-#%  key: f
-#%  description: Force removal (required for actual deletion of files)
+#% key: f
+#% description: Force removal (required for actual deletion of files)
 #%end
 
-#%option
-#% key: table
-#% type: string
-#% key_desc : name
-#% description: Table to drop
-#% required : yes
-#% gisprompt: old_dbtable,dbtable,dbtable
+#%option G_OPT_DB_TABLE
+#% description: Table name to drop
+#% required: yes
 #%end
 
 import sys

+ 1 - 1
scripts/db.in.ogr/db.in.ogr.py

@@ -37,7 +37,7 @@
 #% required : no
 #%end
 
-#%option
+#%option 
 #% key: output
 #% type: string
 #% description: Name for output table

+ 13 - 16
scripts/db.out.ogr/db.out.ogr.py

@@ -14,24 +14,21 @@
 #
 #############################################################################
 
-#%Module
-#%  description: Exports attribute tables into various formats.
-#%  keywords: database
-#%  keywords: attribute table
-#%End
+#%module
+#% description: Exports attribute tables into various formats.
+#% keywords: database
+#% keywords: attribute table
+#%end
 
-#%option
+#%option G_OPT_DB_TABLE
 #% key: input
-#% type: string
-#% key_desc : name
-#% description: GRASS table name
-#% required : yes
+#% required: yes
 #%end
 
 #%option
 #% key: dsn
 #% type: string
-#% key_desc : name
+#% key_desc: name
 #% gisprompt: new_file,file,input
 #% description: Table file to be exported or DB connection string
 #% required : yes
@@ -41,17 +38,17 @@
 #% key: format
 #% type: string
 #% description: Table format
-#% required : yes
+#% required: yes
 #% options: CSV,DBF,GML,MySQL,PostgreSQL,SQLite
 #% answer: DBF
 #%end
 
 #%option
-#% key: db_table
+#% key: table
 #% type: string
-#% key_desc : name
-#% description: Name for output table
-#% required : no
+#% key_desc: name
+#% description: Name for output table (defaut: input)
+#% required: no
 #%end
 
 import sys

+ 12 - 12
scripts/db.test/db.test.py

@@ -13,18 +13,18 @@
 #
 #############################################################################
 
-#% Module
-#%  description: Test database driver, database must exist and set by db.connect.
-#%  keywords: database
-#%  keywords: attribute table
-#% End
-#% option
-#%  key: test
-#%  type: string
-#%  description: Test name
-#%  required : yes
-#%  options : test1
-#% end
+#%module
+#% description: Test database driver, database must exist and set by db.connect.
+#% keywords: database
+#% keywords: attribute table
+#%end
+#%option
+#% key: test
+#% type: string
+#% description: Test name
+#% required: yes
+#% options: test1
+#%end
 
 import sys
 import os

+ 6 - 19
scripts/i.fusion.brovey/i.fusion.brovey.py

@@ -48,39 +48,26 @@
 #%  description: SPOT sensor
 #%  guisection: Sensor
 #%END
-#%option
+#%option G_OPT_R_INPUT
 #% key: ms1
-#% type: string
-#% gisprompt: old,cell,raster
 #% description: Name of input raster map (green: tm2 | qbird_green | spot1)
-#% required : yes
 #%end
-#%option
+#%option G_OPT_R_INPUT
 #% key: ms2
-#% type: string
-#% gisprompt: old,cell,raster
 #% description: Name of input raster map (NIR: tm4 | qbird_nir | spot2
-#% required : yes
 #%end
-#%option
+#%option G_OPT_R_INPUT
 #% key: ms3
-#% type: string
-#% gisprompt: old,cell,raster
 #% description: Name of input raster map (MIR; tm5 | qbird_red | spot3
-#% required : yes
 #%end
-#%option
+#%option G_OPT_R_INPUT
 #% key: pan
-#% type: string
-#% gisprompt: old,cell,raster
 #% description: Name of input raster map (etmpan | qbird_pan | spotpan)
-#% required : yes
 #%end
 #%option
-#% key: outputprefix
+#% key: output_prefix
 #% type: string
-#% gisprompt: new,cell,raster
-#% description: Name for output raster map prefix (e.g. 'brov')
+#% description: Prefix for output raster maps
 #% required : yes
 #%end
 

+ 11 - 25
scripts/i.image.mosaic/i.image.mosaic.py

@@ -22,27 +22,16 @@
 #--------------------------------------------------
 
 
-#% Module
-#%  description: Mosaics several images and extends colormap
-#%  keywords: raster
-#%  keywords: imagery
-#%  keywords: mosaicking
-#% End
-#% option
-#% key: images
-#% type: string
-#% gisprompt: old,cell,raster
-#% description: maps for mosaic.
-#% required: yes
-#% multiple: yes
-#% end
-#%option
-#% key: output
-#% type: string
-#% gisprompt: new,cell,raster
-#% description: reclass raster output map
-#% required : no
-#%END
+#%module
+#% description: Mosaics several images and extends colormap.
+#% keywords: raster
+#% keywords: imagery
+#% keywords: mosaicking
+#%end
+#%option G_OPT_R_INPUTS
+#%end
+#%option G_OPT_R_OUTPUT
+#%end
 
 import sys
 import os
@@ -73,9 +62,6 @@ def main():
     images = options['images'].split(',')
     output = options['output']
 
-    if not output:
-	output = '.'.join(images) + '.mosaic'
-
     count = len(images)
 
     grass.warning(_('Do not forget to set region properly to cover all images.'))
@@ -102,7 +88,7 @@ def main():
     p.stdin.close()
     p.wait()
 
-    grass.message(_("Ready. File %s created.") % output)
+    grass.message(_("Done. Raster map <%s> created.") % output)
 
     # write cmd history:
     grass.raster_history(output)

+ 8 - 17
scripts/i.in.spotvgt/i.in.spotvgt.py

@@ -29,28 +29,19 @@
 #   -> correction of 0001/0001_LOG.TXT coordinates by 0.5 pixel
 #############################################################################
 
-#%Module
-#%  description: Imports SPOT VGT NDVI data into a raster map.
-#%  keywords: raster
-#%  keywords: imagery
-#%  keywords: import
-#%End
+#%module
+#% description: Imports SPOT VGT NDVI data into a raster map.
+#% keywords: imagery
+#% keywords: import
+#%end
 #%flag
 #% key: a
 #% description: Also import quality map (SM status map layer) and filter NDVI map
 #%end
-#%option
-#% key: file
-#% type: string
-#% description: Existing SPOT VGT NDVI HDF file (0001_NDV.HDF)
-#% gisprompt: old_file,file,input
-#% required : yes
+#%option G_OPT_F_INPUT
+#% description: Name of input SPOT VGT NDVI HDF file
 #%end
-#%option
-#% key: rast
-#% type: string
-#% gisprompt: new,cell,raster
-#% description: Name for output raster map
+#% option G_OPT_R_OUTPUT
 #% required : no
 #%end
 

+ 13 - 22
scripts/i.landsat.rgb/i.landsat.rgb.py

@@ -20,32 +20,23 @@
 # TODO: implement better brightness control
 #############################################################################
 
-#%Module
-#%  description: Performs auto-balancing of colors for LANDSAT images.
-#%  keywords: raster
-#%  keywords: imagery
-#%  keywords: colors
-#%End
-#%option
+#%module
+#% description: Performs auto-balancing of colors for LANDSAT images.
+#% keywords: raster
+#% keywords: imagery
+#% keywords: colors
+#%end
+#%option G_OPT_R_INPUT
 #% key: red
-#% type: string
-#% gisprompt: old,cell,raster
-#% description: LANDSAT red channel
-#% required : yes
+#% description: Name of LANDSAT red channel
 #%end
-#%option
+#%option G_OPT_R_INPUT
 #% key: green
-#% type: string
-#% gisprompt: old,cell,raster
-#% description: LANDSAT green channel
-#% required : yes
+#% description: Name of LANDSAT green channel
 #%end
-#%option
+#%option G_OPT_R_INPUT
 #% key: blue
-#% type: string
-#% gisprompt: old,cell,raster
-#% description: LANDSAT blue channel
-#% required : yes
+#% description: Name of LANDSAT blue channel
 #%end
 #%option
 #% key: strength
@@ -53,7 +44,7 @@
 #% description: Cropping intensity (upper brightness level)
 #% options: 0-100
 #% answer : 98
-#% required : no
+#% required: no
 #%end
 #%flag
 #% key: f

+ 12 - 31
scripts/i.oif/i.oif.py

@@ -29,47 +29,29 @@
 #%  keywords: imagery
 #%  keywords: statistics
 #% End
-#% option
+#% option G_OPT_R_INPUT
 #% key: image1
-#% type: string
-#% gisprompt: old,cell,raster
 #% description: LANDSAT TM band 1.
-#% required : yes
 #% end
-#% option
+#% option G_OPT_R_INPUT
 #% key: image2
-#% type: string
-#% gisprompt: old,cell,raster
 #% description: LANDSAT TM band 2.
-#% required : yes
 #% end
-#% option
+#% option G_OPT_R_INPUT
 #% key: image3
-#% type: string
-#% gisprompt: old,cell,raster
 #% description: LANDSAT TM band 3.
-#% required : yes
 #% end
-#% option
+#% option G_OPT_R_INPUT
 #% key: image4
-#% type: string
-#% gisprompt: old,cell,raster
 #% description: LANDSAT TM band 4.
-#% required : yes
 #% end
-#% option
+#% option G_OPT_R_INPUT
 #% key: image5
-#% type: string
-#% gisprompt: old,cell,raster
 #% description: LANDSAT TM band 5.
-#% required : yes
 #% end
-#% option
+#% option G_OPT_R_INPUT
 #% key: image7
-#% type: string
-#% gisprompt: old,cell,raster
 #% description: LANDSAT TM band 7.
-#% required : yes
 #% end
 #% Flag
 #% key: g
@@ -109,7 +91,7 @@ def main():
 	image[band] = options['image%d' % band]
 
     # calculate the Stddev for TM bands
-    grass.verbose("Calculating Standard deviations for all bands:")
+    grass.message(_("Calculating Standard deviations for all bands..."))
     stddev = {}
     for band in bands:
 	grass.verbose("band %d" % band)
@@ -117,7 +99,7 @@ def main():
 	kv = grass.parse_key_val(s)
 	stddev[band] = float(kv['stddev'])
 
-    grass.verbose("Calculating Correlation Matrix")
+    grass.message(_("Calculating Correlation Matrix..."))
     correlation = {}
     s = grass.read_command('r.covar', flags = 'r', map = [image[band] for band in bands])
     for i, row in zip(bands, s.splitlines()):
@@ -125,17 +107,16 @@ def main():
 	    correlation[i,j] = float(cell)
 
     # Calculate all combinations
-    grass.verbose("Calculating OIF for the 20 band combinations...")
+    grass.message(_("Calculating OIF for the 20 band combinations..."))
 
     oif = []
     for p in perms():
 	oif.append((oifcalc(stddev, correlation, *p), p))
     oif.sort(reverse = True)
 
-    grass.verbose("Ready.")
-    grass.verbose("The Optimum Index Factor analysis result:")
-    grass.verbose("    (Best combination comes first.)")
-
+    grass.verbose(_("The Optimum Index Factor analysis result "
+                    "(Best combination comes first):"))
+    
     if shell:
 	fmt = "%d%d%d:%f\n"
     else:

+ 5 - 22
scripts/i.spectral/i.spectral.py

@@ -27,35 +27,18 @@
 #%  keywords: raster
 #%  keywords: multispectral
 #%End
-#%option
-#% key: group
-#% type: string
-#% gisprompt: old,group
-#% description: Group input
+#%option G_OPT_I_GROUP
 #% required : no
 #%end
-#%option
-#% key: raster
-#% type: string
-#% gisprompt: old,cell,raster
-#% description: Raster input maps
-#% multiple : yes
+#%option G_OPT_R_INPUTS
 #% required : no
 #%end
-#%option
+#%option G_OPT_F_OUTPUT
 #% key: output
-#% type: string
-#% gisprompt: new_file,file,PNG
-#% description: Write output to PNG image
-#% multiple : no
+#% description: Name for output PNG image
 #% required : no
 #%end
-#%option
-#% key: coords
-#% type: double
-#% key_desc: east,north
-#% description: Coordinates
-#% multiple : yes
+#%option G_OPT_M_EN
 #% required : yes
 #%end
 #%flag 

+ 28 - 47
scripts/i.tasscap/i.tasscap.py

@@ -33,70 +33,51 @@
 #############################################################################
 #
 #%Module
-#%  description: Tasseled Cap (Kauth Thomas) transformation for LANDSAT-TM data
-#%  keywords: raster
-#%  keywords: imagery
-#%End
+#% description: Performs Tasseled Cap (Kauth Thomas) transformation for LANDSAT-TM data.
+#% keywords: imagery
+#% keywords: transformation
+#%end
 #%flag
-#%  key: 4
-#%  description: use transformation rules for LANDSAT-4
-#%END
+#% key: 4
+#% description: Use transformation rules for LANDSAT-4
+#%end
 #%flag
-#%  key: 5
-#%  description: use transformation rules for LANDSAT-5
-#%END
+#% key: 5
+#% description: Use transformation rules for LANDSAT-5
+#%end
 #%flag
-#%  key: 7
-#%  description: use transformation rules for LANDSAT-7
-#%END
-#%option
+#% key: 7
+#% description: Use transformation rules for LANDSAT-7
+#%end
+#%option G_OPT_R_INPUT
 #% key: band1
-#% type: string
-#% gisprompt: old,cell,raster
-#% description: raster input map (LANDSAT channel 1)
-#% required : yes
+#% description: Name of input raster map (LANDSAT channel 1)
 #%end
-#%option
+#%option G_OPT_R_INPUT
 #% key: band2
-#% type: string
-#% gisprompt: old,cell,raster
-#% description: raster input map (LANDSAT channel 2)
-#% required : yes
+#% description: Name of input raster map (LANDSAT channel 2)
 #%end
-#%option
+#%option G_OPT_R_INPUT
 #% key: band3
-#% type: string
-#% gisprompt: old,cell,raster
-#% description: raster input map (LANDSAT channel 3)
-#% required : yes
+#% description: Name of input raster map (LANDSAT channel 3)
 #%end
-#%option
+#%option G_OPT_R_INPUT
 #% key: band4
-#% type: string
-#% gisprompt: old,cell,raster
-#% description: raster input map (LANDSAT channel 4)
-#% required : yes
+#% description: Name of input raster map (LANDSAT channel 4)
 #%end
-#%option
+#%option G_OPT_R_INPUT
 #% key: band5
-#% type: string
-#% gisprompt: old,cell,raster
-#% description: raster input map (LANDSAT channel 5)
-#% required : yes
+#% description: Name of input raster map (LANDSAT channel 5)
 #%end
-#%option
+#%option G_OPT_R_INPUT
 #% key: band7
-#% type: string
-#% gisprompt: old,cell,raster
-#% description: raster input map (LANDSAT channel 7)
-#% required : yes
+#% description: Name of input raster map (LANDSAT channel 7)
 #%end
 #%option
-#% key: outprefix
+#% key: output_prefix
 #% type: string
-#% gisprompt: new,cell,raster
-#% description: raster output TC maps prefix
-#% required : yes
+#% description: Prefix for output raster maps
+#% required: yes
 #%end
 
 import sys

+ 10 - 22
scripts/m.proj/m.proj.py

@@ -24,37 +24,25 @@
 #    numeric and string columns would survive the trip, and 3rd column would
 #    not be modified as z.
 
-#%Module
-#%  description: Converts coordinates from one projection to another (cs2cs frontend).
-#%  keywords: miscellaneous
-#%  keywords: projection
-#%End
-#%option
-#% key: input
-#% type: string
-#% gisprompt: old_file,file,file
-#% description: Input coordinate file ('-' to read from stdin)
+#%module
+#% description: Converts coordinates from one projection to another (cs2cs frontend).
+#% keywords: miscellaneous
+#% keywords: projection
+#%end
+#%option G_OPT_F_INPUT
+#% description: Name of input coordinate file ('-' to read from stdin)
 #% answer: -
-#% key_desc : filename
 #% guisection: Files & format
 #%end
-#%option
-#% key: output
-#% type: string
-#% gisprompt: new_file,file,file
-#% description: Output coordinate file (omit to send to stdout)
+#%option G_OPT_F_OUTPUT
+#% description: Name for output coordinate file (omit to send to stdout)
 #% required : no
-#% key_desc : filename
 #% guisection: Files & format
 #%end
-#%option
-#% key: fs
-#% type: string
+#%option G_OPT_F_SEP
 #% label: Field separator (format: input[,output])
 #% description: Valid field separators are also "space", "tab", or "comma"
 #% required : no
-#% key_desc : string
-#% answer : |
 #% guisection: Files & format
 #%end
 #%option

+ 9 - 17
scripts/r.blend/r.blend.py

@@ -14,30 +14,22 @@
 #
 #############################################################################
 
-#%Module
-#%  description: Blends color components of two raster maps by a given ratio.
-#%  keywords: raster
-#%End
-#%option
+#%module
+#% description: Blends color components of two raster maps by a given ratio.
+#% keywords: raster
+#%end
+#%option G_OPT_R_INPUT
 #% key: first
-#% type: string
-#% gisprompt: old,cell,raster
 #% description: Name of first raster map for blending
-#% key_desc : name
-#% required : yes
 #%end
-#%option
+#%option G_OPT_R_INPUT
 #% key: second
-#% type: string
-#% gisprompt: old,cell,raster
 #% description: Name of second raster map for blending
-#% key_desc : name
-#% required : yes
 #%end
-#%option
-#% key: output
+#%option 
+#% key: output_prefix
 #% type: string
-#% description: Base name for red, green and blue output maps containing the blend
+#% description: Prefix for red, green and blue output raster maps containing
 #% key_desc : name
 #% required : yes
 #%end

+ 12 - 30
scripts/r.buffer/r.buffer.py

@@ -14,49 +14,31 @@
 #
 #############################################################################
 
-#%Module
+#%module
 #% description: Creates a raster map showing buffer zones surrounding cells that contain non-NULL category values.
 #% keywords: raster
 #% keywords: buffer
-#%End
-#%Flag
+#%end
+#%flag
 #% key: z
 #% description: Ignore zero (0) data cells instead of NULL cells
-#%End
-#%Option
-#% key: input
-#% type: string
-#% required: yes
-#% multiple: no
-#% key_desc: name
-#% description: Name of input raster map
-#% gisprompt: old,cell,raster
-#%End
-#%Option
-#% key: output
-#% type: string
-#% required: yes
-#% multiple: no
-#% key_desc: name
-#% description: Name for output raster map
-#% gisprompt: new,cell,raster
-#%End
-#%Option
+#%end
+#%option G_OPT_R_INPUT
+#%end
+#%option G_OPT_R_OUTPUT
+#%end
+#%option
 #% key: distances
 #% type: double
 #% required: yes
 #% multiple: yes
 #% description: Distance zone(s)
-#%End
-#%Option
-#% key: units
-#% type: string
-#% required: no
-#% multiple: no
+#%end
+#%option G_OPT_M_UNITS
 #% options: meters,kilometers,feet,miles,nautmiles
 #% description: Units of distance
 #% answer: meters
-#%End
+#%end
 
 import sys
 import os

+ 4 - 10
scripts/r.colors.stddev/r.colors.stddev.py

@@ -14,18 +14,12 @@
 #
 #############################################################################
 
-#%Module
-#% description: Set color rules based on stddev from a raster map's mean value.
+#%module
+#% description: Sets color rules based on stddev from a raster map's mean value.
 #% keywords: raster
 #% keywords: color table
-#%End
-#% option
-#% key: map
-#% type: string
-#% gisprompt: old,cell,raster
-#% key_desc: name
-#% description: Name of raster map 
-#% required: yes
+#%end
+#% option G_OPT_R_MAP
 #%end
 #%flag
 #% key: b

+ 5 - 15
scripts/r.fillnulls/r.fillnulls.py

@@ -20,25 +20,15 @@
 #############################################################################
 
 
-#%Module
-#% description: Fills no-data areas in raster maps using v.surf.rst splines interpolation
+#%module
+#% description: Fills no-data areas in raster maps using splines interpolation.
 #% keywords: raster
 #% keywords: elevation
 #% keywords: interpolation
-#%End
-#%option
-#% key: input
-#% gisprompt: old,cell,raster
-#% type: string
-#% description: Raster map in which to fill nulls
-#% required : yes
 #%end
-#%option
-#% key: output
-#% gisprompt: new,cell,raster
-#% type: string
-#% description: Output raster map with nulls filled by interpolation from surrounding values
-#% required : yes
+#%option G_OPT_R_INPUT
+#%end
+#%option G_OPT_R_OUTPUT
 #%end
 #%option
 #% key: tension

+ 16 - 30
scripts/r.grow/r.grow.py

@@ -17,38 +17,24 @@
 #%Module
 #% description: Generates a raster map layer with contiguous areas grown by one cell.
 #% keywords: raster
-#%End
-#%Flag
+#%end
+#%flag
 #% key: m
-#% description: radius is in map units rather than cells
-#%End
-#%Option
-#% key: input
-#% type: string
-#% required: yes
-#% multiple: no
-#% key_desc: name
-#% description: Name of input raster map
-#% gisprompt: old,cell,raster
-#%End
-#%Option
-#% key: output
-#% type: string
-#% required: yes
-#% multiple: no
-#% key_desc: name
-#% description: Name for output raster map
-#% gisprompt: new,cell,raster
-#%End
-#%Option
+#% description: Radius is in map units rather than cells
+#%end
+#%option G_OPT_R_INPUT
+#%end
+#%option G_OPT_R_OUTPUT
+#%end
+#%option
 #% key: radius
 #% type: double
 #% required: no
 #% multiple: no
 #% description: Radius of buffer in raster cells
 #% answer: 1.01
-#%End
-#%Option
+#%end
+#%option
 #% key: metric
 #% type: string
 #% required: no
@@ -56,21 +42,21 @@
 #% options: euclidean,maximum,manhattan
 #% description: Metric
 #% answer: euclidean
-#%End
-#%Option
+#%end
+#%option
 #% key: old
 #% type: integer
 #% required: no
 #% multiple: no
 #% description: Value to write for input cells which are non-NULL (-1 => NULL)
-#%End
-#%Option
+#%end
+#%option
 #% key: new
 #% type: integer
 #% required: no
 #% multiple: no
 #% description: Value to write for "grown" cells
-#%End
+#%end
 
 import sys
 import os

+ 4 - 16
scripts/r.in.aster/r.in.aster.py

@@ -26,12 +26,8 @@
 #%  keywords: imagery
 #%  keywords: import
 #%End
-#%option
-#%  key: input
-#%  type: string
-#%  gisprompt: old_file,file,input
-#%  description: Input ASTER image to be georeferenced & rectified
-#%  required: yes
+#%option G_OPT_F_INPUT
+#%  description: Name of input ASTER image
 #%end
 #%option
 #%  key: proctype
@@ -48,17 +44,9 @@
 #%  answer: all
 #%  required: yes
 #%end
-#%option
-#%  key: output
-#%  type: string
+#%option G_OPT_R_OUTPUT
 #%  description: Base name for output raster map (band number will be appended to base name)
-#%  gisprompt: old,cell,raster
-#%  required: yes
 #%end
-#%flag
-#%  key: o
-#%  description: Overwrite existing file
-#%END
 
 import sys
 import os
@@ -168,7 +156,7 @@ def import_aster(proj, srcfile, tempfile, band):
     #import geotiff to GRASS
     grass.message(_("Importing into GRASS ..."))
     outfile = "%s.%s" % (output, band)
-    grass.run_command("r.in.gdal", overwrite = flags['o'], input = tempfile, output = outfile)
+    grass.run_command("r.in.gdal", input = tempfile, output = outfile)
 
     # write cmd history
     grass.raster_history(outfile)

+ 4 - 11
scripts/r.in.srtm/r.in.srtm.py

@@ -48,18 +48,11 @@
 #%  keywords: raster
 #%  keywords: import
 #%End
-#%option
-#% key: input
-#% gisprompt: old_file,file,input
-#% type: string
-#% description: SRTM input tile (file without .hgt.zip extension)
-#% required : yes
+#%option G_OPT_F_INPUT
+#% description: Name of SRTM input tile (file without .hgt.zip extension)
 #%end
-#%option
-#% key: output
-#% gisprompt: new,cell,raster
-#% type: string
-#% description: Output raster map (default: input tile)
+#%option G_OPT_R_OUTPUT
+#% description: Name for output raster map (default: input tile)
 #% required : no
 #%end
 #%flag

+ 4 - 6
scripts/r.in.wms/r.in.gdalwarp.py

@@ -40,18 +40,16 @@
 #% key: k
 #% description: Keep band numbers instead of using band color names
 #%end
-#%option
-#% key: input
-#% type: string
-#% label: Raster file or files to be imported
+#%option G_OPT_F_INPUT
+#% label: Name of raster file or files to be imported
 #% description: If multiple files are specified they will be patched together.
 #% multiple: yes
-#% required : yes
 #%end
 #%option
 #% key: output
 #% type: string
-#% description: Name for resultant raster map. Each band will be name output.bandname
+#% label: Prefix for resultant raster maps.
+#% description: Each band will be name output.bandname
 #% required : yes
 #%end
 #%option

+ 1 - 5
scripts/r.in.wms/r.in.wms.py

@@ -65,11 +65,7 @@
 #% description: Use GDAL WMS driver
 #% guisection: Request
 #%end
-#%option
-#% key: output
-#% type: string
-#% description: Name for output raster map
-#% gisprompt: new,cell,raster
+#%option G_OPT_R_OUTPUT
 #% required : no
 #% guisection: Import
 #%end

+ 3 - 7
scripts/r.mask/r.mask.py

@@ -20,13 +20,8 @@
 #% keywords: raster
 #% keywords: mask
 #%end
-#%option
-#% key: input
-#% type: string
-#% gisprompt: old,cell,raster
-#% description: Raster map to use as mask
-#% required: no
-#% guisection: Create
+#%option G_OPT_R_INPUT
+#% description: Name of raster map to use as mask
 #%end
 #%option
 #% key: maskcats
@@ -44,6 +39,7 @@
 #% key: r
 #% description: Remove existing mask (overrides other options)
 #% guisection: Remove
+#% suppress_required: yes
 #%end
 
 import sys

+ 6 - 22
scripts/r.out.xyz/r.out.xyz.py

@@ -16,34 +16,18 @@
 #
 #############################################################################
 
-#%Module
-#% description: Export a raster map to a text file as x,y,z values based on cell centers.
+#%module
+#% description: Exports a raster map to a text file as x,y,z values based on cell centers.
 #% keywords: raster
 #% keywords: export
-#%End
-#%option
-#% key: input
-#% type: string
-#% gisprompt: old,cell,raster
-#% key_desc: name
-#% description: Name of input raster map 
-#% required: yes
 #%end
-#%option
-#% key: output
-#% type: string
-#% gisprompt: new_file,file,output
-#% key_desc: name
+#%option G_OPT_R_INPUT
+#%end
+#%option G_OPT_F_OUTPUT
 #% description: Name for output file (if omitted or "-" output to stdout)
 #% required: no
 #%end
-#%option
-#% key: fs
-#% type: string
-#% key_desc: character
-#% description: Field separator
-#% answer: |
-#% required: no
+#%option G_OPT_F_SEP
 #%end
 
 import sys

+ 2 - 11
scripts/r.pack/r.pack.py

@@ -19,20 +19,11 @@
 #% keywords: export
 #% keywords: copying
 #%end
-#%option
-#% key: input
-#% type: string
-#% gisprompt: old,cell,raster
+#%option G_OPT_R_INPUT
 #% description: Name of raster map to pack up
-#% key_desc: name
-#% required : yes
 #%end
-#%option
-#% key: output
-#% type: string
-#% gisprompt: new_file,file,output
+#%option G_OPT_F_OUTPUT
 #% description: Name for output file (default is <input>.pack)
-#% key_desc: path
 #% required : no
 #%end
 

+ 8 - 13
scripts/r.plane/r.plane.py

@@ -16,24 +16,19 @@
 #
 #############################################################################
 
-#%Module
-#%  description: Creates raster plane map given dip (inclination), aspect (azimuth) and one point.
-#%  keywords: raster
-#%  keywords: elevation
-#%End
-#%option
-#% key: name
-#% type: string
-#% gisprompt: new,cell,raster
-#% description: Name of raster plane to be created
-#% required : yes
+#%module
+#% description: Creates raster plane map given dip (inclination), aspect (azimuth) and one point.
+#% keywords: raster
+#% keywords: elevation
+#%end
+#%option G_OPT_R_OUTPUT
 #%end
 #%option
 #% key: dip
 #% type: double
 #% gisprompt: -90-90
 #% answer: 0.0
-#% description: Dip of plane. Value must be between -90 and 90 degrees
+#% description: Dip of plane in degrees
 #% required : yes
 #%end
 #%option
@@ -41,7 +36,7 @@
 #% type: double
 #% gisprompt: 0-360
 #% answer: 0.0
-#% description: Azimuth of the plane. Value must be between 0 and 360 degrees
+#% description: Azimuth of the plane in degrees
 #% required : yes
 #%end
 #%option

+ 13 - 22
scripts/r.reclass.area/r.reclass.area.py

@@ -20,39 +20,30 @@
 # 2000: updated to GRASS 5
 # 1998 from NRCS, slightly modified for GRASS 4.2.1
 
-#%Module
-#%  description: Reclasses a raster map greater or less than user specified area size (in hectares).
-#%  keywords: raster
-#%  keywords: statistics
-#%  keywords: aggregation
-#%End
+#%module
+#% description: Reclasses a raster map greater or less than user specified area size (in hectares).
+#% keywords: raster
+#% keywords: statistics
+#% keywords: aggregation
+#%end
 
-#%option
-#% key: input
-#% type: string
-#% gisprompt: old,cell,raster
-#% description: Name of input raster map
-#% required : yes
-#%END
+#%option G_OPT_R_INPUT
+#%end
 
-#%option
-#% key: output
-#% type: string
-#% gisprompt: new,cell,raster
-#% description: Name for output raster map
-#% required : yes
-#%END
+#%option G_OPT_R_OUTPUT
+#%end
 
 #%option
 #% key: lesser
 #% type: double
 #% description: Lesser value option that sets the <= area size limit [hectares]
-#%END
+#%end
+
 #%option
 #% key: greater
 #% type: double
 #% description: Greater value option that sets the >= area size limit [hectares]
-#%END
+#%end
 
 import sys
 import os

+ 14 - 18
scripts/r.rgb/r.rgb.py

@@ -13,23 +13,19 @@
 #
 #############################################################################
 
-#% Module
-#%  description: Split a raster map into red, green and blue maps
-#%  keywords: raster
-#% End
-#% option
-#%  key: input
-#%  type: string
-#%  gisprompt: old,cell,raster
-#%  description: Input map
-#%  required : yes
-#% end
-#% option
-#%  key: output
-#%  type: string
-#%  description: Base name for output maps
-#%  required : no
-#% end
+#%module
+#% description: Splits a raster map into red, green and blue maps.
+#% keywords: raster
+#% keywords: rgb
+#%end
+#%option G_OPT_R_INPUT
+#%end
+#%option
+#% key: output_prefix
+#% type: string
+#% description: Prefix for output raster maps (default: input)
+#% required: no
+#%end
 
 import sys
 import os
@@ -41,7 +37,7 @@ def main():
     output = options['output']
 
     if not grass.find_file(input)['file']:
-	grass.fatal(_("Map <%s> not found.") % input)
+	grass.fatal(_("Raster map <%s> not found") % input)
 
     if not output:
 	output = input

+ 50 - 58
scripts/r.shaded.relief/r.shaded.relief.py

@@ -48,64 +48,56 @@
 #   11/99 updated $ewres to ewres() and $nsres to nsres()
 #       updated number to FP in r.mapcalc statement Markus Neteler
 
-#% Module
-#%  description: Creates shaded relief map from an elevation map (DEM).
-#%  keywords: raster
-#% End
-#% option
-#%  key: input
-#%  type: string
-#%  gisprompt: old,cell,raster
-#%  description: Name of input elevation map
-#%  required : yes
-#% end
-#% option
-#%  key: output
-#%  type: string
-#%  gisprompt: new,cell,raster
-#%  description: Name for output shaded relief map
-#%  required : yes
-#% end
-#% option
-#%  key: altitude
-#%  type: double
-#%  description: Altitude of the sun in degrees above the horizon
-#%  required : no
-#%  options : 0-90
-#%  answer: 30
-#% end
-#% option
-#%  key: azimuth
-#%  type: double
-#%  description: Azimuth of the sun in degrees to the east of north
-#%  required : no
-#%  options : 0-360
-#%  answer: 270
-#% end
-#% option
-#%  key: zmult    
-#%  type: double
-#%  description: Factor for exaggerating relief
-#%  required : no
-#%  answer: 1
-#% end
-#% option
-#%  key: scale
-#%  type: double
-#%  description: Scale factor for converting horizontal units to elevation units
-#%  required : no
-#%  answer: 1
-#%  guisection: Scaling
-#% end
-#% option
-#%  key: units
-#%  type: string
-#%  description: Set scaling factor (applies to lat./long. locations only, none: scale=1)
-#%  required : no
-#%  options: none,meters,feet
-#%  answer: none
-#%  guisection: Scaling
-#% end
+#%module
+#% description: Creates shaded relief map from an elevation map (DEM).
+#% keywords: raster
+#% keywords: elevation
+#%end
+#%option G_OPT_R_INPUT
+#% description: Name of input elevation raster map
+#%end
+#%option G_OPT_R_OUTPUT
+#%end
+#%option
+#% key: altitude
+#% type: double
+#% description: Altitude of the sun in degrees above the horizon
+#% required: no
+#% options : 0-90
+#% answer: 30
+#%end
+#%option
+#% key: azimuth
+#% type: double
+#% description: Azimuth of the sun in degrees to the east of north
+#% required: no
+#% options : 0-360
+#% answer: 270
+#%end
+#%option
+#% key: zmult    
+#% type: double
+#% description: Factor for exaggerating relief
+#% required: no
+#% answer: 1
+#%end
+#%option
+#% key: scale
+#% type: double
+#% description: Scale factor for converting horizontal units to elevation units
+#% required: no
+#% answer: 1
+#% guisection: Scaling
+#%end
+#%option
+#% key: units
+#% type: string
+#% description: Set scaling factor (applies to lat./long. locations only, none: scale=1)
+#% required: no
+#% options: none,meters,feet
+#% answer: none
+#% guisection: Scaling
+#%end
 
 import sys
 import os

+ 3 - 12
scripts/r.tileset/r.tileset.py

@@ -35,11 +35,11 @@
 #    presenting data in a highly inappropriate projection. Do you really
 #    want their data?
 
-#%Module
+#%module
 #% description: Produces tilings of the source projection for use in the destination region and projection.
 #% keywords: raster
 #% keywords: tiling
-#%End
+#%end
 #%flag
 #% key: g
 #% description: Produces shell script output
@@ -95,17 +95,8 @@
 #% description: Number of cells tiles should overlap in each direction
 #% answer: 0
 #%end
-#%option
-#% key: fs
-#% type: string
+#%option G_OPT_F_SEP
 #% description: Output field separator
-#% answer: |
-#%end
-#%option
-#% key: v
-#% type: integer
-#% description: Verbosity level
-#% answer: 0
 #%end
 
 # Data structures used in this program:

+ 3 - 12
scripts/r.unpack/r.unpack.py

@@ -19,21 +19,12 @@
 #% keywords: import
 #% keywords: copying
 #%end
-#%option
-#% key: input
-#% type: string
-#% gisprompt: old,file,input
+#%option G_OPT_F_INPUT
 #% description: Name of input pack file
-#% key_desc: path
-#% required : yes
 #%end
-#%option
-#% key: output
-#% type: string
-#% gisprompt: new,cell,raster
+#%option G_OPT_R_OUTPUT
 #% description: Name for output raster map (default: taken from input file internals)
-#% key_desc: name
-#% required : no
+#% required: no
 #%end
 #%flag
 #% key: o

+ 4 - 25
scripts/v.centroids/v.centroids.py

@@ -18,22 +18,10 @@
 #% keywords: area
 #%End
 
-#%option
-#% key: input
-#% type: string
-#% gisprompt: old,vector,vector
-#% key_desc: name
-#% description: Name of input vector map 
-#%required: yes
+#%option G_OPT_V_INPUT
 #%end
 
-#%option
-#% key: output
-#% type: string
-#% gisprompt: new,vector,vector
-#% key_desc: name
-#% description: Name for output vector map
-#% required: yes
+#%option G_OPT_V_OUTPUT
 #%end
 
 #%option
@@ -45,21 +33,12 @@
 #% required: no
 #%end
 
-#%option
-#% key: layer
-#% type: integer
-#% description: Layer number
-#% gisprompt: new_layer,layer,layer
-#% answer: 1
-#% required: no
+#%option G_OPT_V_FIELD
 #%end
 
-#%option
-#% key: cat
-#% type: integer
+#%option G_OPT_V_CAT
 #% description: Category number starting value
 #% answer: 1
-#% required: no
 #%end
 
 #%option

+ 7 - 30
scripts/v.colors/v.colors.py

@@ -20,35 +20,17 @@
 #% keywords: vector
 #% keywords: color table
 #%end
-#% option
-#% key: map
-#% type: string
-#% gisprompt: old,vector,vector
-#% key_desc: name
-#% description: Name of vector map 
-#% required: yes
+#% option G_OPT_V_MAP
 #%end
-#%option
-#% key: layer
-#% type: integer
-#% description: Layer number
-#% gisprompt: old_layer,layer,layer
-#% answer: 1
-#% required: no
+#%option G_OPT_V_FIELD
 #%end
-#%option
-#% key: column
-#% type: string
-#% description: Name of column containing numeric data
-#% gisprompt: old_dbcolumn,dbcolumn,dbcolumn
+#%option G_OPT_DB_COLUMN
+#% description: Name of attribute column containing numeric data
 #% required : yes
 #%end
-#%option
+#%option G_OPT_DB_COLUMN
 #% key: rgb_column
-#% type: string
-#% required: no
 #% description: Name of color column to populate with RGB values
-#% gisprompt: new_dbcolumn,dbcolumn,dbcolumn
 #% answer: GRASSRGB
 #% guisection: Colors
 #%end
@@ -69,21 +51,16 @@
 #% required: no
 #% guisection: Colors
 #%end
-#%option
+#%option G_OPT_R_INPUT
 #% key: raster
-#% type: string
-#% key_desc: name
 #% required: no
 #% description: Name of raster map from which to copy color table
-#% gisprompt: old,cell,raster
 #% guisection: Colors
 #%end
-#%option
+#%option G_OPT_F_INPUT
 #% key: rules
-#% type: string
 #% required: no
 #% description: Name of file containing rules
-#% gisprompt: old_file,file,input
 #% guisection: Colors
 #%end
 #%flag

+ 6 - 6
scripts/v.convert.all/v.convert.all.py

@@ -14,11 +14,11 @@
 #
 #############################################################################
 
-#%Module
-#%  description: Converts all older versions of GRASS vector maps in current mapset to current format.
-#%  keywords: vector
-#%  keywords: import
-#%  keywords: conversion
+#%module
+#% description: Converts all older versions of GRASS vector maps in current mapset to current format.
+#% keywords: vector
+#% keywords: import
+#% keywords: conversion
 #%end
 
 import sys
@@ -35,7 +35,7 @@ def main():
 	if grass.run_command("v.convert", input = inmap, output = outmap) == 0:
 	    converted += 1
 	else:
-	    grass.warning(_("Error converting map %s to %s") % (inmap, outmap))
+	    grass.warning(_("Error converting map <%s> to <%s>") % (inmap, outmap))
 	    ret = 1
 
 	if converted < 1:

+ 9 - 21
scripts/v.db.addcolumn/v.db.addcolumn.py

@@ -16,30 +16,18 @@
 #############################################################################
 
 
-#%Module
-#%  description: Adds one or more columns to the attribute table connected to a given vector map.
-#%  keywords: vector
-#%  keywords: database
-#%  keywords: attribute table
-#%End
+#%module
+#% description: Adds one or more columns to the attribute table connected to a given vector map.
+#% keywords: vector
+#% keywords: database
+#% keywords: attribute table
+#%end
 
-#%option
-#% key: map
-#% type: string
-#% gisprompt: old,vector,vector
-#% key_desc : name
-#% description: Name of vector map for which to edit attribute table
-#% required : yes
+#%option G_OPT_V_MAP
 #%end
 
-#%option
-#% key: layer
-#% type: integer
-#% gisprompt: old_layer,layer,layer
+#%option G_OPT_V_FIELD
 #% label: Layer number where to add column(s)
-#% description: A single vector map can be connected to multiple database tables. This number determines which table to use.
-#% answer: 1
-#% required : no
 #%end
 
 #%option
@@ -47,7 +35,7 @@
 #% type: string
 #% label: Name and type of the new column(s) ('name type [,name type, ...]')
 #% description: Data types depend on database backend, but all support VARCHAR(), INT, DOUBLE PRECISION and DATE
-#% required : yes
+#% required: yes
 #%end
 
 import sys

+ 15 - 21
scripts/v.db.addtable/v.db.addtable.py

@@ -14,41 +14,35 @@
 #
 #############################################################################
 
-#%Module
-#%  description: Creates and connects a new attribute table to a given layer of an existing vector map.
-#%  keywords: vector
-#%  keywords: database
-#%  keywords: attribute table
-#%End
-#%option
-#% key: map
-#% type: string
-#% gisprompt: old,vector,vector
-#% description: Vector map for which to add new attribute table
-#% required : yes
-#% key_desc : name
+#%module
+#% description: Creates and connects a new attribute table to a given layer of an existing vector map.
+#% keywords: vector
+#% keywords: database
+#% keywords: attribute table
 #%end
-#%option
+#%option G_OPT_V_MAP
+#%end
+#%option 
 #% key: table
 #% type: string
 #% description: Name of new attribute table (default: vector map name)
 #% required : no
 #%end
-#%option
+#%option 
 #% key: layer
-#% gisprompt: old_layer,layer,layer
-#% description: Layer where to add new attribute table
+#% type: integer
+#% description: Layer number where to add new attribute table
 #% answer: 1
-#% required : no
+#% required: no
 #%end
 #%option
 #% key: columns
 #% type: string
 #% description: Name and type of the new column(s) (types depend on database backend, but all support VARCHAR(), INT, DOUBLE PRECISION and DATE)
 #% answer: cat integer
-#% required : no
-#% multiple : yes
-#% key_desc : name type
+#% required: no
+#% multiple: yes
+#% key_desc: name type
 #%end
 
 import sys

+ 11 - 23
scripts/v.db.dropcolumn/v.db.dropcolumn.py

@@ -18,35 +18,23 @@
 #############################################################################
 
 
-#%Module
-#%  description: Drops a column from the attribute table connected to a given vector map.
-#%  keywords: vector
-#%  keywords: database
-#%  keywords: attribute table
-#%End
+#%module
+#% description: Drops a column from the attribute table connected to a given vector map.
+#% keywords: vector
+#% keywords: database
+#% keywords: attribute table
+#%end
 
-#%option
+#%option G_OPT_V_MAP
 #% key: map
-#% type: string
-#% gisprompt: old,vector,vector
-#% key_desc : name
-#% description: Vector map for which to drop attribute column
-#% required : yes
 #%end
 
-#%option
-#% key: layer
-#% gisprompt:  old_layer,layer,layer
-#% description: Layer where to drop column
-#% answer: 1
-#% required : no
+#%option G_OPT_V_FIELD
 #%end
 
-#%option
-#% key: column
-#% gisprompt: old_dbcolumn,dbcolumn,dbcolumn
-#% description: Name of the column to drop
-#% required : yes
+#%option G_OPT_DB_COLUMN
+#% description: Name of attribute column to drop
+#% required: yes
 #%end
 
 import sys

+ 6 - 26
scripts/v.db.droprow/v.db.droprow.py

@@ -16,43 +16,23 @@
 
 
 #%module
-#% description: Removes a vector object (point, line, area, face etc.) from a vector map through attribute selection.
+#% description: Removes a vector feature from a vector map through attribute selection.
 #% keywords: vector
 #% keywords: database
 #% keywords: attribute table
 #%end
 
-#%option
-#% key: input
-#% type: string
-#% gisprompt: old,vector,vector
-#% key_desc : name
-#% description: Vector map for which to drop vector objects
-#% required : yes
+#%option G_OPT_V_INPUT
 #%end
 
-#%option
-#% key: output
-#% type: string
-#% gisprompt: new,vector,vector
-#% key_desc : name
-#% description: Name for output vector map
-#% required : yes
+#%option G_OPT_V_FIELD
 #%end
 
-#%option
-#% key: layer
-#% type: integer
-#% description: Layer of attribute table to use for selection
-#% answer: 1
-#% required : no
+#%option G_OPT_DB_WHERE
+#% required :yes
 #%end
 
-#%option
-#% key: where
-#% type: string
-#% description: WHERE conditions for vector delete, without 'where' keyword (e.g. "elevation IS NULL")
-#% required : yes
+#%option G_OPT_V_OUTPUT
 #%end
 
 import sys

+ 4 - 16
scripts/v.db.droptable/v.db.droptable.py

@@ -25,24 +25,12 @@
 #%  key: f
 #%  description: Force removal (required for actual deletion of table)
 #%end
-#%option
-#% key: map
-#% type: string
-#% gisprompt: old,vector,vector
-#% description: Vector map from which to remove attribute table
-#% required : yes
+#%option G_OPT_V_MAP
 #%end
-#%option
-#% key: table
-#% type: string
-#% description: Name of existing attribute table (default: vector map name)
-#% required : no
+#%option G_OPT_DB_TABLE
+#% description: Table name (default: vector map name)
 #%end
-#%option
-#% key: layer
-#% gisprompt: old_layer,layer,layer
-#% description: Layer from which to drop linked attribute table
-#% answer: 1
+#%option G_OPT_V_FIELD
 #% required : no
 #%end
 

+ 10 - 27
scripts/v.db.join/v.db.join.py

@@ -14,56 +14,39 @@
 #
 #############################################################################
 
-#%Module
+#%module
 #% description: Allows to join a table to a vector map table.
 #% keywords: vector
 #% keywords: database
 #% keywords: attribute table
-#%End
+#%end
 
-#%option
-#% key: map
-#% type: string
-#% key_desc : name
-#% gisprompt: old,vector,vector
+#%option G_OPT_V_MAP
 #% description: Vector map to which to join other table
-#% required : yes
 #% guidependency: layer,column
 #%end
 
-#%option
-#% key: layer
-#% type: integer
+#%option G_OPT_V_FIELD
 #% description: Layer where to join
-#% answer: 1
-#% required : no
-#% gisprompt: old_layer,layer,layer
 #% guidependency: column
 #%end
 
-#%option
-#% key: column
-#% type: string
-#% description: Join column in map table
+#%option G_OPT_DB_COLUMN
+#% description: Join column in table
 #% required : yes
-#% gisprompt: old_dbcolumn,dbcolumn,dbcolumn
 #%end
 
-#%option
+#%option G_OPT_DB_TABLE
 #% key: otable
-#% type: string
 #% description: Other table name
-#% required : yes
-#% gisprompt: old_dbtable,dbtable,dbtable
+#% required: yes
 #% guidependency: ocolumn
 #%end
 
-#%option
+#%option G_OPT_DB_COLUMN
 #% key: ocolumn
-#% type: string
 #% description: Join column in other table
-#% required : yes
-#% gisprompt: old_dbcolumn,dbcolumn,dbcolumn
+#% required: yes
 #%end
 
 import sys

+ 14 - 20
scripts/v.db.reconnect.all/v.db.reconnect.all.py

@@ -13,36 +13,30 @@
 #
 #############################################################################
 
-#%Module
+#%module
 #% description: Reconnects vectors to a new database.
 #% keywords: vector
 #% keywords: database
 #% keywords: attribute table
-#%End
-#%option
+#%end
+#%option G_OPT_DB_DATABASE
 #% key: old_database
-#% type: string
 #% description: Name of old database
-#% required : yes
-#%END
-#%option
+#% required: yes
+#%end
+#%option G_OPT_DB_DATABASE
 #% key: new_database
-#% type: string
 #% description: Name of new database
-#% required : yes
-#%END
-#%option
+#% required: yes
+#%end
+#%option G_OPT_DB_SCHEMA
 #% key: old_schema
-#% type: string
-#% description: Old schema
-#% required : no
-#%END
-#%option
+#% description: Old database schema
+#%end
+#%option G_OPT_DB_SCHEMA
 #% key: new_schema
-#% type: string
-#% description: New schema
-#% required : no
-#%END
+#% description: New database schema
+#%end
 
 import sys
 import os

+ 10 - 21
scripts/v.db.renamecolumn/v.db.renamecolumn.py

@@ -20,32 +20,21 @@
 #############################################################################
 
 
-#%Module
-#%  description: Renames a column in the attribute table connected to a given vector map.
-#%  keywords: vector
-#%  keywords: database
-#%  keywords: attribute table
-#%End
-#%option
-#% key: map
-#% type: string
-#% gisprompt: old,vector,vector
-#% key_desc : name
-#% description: Vector map for which to rename attribute column
-#% required : yes
+#%module
+#% description: Renames a column in the attribute table connected to a given vector map.
+#% keywords: vector
+#% keywords: database
+#% keywords: attribute table
+#%end
+#%option G_OPT_V_MAP
 #%end
-#%option
-#% key: layer
-#% gisprompt:  old_layer,layer,layer
-#% description: Layer where to rename column
-#% answer: 1
-#% required : no
+#%option G_OPT_V_FIELD
 #%end
-#%option
+#%option 
 #% key: column
 #% type: string
 #% description: Old and new name of the column (old,new)
-#% required : yes
+#% required: yes
 #% multiple: no
 #% key_desc: oldcol,newcol
 #%end

+ 18 - 39
scripts/v.db.univar/v.db.univar.py

@@ -16,54 +16,33 @@
 #
 #############################################################################
 
-#%Module
+#%module
 #% description: Calculates univariate statistics on selected table column for a GRASS vector map.
 #% keywords: vector
 #% keywords: statistics
-#%End
+#%end
 #%flag
-#%  key: e
-#%  description: Extended statistics (quartiles and 90th percentile)
-#%END
+#% key: e
+#% description: Extended statistics (quartiles and 90th percentile)
+#%end
 #%flag
-#%  key: g
-#%  description: Print stats in shell script style
-#%END
-#%option
+#% key: g
+#% description: Print stats in shell script style
+#%end
+#%option G_OPT_DB_TABLE
 #% key: table
-#% type: string
-#% gisprompt: old_dbtable,dbtable,dbtable
-#% description: Name of data table
-#% required : yes
-#%End
-#%option
-#% key: column
-#% type: string
-#% gisprompt: old_dbcolumn,dbcolumn,dbcolumn
-#% description: Column on which to calculate statistics (must be numeric)
-#% required : yes
+#% required: yes
 #%end
-#%option
-#% key: database
-#% type: string
-#% gisprompt: old_dbname,dbname,dbname
-#% answer: DEFAULT_DBNAME
-#% description: Database/directory for table
-#% required : no
+#%option G_OPT_DB_COLUMN
+#% description: Name of attribute column on which to calculate statistics (must be numeric)
+#% required: yes
 #%end
-#%option
-#% key: driver
-#% type: string
-#% gisprompt: old_dbdriver,dbdriver,dbdriver
-#% options: dbf,odbc,ogr,sqlite
-#% description: Database driver
-#% required : no
+#%option G_OPT_DB_DATABASE
 #%end
-#%option
-#% key: where
-#% type: string
-#% description: WHERE conditions of SQL statement without 'where' keyword
-#% required : no
+#%option G_OPT_DB_DRIVER
+#% options: dbf,odbc,ogr,sqlite,pg
+#%end
+#%option G_OPT_DB_WHERE
 #%end
 #%option
 #% key: percentile

+ 15 - 41
scripts/v.db.update/v.db.update.py

@@ -15,58 +15,32 @@
 #
 #############################################################################
 
-#%Module
-#%  description: Allows to update a column in the attribute table connected to a vector map.
-#%  keywords: vector
-#%  keywords: database
-#%  keywords: attribute table
-#%End
-#%option
-#% key: map
-#% type: string
-#% gisprompt: old,vector,vector
-#% description: Name of vector map
-#% required : yes
-#% key_desc: name
+#%module
+#% description: Allows to update a column in the attribute table connected to a vector map.
+#% keywords: vector
+#% keywords: database
+#% keywords: attribute table
 #%end
-#%option
-#% key: layer
-#% type: string
-#% gisprompt: old_layer,layer,layer
-#% label: Layer number or name
-#% description: A single vector map can be connected to multiple database tables. This number determines which table to use. Layer name for direct OGR access. 
-#% answer: 1
-#% required : no
-#% key_desc: name
+#%option G_OPT_V_MAP
 #%end
-#%option
+#%option G_OPT_V_FIELD
+#%end
+#%option G_OPT_DB_COLUMN
 #% key: column
-#% type: string
-#% gisprompt: old_dbcolumn,dbcolumn,dbcolumn
-#% description: Name of column to update
-#% required : yes
-#% key_desc: name
+#% description: Name of attribute column to update
+#% required: yes
 #%end
 #%option
 #% key: value
 #% type: string
 #% description: Value to update the column with, can be (combination of) other column(s)
-#% required : no
+#% required: no
 #%end
-#%option
+#%option G_OPT_DB_COLUMN
 #% key: qcolumn
-#% type: string
-#% gisprompt: old_dbcolumn,dbcolumn,dbcolumn
-#% description: Name of column to query
-#% required : no
-#% key_desc: name
+#% description: Name of attrubute column to query
 #%end
-#%option
-#% key: where
-#% type: string
-#% label: WHERE conditions of SQL statement without 'where' keyword
-#% description: Example: income < 1000 and inhab >= 10000
-#% required : no
+#%option G_OPT_DB_WHERE
 #%end
 
 import sys

+ 8 - 30
scripts/v.dissolve/v.dissolve.py

@@ -15,45 +15,23 @@
 #
 #############################################################################
 
-#%Module
+#%module
 #% description: Dissolves boundaries between adjacent areas sharing a common category number or attribute.
 #% keywords: vector
 #% keywords: area
 #% keywords: dissolve
-#%End
-#%option
-#% key: input
-#% type: string
-#% gisprompt: old,vector,vector
-#% key_desc: name
-#% description: Name of input vector map 
-#% required: yes
 #%end
-#%option
-#% key: output
-#% type: string
-#% gisprompt: new,vector,vector
-#% key_desc: name
-#% description: Name for output vector map
-#% required: yes
+#%option G_OPT_V_INPUT
 #%end
-#%option
-#% key: layer
-#% type: string
+#%option G_OPT_V_FIELD_ALL
 #% label: Layer number or name. If -1, all layers are extracted.
-#% description: A single vector map can be connected to multiple database tables. This number determines which table to use.
-#% answer: 1
-#% gisprompt: old_layer,layer,layer_all
-#% required : no
+#% required: no
 #%end
-#%option
-#% key: column
-#% type: string
-#% description: Name of column used to dissolve common boundaries
-#% gisprompt: old_dbcolumn,dbcolumn,dbcolumn
-#% required : no
+#%option G_OPT_DB_COLUMN
+#% description: Name of attribute column used to dissolve common boundaries
+#%end
+#%option G_OPT_V_OUTPUT
 #%end
-
 import sys
 import os
 import atexit

+ 9 - 24
scripts/v.in.e00/v.in.e00.py

@@ -21,34 +21,19 @@
 # REQUIREMENTS:
 #      -  avcimport: http://avce00.maptools.org
 
-#%Module
-#%  description: Import E00 file into a vector map.
-#%  keywords: vector
-#%  keywords: import
-#%End
-#%flag
-#%  key: v
-#%  description: Verbose mode
+#%module
+#% description: Imports E00 file into a vector map.
+#% keywords: vector
+#% keywords: import
 #%end
-#%option
-#% key: file
-#% type: string
-#% description: E00 file
-#% gisprompt: old_file,file,input
-#% required : yes
+#%option G_OPT_F_INPUT
+#% description: Name of input E00 file
 #%end
-#%option
-#% key: type
-#% type: string
+#%option G_OPT_V_TYPE
 #% options: point,line,area
-#% description: Input type point, line or area
-#% required : yes
+#% required: yes
 #%end
-#%option
-#% key: vect
-#% type: string
-#% gisprompt: new,vector,vector
-#% description: Name for output vector map
+#%option G_OPT_V_OUTPUT
 #% required : no
 #%end
 

+ 9 - 20
scripts/v.in.geonames/v.in.geonames.py

@@ -22,27 +22,16 @@
 #       fix spurious char stuff in elevation column
 #############################################################################
 
-#%Module
-#%  description: Imports geonames.org country files into a GRASS vector points map.
-#%  keywords: vector
-#%  keywords: import
-#%  keywords: gazetteer
-#%End
-#%option
-#% key: input
-#% type: string
-#% key_desc: name
-#% description: Uncompressed geonames file from (with .txt extension)
-#% gisprompt: old_file,file,input
-#% required : yes
+#%module
+#% description: Imports geonames.org country files into a vector points map.
+#% keywords: vector
+#% keywords: import
+#% keywords: gazetteer
 #%end
-#%option
-#% key: output
-#% type: string
-#% key_desc: name
-#% gisprompt: new,vector,vector
-#% description: Name for output vector map
-#% required : yes
+#%option G_OPT_F_INPUT
+#% description: Name of uncompressed geonames file (with .txt extension)
+#%end
+#%option G_OPT_V_OUTPUT
 #%end
 
 import sys

+ 10 - 18
scripts/v.in.gns/v.in.gns.py

@@ -24,25 +24,17 @@
 #                 e.g. FC (Feature Classification)
 #############################################################################
 
-#%Module
-#%  description: Imports US-NGA GEOnet Names Server (GNS) country files into a GRASS vector points map.
-#%  keywords: vector
-#%  keywords: import
-#%  keywords: gazetteer
-#%End
-#%option
-#% key: file
-#% type: string
-#% description: Uncompressed GNS file from NGA (with .txt extension)
-#% gisprompt: old_file,file,input
-#% required : yes
+#%module
+#% description: Imports US-NGA GEOnet Names Server (GNS) country files into a GRASS vector points map.
+#% keywords: vector
+#% keywords: import
+#% keywords: gazetteer
 #%end
-#%option
-#% key: vect
-#% type: string
-#% gisprompt: new,vector,vector
-#% description: Name for output vector map
-#% required : no
+#%option G_OPT_F_INPUT
+#% description: Name of input uncompressed GNS file from NGA (with .txt extension)
+#%end
+#%option G_OPT_V_OUTPUT
+#% required: no
 #%end
 
 import sys

+ 6 - 21
scripts/v.in.lines/v.in.lines.py

@@ -15,36 +15,21 @@
 #               for details.
 #
 #############################################################################
-#%Module
-#% description: Import ASCII x,y[,z] coordinates as a series of lines.
+#%module
+#% description: Imports ASCII x,y[,z] coordinates as a series of lines.
 #% keywords: vector
 #% keywords: import
-#%End
+#%end
 #%flag
 #% key: z
 #% description: Create a 3D line from 3 column data 
 #%end
-#%option
-#% key: input
-#% type: string
-#% gisprompt: old_file,file,input
+#%option G_OPT_F_INPUT
 #% description: Name of input file (or "-" to read from stdin)
-#% required : yes
 #%end
-#%option
-#% key: output
-#% type: string
-#% gisprompt: new,vector,vector
-#% description: Name for output vector map
-#% required : yes
+#%option G_OPT_V_OUTPUT
 #%end
-#%option
-#% key: fs
-#% type: string
-#% key_desc: character
-#% description: Field separator
-#% answer: |
-#% required: no
+#%option G_OPT_F_SEP
 #%end
 
 import sys

+ 12 - 19
scripts/v.in.mapgen/v.in.mapgen.py

@@ -23,32 +23,25 @@
 #                    http://www.ngdc.noaa.gov/mgg/shorelines/shorelines.html
 #
 
-#%Module
-#%  description: Imports Mapgen or Matlab-ASCII vector maps into GRASS.
-#%  keywords: vector
-#%  keywords: import
-#%End
+#%module
+#% description: Imports Mapgen or Matlab-ASCII vector maps into GRASS.
+#% keywords: vector
+#% keywords: import
+#%end
 #%flag
-#%  key: f
-#%  description: Input map is in Matlab format
+#% key: f
+#% description: Input map is in Matlab format
 #%end
 #%flag
-#%  key: z
-#%  description: Create a 3D vector points map from 3 column Matlab data 
+#% key: z
+#% description: Create a 3D vector points map from 3 column Matlab data 
 #%end
-#%option
-#% key: input
-#% type: string
-#% gisprompt: old_file,file,input
+#%option G_OPT_F_INPUT
 #% description: Name of input file in Mapgen/Matlab format
-#% required : yes
 #%end
-#%option
-#% key: output
-#% type: string
-#% gisprompt: new,vector,vector
+#%option G_OPT_V_OUTPUT
 #% description: Name for output vector map (omit for display to stdout)
-#% required : no
+#% required: no
 #%end
 
 import sys

+ 2 - 2
scripts/v.in.sites.all/v.in.sites.all.py

@@ -13,12 +13,12 @@
 #
 #############################################################################
 
-#%Module
+#%module
 #% description: Converts all old GRASS < Ver5.7 sites maps in current mapset to vector maps.
 #% keywords: sites
 #% keywords: vector
 #% keywords: import
-#%End
+#%end
 
 import sys
 from grass.script import core as grass

+ 3 - 7
scripts/v.in.wfs/v.in.wfs.py

@@ -18,7 +18,7 @@
 #############################################################################
 
 #%Module
-#% description: Import GetFeature from WFS.
+#% description: Imports GetFeature from WFS.
 #% keywords: vector
 #% keywords: import
 #% keywords: wfs
@@ -27,13 +27,9 @@
 #% key: url
 #% type: string
 #% description: GetFeature URL starting with 'http'
+#% required: yes
 #%end
-#%option
-#% key: output
-#% type: string
-#% gisprompt: new,vector,vector
-#% description: Name for output vector map
-#% required : yes
+#%option G_OPT_V_OUTPUT
 #%end
 
 import os

+ 10 - 19
scripts/v.krige/v.krige.py

@@ -18,28 +18,21 @@ for details.
 ## g.parser informations
 
 #%module
-#% description: Performs ordinary or block kriging.
-#% keywords: vector, interpolation, kriging
+#% description: Performs ordinary or block kriging for vector maps.
+#% keywords: vector
+#% keywords: raster
+#% keywords: interpolation
+#% keywords: kriging
 #%end
 
-#%option
-#% key: input
-#% type: string
-#% gisprompt: old,vector,vector
+#%option G_OPT_V_INPUT
 #% description: Name of point vector map containing sample data
-#% required: yes
 #%end
-#%option
-#% key: column
-#% type: string
-#% gisprompt: old,dbcolumn,dbcolumn
+#%option G_OPT_DB_COLUMN
 #% description: Name of attribute column with numerical value to be interpolated
-#% required : yes
+#% required: yes
 #%end
-#%option
-#% key: output
-#% type: string
-#% gisprompt: new,cell,raster
+#%option G_OPT_R_OUTPUT
 #% label: Name for output raster map
 #% description: If omitted, will be <input name>_kriging
 #% required : no
@@ -90,10 +83,8 @@ for details.
 #% description: Automatically fixed if not set
 #% required : no
 #%end
-#%option
+#%option G_OPT_R_OUTPUT
 #% key: output_var
-#% type: string
-#% gisprompt: new,cell,raster
 #% label: Name for output variance raster map
 #% description: If omitted, will be <input name>_kriging_var
 #% required : no

+ 6 - 30
scripts/v.out.gps/v.out.gps.py

@@ -56,27 +56,13 @@
 ##%  description: Export altitude from 3D vector's z-coordinate
 ##%end
 ############
-#%option
-#% key: input
-#% type: string
-#% description: Name of input vector map
-#% gisprompt: old,vector,vector
-#% required: yes
+#%option G_OPT_V_INPUT
 #%end
-#%option
-#% key: type
-#% type: string
-#% description: Feature type(s)
+#%option G_OPT_V_TYPE
 #% options: point,centroid,line,boundary
-#% multiple: yes
 #%end
-#%option
-#% key: output
-#% type: string
+#%option G_OPT_F_OUTPUT
 #% description: Name for output file or GPS device
-#% gisprompt: new_file,file,output
-#% key_desc: name
-#% required: yes
 #%end
 #%option
 #% key: format
@@ -84,21 +70,11 @@
 #% description: GpsBabel supported output format
 #% answer: gpx
 #%end
-#%option
-#% key: layer
-#% type: integer
-#% label: Layer number
-#% description: A single vector map can be connected to multiple database tables. This number determines which table to use.
-#% answer: 1
-#% required : no
+#%option G_OPT_V_FIELD
+#% required: no
 #% guisection: Subset
 #%end
-#%option
-#% key: where
-#% type: string
-#% label: WHERE conditions of SQL statement without 'where' keyword
-#% description: Example: income < 1000 and inhab >= 10000
-#% required : no
+#%option G_OPT_DB_WHERE
 #% guisection: Subset
 #%end
 

+ 3 - 21
scripts/v.rast.stats/v.rast.stats.py

@@ -30,31 +30,13 @@
 #% key: e
 #% description: Calculate extended statistics
 #%end
-#%option
-#% key: vector
-#% type: string
-#% key_desc: name
-#% gisprompt: old,vector,vector
-#% label: Name of input vector polygon map
-#% description: Data source for OGR access
-#% required : yes
+#%option G_OPT_V_MAP
 #%end
-#%option
-#% key: layer
-#% type: integer
-#% label: Layer number or name
-#% description: A single vector map can be connected to multiple database tables. This number determines which table to use. Layer name for OGR access.
-#% gisprompt: old,layer,layer
-#% answer: 1
-#% required : no
+#%option G_OPT_V_FIELD
 #%end
-#%option
+#%option G_OPT_R_INPUT
 #% key: raster
-#% type: string
-#% key_desc: name
-#% gisprompt: old,cell,raster
 #% description: Name of input raster map to calculate statistics from
-#% required : yes
 #%end
 #%option
 #% key: column_prefix

+ 13 - 30
scripts/v.report/v.report.py

@@ -13,36 +13,23 @@
 #
 #############################################################################
 
-#%Module
-#%  description: Reports geometry statistics for vector maps.
-#%  keywords: vector
-#%  keywords: geometry
-#%  keywords: statistics
-#%End
-#%Flag
+#%module
+#% description: Reports geometry statistics for vector maps.
+#% keywords: vector
+#% keywords: geometry
+#% keywords: statistics
+#%end
+#%flag
 #% key: r
 #% description: Reverse sort the result
-#%End
-#%Flag
+#%end
+#%flag
 #% key: s
 #% description: Sort the result
-#%End
-#%option
-#% key: map
-#% type: string
-#% gisprompt: old,vector,vector
-#% label: Name of input vector map
-#% description: Data source for OGR access
-#% required: yes
 #%end
-#%option
-#% key: layer
-#% type: string
-#% answer: 1
-#% label: Layer number or name
-#% description: A single vector map can be connected to multiple database tables. This number determines which table to use. Layer name for OGR access.
-#% gisprompt: old_layer,layer,layer
-#% required: no
+#%option G_OPT_V_MAP
+#%end
+#%option G_OPT_V_FIELD
 #%end
 #%option
 #% key: option
@@ -51,12 +38,8 @@
 #% options: area,length,coor
 #% required: yes
 #%end
-#%option
-#% key: units
-#% type: string
-#% description: Units
+#%option G_OPT_M_UNITS
 #% options: miles,feet,meters,kilometers,acres,hectares,percent
-#% required: no
 #%end
 
 import sys

+ 18 - 39
scripts/v.what.vect/v.what.vect.py

@@ -13,54 +13,33 @@
 #
 #############################################################################
 
-#%Module
-#%  description: Uploads vector values at positions of vector points to the table.
-#%  keywords: vector
-#%  keywords: database
-#%  keywords: attribute table
-#%End
+#%module
+#% description: Uploads vector values at positions of vector points to the table.
+#% keywords: vector
+#% keywords: database
+#% keywords: attribute table
+#%end
 
-#%option
-#% key: vector
-#% type: string
-#% key_desc: name
-#% gisprompt: old,vector,vector
-#% description: Vector map to modify
-#% required : yes
+#%option G_OPT_V_MAP
 #%end
-#%option
-#% key: layer
-#% type: integer
-#% description: Layer in the vector to be modified
-#% answer: 1
-#% required : no
+#%option G_OPT_V_FIELD
 #%end
-#%option
-#% key: column
-#% type: string
-#% description: Column to be updated with the query result
-#% required : yes
+#%option G_OPT_DB_COLUMN
+#% description: Name of attribute column to be updated with the query result
+#% required: yes
 #%end
-#%option
-#% key: qvector
-#% type: string
-#% key_desc: name
-#% gisprompt: old,vector,vector
-#% description: Vector map to be queried
+#%option G_OPT_V_MAP
+#% key: qmap
+#% description: Name of vector map to be queried
 #% required : yes
 #%end
-#%option
+#%option G_OPT_V_FIELD
 #% key: qlayer
-#% type: integer
-#% description: Layer of the query vector containing data
-#% answer: 1
-#% required : no
 #%end
-#%option
+#%option G_OPT_DB_COLUMN
 #% key: qcolumn
-#% type: string
-#% description: Column to be queried
-#% required : yes
+#% description: Name of attribute column to be queried
+#% required: yes
 #%end
 #%option
 #% key: dmax

+ 8 - 12
scripts/wxpyimgview/wxpyimgview.py

@@ -18,27 +18,23 @@
 #
 #############################################################################/
 
-#%Module
-#% description: View BMP images from the PNG driver.
+#%module
+#% description: Views BMP images from the PNG driver.
 #% keywords: display
 #% keywords: raster
-#%End
-#%Option
+#%end
+#%option G_OPT_F_INPUT
 #% key: image
-#% type: string
-#% required: yes
-#% multiple: no
-#% description: Image file
-#% gisprompt: old_file,file,input
-#%End
-#%Option
+#% description: Name of input image file
+#%end
+#%option
 #% key: percent
 #% type: integer
 #% required: no
 #% multiple: no
 #% description: Percentage of CPU time to use
 #% answer: 10
-#%End
+#%end
 
 import sys
 import os

+ 8 - 12
scripts/wxpyimgview/wxpyimgview_gui.py

@@ -18,27 +18,23 @@
 #
 #############################################################################/
 
-#%Module
-#% description: View BMP images from the PNG driver.
+#%module
+#% description: Views BMP images from the PNG driver.
 #% keywords: display
 #% keywords: raster
-#%End
-#%Option
+#%end
+#%option G_OPT_F_INPUT
 #% key: image
-#% type: string
-#% required: yes
-#% multiple: no
-#% description: Image file
-#% gisprompt: old_file,file,input
-#%End
-#%Option
+#% description: Name of input image file
+#%end
+#%option
 #% key: percent
 #% type: integer
 #% required: no
 #% multiple: no
 #% description: Percentage of CPU time to use
 #% answer: 10
-#%End
+#%end
 
 import sys
 import struct