Skip to content

Commit

Permalink
[sextante] wrap long lines in help file
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbruy committed Apr 24, 2013
1 parent 69afcf2 commit c8c7851
Showing 1 changed file with 52 additions and 32 deletions.
84 changes: 52 additions & 32 deletions python/plugins/sextante/grass/grass.txt
@@ -1,26 +1,39 @@
A short guide for creating and editing GRASS algorithms for SEXTANTE:
-----------------------------------------------------------------------

Each GRASS command, to be executed from a SEXTANTE element such as the toolbox or the graphical modeler, needs to be described to let SEXTANTE know the inputs required by the commands, the output it generates and the parameters that are used to configure it. Each command is described in a separate text file, although some commands might be split in several algorithms, needing thus several files and adding more than one new entry to the algorithms list of SEXTANTE. Splitting a grassc ommand is usually done because SEXTANTE does not support optional parameters, so it will call GRASS using all parameters defined in the description file.

Here is an explanation of the content of these descriptions files, so you can create you own ones or edit current ones to improve them.
Each GRASS command, to be executed from a SEXTANTE element such as the toolbox
or the graphical modeler, needs to be described to let SEXTANTE know the inputs
required by the commands, the output it generates and the parameters that are
used to configure it. Each command is described in a separate text file, although
some commands might be split in several algorithms, needing thus several files
and adding more than one new entry to the algorithms list of SEXTANTE. Splitting
a grassc ommand is usually done because SEXTANTE does not support optional
parameters, so it will call GRASS using all parameters defined in the description
file.

Here is an explanation of the content of these descriptions files, so you can
create you own ones or edit current ones to improve them.

Each file starts with three lines containing:

-The name of the grass command to call to execute the algorithm (e.g. v.buffer)
-The name of the algorithm to show to the user. This is usually the same as the grass command, but it can be different
-The name of the group where you want the command to appear
- The name of the grass command to call to execute the algorithm (e.g. v.buffer)
- The name of the algorithm to show to the user. This is usually the same as the
GRASS command, but it can be different
- The name of the group where you want the command to appear

After this three lines, a variable number of lines appear, describing all inputs and ouputs. Here is a brief explanation of the format of these lines, depending on the type of parameter or output to be described. All declarations are contained in a single line, with elements separated by the symbol "|"
After this three lines, a variable number of lines appear, describing all inputs
and ouputs. Here is a brief explanation of the format of these lines, depending
on the type of parameter or output to be described. All declarations are contained
in a single line, with elements separated by the symbol "|"

-A raster layer
- A raster layer
ParameterRaster|base|base|False

ParameterRaster|[name of GRASS parameter]|[description of parameter to show]|True/False, indicating if the parameter is optional or not

Example: ParameterRaster|base|base|False

-A vector layer
- A vector layer

ParameterVector|[name of GRASS parameter]|[description of parameter to shown]|[A number indicating the type of geometry]|True/False, indicating if the parameter is optional or not

Expand All @@ -33,62 +46,69 @@ To indicate the type of geometry, use the following values:
1: lines
2: polygons

-A numerical value
- A numerical value

ParameterNumericalValue|[name of GRASS parameter]|[description of parameter to show]|[min value]|[max value]|[default value]

"None" can be used for both min and max values to indicate that there is no lower or upper limit.
"None" can be used for both min and max values to indicate that there is no lower
or upper limit.

If the default value is written as a real number (i.e. it contains a decimal point, even if it is an integer value like 4.0), the parameter can take any value, including decimal ones. If it is written as an integer (i.e. 4), the parameter is assumed to accept only integer values
If the default value is written as a real number (i.e. it contains a decimal
point, even if it is an integer value like 4.0), the parameter can take any value,
including decimal ones. If it is written as an integer (i.e. 4), the parameter is
assumed to accept only integer values

Example: ParameterNumber|levels|levels|1|256|32

-A string
- A string

ParameterString|[name of GRASS parameter]|[description of parameter to show]|[default value]

-A value to select from a list
- A value to select from a list

ParameterSelection|[name of GRASS parameter]|[description of parameter to show]|[list of possible values, separated by semicolons]|[zero-based index of default value]

-A boolean value
- A boolean value

Example: ParameterBoolean|-c|-c|True

-Outputs
- Outputs

All outputs are added with the following syntax:

[type of output]|[name of GRASS output]|[description of output to show]

The following types are available

-OutputRaster
-OutputVector
-OutputTable
-OutputFile (for any file that is not a layer or table of a format supported by QGIS)
-OutputRaster
-OutputVector
-OutputTable
-OutputFile (for any file that is not a layer or table of a format supported by QGIS)


-Advanced parameters
- Advanced parameters

to tag a parameter as "advanced", just add "*" before its declaration. For instance:

*ParameterBoolean|-c|-c|True


ADVANCED OUTPUT PROCESSING
-------------------------
--------------------------

In some cases, it might be interesting to take the console otput from GRASS and extract a part of it for saving or formatting.
In some cases, it might be interesting to take the console otput from GRASS and
extract a part of it for saving or formatting.

Two things can be done about this:

-Creating an HTML file with output. Just add an output of type OutputHTML.
It's value will not be passed to GRASS, but you can use it later to create the HTML file from the console output.
You should create a python file in the grass/ext package, with the same name as the grass module, with dots replaced by low hyphens
(for instance r_quantile.py for the r.quantile command), and add a postProcessResults(alg) method. It will be called when the
execution of the GRASS command is finished.
-Creating a text file. Do as above, but adding an otput of type OutputFile. Since some GRASS commands might use this type of output,
and to make sure that the value of this output is not passed to the GRASS comman when calling it, the output has to be named 'outputtext'


- Creating an HTML file with output. Just add an output of type OutputHTML.
It's value will not be passed to GRASS, but you can use it later to create the
HTML file from the console output. You should create a python file in the
grass/ext package, with the same name as the grass module, with dots replaced
by low hyphens (for instance r_quantile.py for the r.quantile command), and
add a postProcessResults(alg) method. It will be called when the execution of
the GRASS command is finished.
- Creating a text file. Do as above, but adding an otput of type OutputFile.
Since some GRASS commands might use this type of output, and to make sure that
the value of this output is not passed to the GRASS comman when calling it,
the output has to be named 'outputtext'

0 comments on commit c8c7851

Please sign in to comment.