[GRASS-dev] [GRASS GIS] #3632: Add a function to read parameters from a file to the parser

GRASS GIS trac at osgeo.org
Wed Aug 29 20:04:59 PDT 2018


#3632: Add a function to read parameters from a file to the parser
-------------------------------------------------+-------------------------
 Reporter:  wenzeslaus                           |      Owner:  grass-dev@…
     Type:  enhancement                          |     Status:  new
 Priority:  normal                               |  Milestone:  8.0.0
Component:  Parser                               |    Version:  unspecified
 Keywords:  g.parser options parameters file     |        CPU:  Unspecified
  long CLI                                       |
 Platform:  Unspecified                          |
-------------------------------------------------+-------------------------
 This is a suggestion to enhance the command line syntax parser to read the
 parameters from a file if specified.

 Benefits:
 * A common way for models with many parameters. (Many models (outside of
 GRASS GIS) parse a "config file" rather than using command line parameters
 and shell scripts.)
 * Universal solution for long command lines including the extremely long
 ones removing the need for the `file` options such as the one in
 G7:r.series.

 Questions and challenges:
 * Which format to use? (JSON, YAML, GRASS eval-friendly key-values, what
 g.parser uses, white-space separated generic command line style, ...)
 * Should we support multiple formats and decide based on file extension or
 content?
 * Are external libraries OK? We may need to add dependencies for both C
 and Python.
 * Is editing in GUI needed? Is "Save Parameters to a File" button enough?
 Load button needed too?
 * Should the format be able to embed another file? (For example, including
 color table. Kind of like what GUI direct text input does.)
 * Can the file be incomplete and supplied in the command line or vice
 versa? What takes precedence if both file and command line present? (Often
 it's the command line over file.)
 * Should some extra things be added to the file? Region? Location and
 mapset? (Probably out of scope for this ticket.)

 The usual way:

 {{{
 > r.slope.aspect elevation=dtm slope=dtm_slope aspect=dtm_aspect -n
 }}}

 Using a file:

 {{{
 > cat params.txt
 elevation=dtm
 slope=dtm_slope
 aspect=dtm_aspect
 -n
 > r.slope.aspect --parameter-file=params.txt
 }}}

 Interesting? Useful? Terrible? ... Let me know.

-- 
Ticket URL: <https://trac.osgeo.org/grass/ticket/3632>
GRASS GIS <https://grass.osgeo.org>



More information about the grass-dev mailing list