Bug #5645

GRASS integration: Parameter descriptions are lacking in the internal control files (params/flags are duplicated)

Added by Markus Neteler - about 1 year ago. Updated 6 months ago.

Status:Closed Start Date:05/26/2012
Priority:Normal Due date:
Assigned to:Victor Olaya % Done:

0%

Category:Backend/GRASS
Target version:-
Patch supplied:Yes

Description

In the description files for the GRASS module, the parameter/flag descriptions
are lacking in the internal control files (instead, the params/flags are duplicated)

description.diff (40.2 kB) Markus Metz, 05/28/2012 05:22 am

differences_part2.diff (85.3 kB) Markus Neteler -, 05/29/2012 07:33 am

description.diff - new diff against svn (56.5 kB) Markus Metz, 05/31/2012 10:16 am

all_module_file_cleaned_and_expanded.diff - New patch including all modules + i.rgb.his.txt (77.4 kB) Markus Neteler -, 06/01/2012 01:19 am

fixes_against_r206.diff (2.6 kB) Markus Neteler -, 06/01/2012 02:47 am

description3.diff - patch against svn r209 (10.2 kB) Markus Metz, 06/01/2012 10:19 am

History

Updated by Markus Neteler - about 1 year ago

I have started to manually correct them and will send a diff.

Updated by Markus Metz about 1 year ago

Attached is a diff with updated parameter/flag descriptions for the i.* and v.* commands

Updated by Markus Neteler - about 1 year ago

Attached is a diff with updated parameter/flag descriptions for the r.* and nviz commands

Note: I'll submit a combined path with additionally short module descriptions added to the
second line of each file.

Updated by Victor Olaya about 1 year ago

Great! thanks for your help. I will commit all your changes once they are ready, which will greatly improve the SEXTANTE-GRASS conection

Updated by Markus Metz about 1 year ago

Markus Metz wrote:

Attached is a diff with updated parameter/flag descriptions for the i.* and v.* commands

The previous diff was garbage, replaced with svn diff against r199

Updated by Victor Olaya about 1 year ago

  • Status changed from New to Feedback

I have commited them. Thanks!

Just one remark. Some algorithm have been divided in several ones, since they could not be implemented like that in SEXTANTE. For instance, the RST interpolation algorithm let's the user selects if it calculates a cross validation or not. That might cause problems when integrating in the modeler, so there are no optional outputs in SEXTANTE. For that reason I splitted that algorithm in two: one which performs the interpolation and one to do the cross validation. You did not take that into account, but I have changed it before commiting.

Other algorithms might need similar corrections, but now that we have good descriptions, that should be the last step :-)

Thanks again

Updated by Markus Neteler - about 1 year ago

Please post the link to the current descriptions. As announced, I would like to
rework them again for the lacking module description in each file.

Updated by Markus Neteler - about 1 year ago

Hopefully not. It lacks all my fixes posted in

differences_part2.diff (85.3 kB) - Markus Neteler -, 05/29/2012 07:33 am

Updated by Victor Olaya about 1 year ago

Sorry Markus, I thought that the patch that Markus Metz sent me had also all your corrections, so I just applied his one. I have just commited your changes as well. Current revision is r201. SVN trunk is here, as Paolo pointed out: http://sextante.googlecode.com/svn/trunk/soft/bindings/qgis-plugin/src/sextante/grass/description/

Updated by Markus Neteler - about 1 year ago

Perfect. I have taken that, fixed odd ^M line breaks and added all descriptions.
diff against SVN attached.

More observations:

BUGS:

- r.rescale + r.rescale.eq, and others:
ParameterRange: should not have 0,1 predefined, see r.rescale as
bad example since it ruins "default: full range of input map"
--> or, how to do that? please explain in sextante/grass/description/grass.txt

- similar r.quant: fprange

- r.reclass.area + r.random + r.random.cells:
ParameterNumber should not be predefined (lesser + greater, etc)

- r.resamp.rst:
resolution is predefined but should not

- strange (uninterpreted by GUI) /file in r.recode and other files
--> ParameterString|rules|File containing recode rules|/file
should be: InputFile|rules|File containing recode rules|file

- Overall bug: Progress bar remains at 0%

ENHANCEMENTS
- Put description not in windows title but as first row in the window (better for longer descriptions)
- Sextante GRASS history and log:
- problems to show UTF8 chars (e.g. Italian messages)
- Ugly percent output: 0%^H^H^H^H^H 2%^H^H^H^H^H 4%^H^H can
easily be solved by using
export GRASS_MESSAGE_FORMAT=plain
which then outputs the same as 0%...2%...4%...

- These depend on region setting:
- potentially remove r.surf.gauss.txt as it cannot run without exising location
or facilitate region settings a priori
- r.resample + r.resamp.interp + r.resamp.stats.txt:
an easier flag to reach the region settings dialog would be nice

MISC:
- added i.rgb.his.txt
- delete these files (done in the attached new diff):
- outdated r.univar.sh.txt as superceeded by r.univar
- delete r.prominence.txt, it is an addon and not in the core GRASS distro
- delete r.cva.txt, it is an addon and not in the core GRASS distro
- delete v.crossbones.txt, it is an addon and not in the core GRASS distro
- potentially remove r.ros.txt, r.spreadpath.txt, r.spread.txt: or did anyone ever use it?

Updated by Victor Olaya about 1 year ago

Great!

Some comments to your comments

- r.rescale + r.rescale.eq, and others:
ParameterRange: should not have 0,1 predefined, see r.rescale as
bad example since it ruins "default: full range of input map"
--> or, how to do that? please explain in sextante/grass/description/grass.txt

Having parameters that behave differently if they have a value or not is not currently supported. Until we find a way to do this cleanly and efficiently (without having to implement both behaviours explicitly for each algorithm...), I suggest in this case removing the parameter, so it works with the full range. a different range can be used just by reclassifing the layer before, which might not be optimal, but is an alternative option

- strange (uninterpreted by GUI) /file in r.recode and other files
--> ParameterString|rules|File containing recode rules|/file
should be: InputFile|rules|File containing recode rules|file

Can be fixed by using

ParameterFile|rules|File containing recode rules|False
(false indicates that is not a folder but a file)

- Overall bug: Progress bar remains at 0%

I am doing most of the coding and testing in windows, and it works. I test the output for string containing "GRASS_INFO_PERCENT", and with that I update the bar. Maybe in linux the console output is not the same? (I guess so, seeing the other comment you mention about the ugly console output...) Any tip about that?

Updated by Markus Metz about 1 year ago

Victor Olaya wrote:

Great!

Thanks for the quick response! About v.surf.rst split into two, that makes sense, I was just not up to date with my local copy and missed v.surf.rst.cvdev.txt.

Some comments to your comments

- r.rescale + r.rescale.eq, and others: ParameterRange: should not have 0,1 predefined, see r.rescale as bad example since it ruins "default: full range of input map" --> or, how to do that? please explain in sextante/grass/description/grass.txt

Having parameters that behave differently if they have a value or not is not currently supported. Until we find a way to do this cleanly and efficiently (without having to implement both behaviours explicitly for each algorithm...), I suggest in this case removing the parameter, so it works with the full range. a different range can be used just by reclassifing the layer before, which might not be optimal, but is an alternative option

About ParameterRange, how can you set a default range? Currently it seems hard-coded to 0,1, but some modules have different defaults, e.g. i.atcorr has 0,255 as default for both input and output rescaling.

- strange (uninterpreted by GUI) /file in r.recode and other files --> ParameterString|rules|File containing recode rules|/file should be: InputFile|rules|File containing recode rules|file

Can be fixed by using

ParameterFile|rules|File containing recode rules|False (false indicates that is not a folder but a file)

Does that mean that InputFile should be replaced by ParameterFile? I have added InputFile to a number of module descriptions.

- Overall bug: Progress bar remains at 0%

I am doing most of the coding and testing in windows, and it works. I test the output for string containing "GRASS_INFO_PERCENT", and with that I update the bar. Maybe in linux the console output is not the same? (I guess so, seeing the other comment you mention about the ugly console output...) Any tip about that?

Digging a bit in the code, I discovered that GrassUtils.createGrassScript() sets GRASS_MESSAGE_FORMAT=gui which toggles GRASS_INFO_PERCENT. On non-Windows platforms, GrassUtils.createGrassBatchJobFileFromGrassCommands() is called which does not set GRASS_MESSAGE_FORMAT=gui, i.e. no GRASS_INFO_PERCENT. I guess the reason why GrassUtils.createGrassScript() is not used on non-Windows platforms is that folder = GrassUtils.grassPath() which is $GISBASE is not (yet) available on non-Windows platforms. You could get $GISBASE by starting a GRASS batch job which only prints GISBASE to somewhere, then you have GISBASE and could use GrassUtils.createGrassScript() with some minor platform-specific modifications on all platforms. Or you could set GRASS_MESSAGE_FORMAT=gui in the GRASS batch file.

Updated by Markus Neteler - about 1 year ago

Victor Olaya wrote:

MarkusN wrote:

- strange (uninterpreted by GUI) /file in r.recode and other files --> ParameterString|rules|File containing recode rules|/file should be: InputFile|rules|File containing recode rules|file

Can be fixed by using

ParameterFile|rules|File containing recode rules|False (false indicates that is not a folder but a file)

Patch attached incl. fix for newly introduced v.to.rast.attribute.txt bug.

Updated by Markus Metz about 1 year ago

One of the last changes to svn broke some of those interfaces where a GRASS command has been split in two. The first line of the corresponding text file must still be the GRASS command name, i.e. v.surf.rst and not v.surf.rst.cvdev. The affected *.txt files are

v.buffer.column.txt
v.buffer.distance.txt
v.surf.rst.cvdev.txt
v.to.rast.attribute.txt
v.to.rast.value.txt

Updated by Victor Olaya about 1 year ago

MArkus

Yes, ParameterFile must be used, InputFile is not a valid tag understood by SEXTANTE

Regarding the ParameterRange, I have seen that some descriptions have different default values set. Unfortunately, there was a bug in the ParameterRange class, and they were not correctly processed. I have fixed it (already in r207) and it should work now.

Linux and Windows version call GRASS differently, because in windows the GRASS_BATCH_JOB does not work so perfectly. It would be great to use the same approach for both, but windows is a bad platform in this case...so that's why there is that other method. i will change the GRASS_MESSAGE_FORMAT to gui in the linux version as well, so they behave the same, and the current system for parsing GRASS output can be used in both OSs

Updated by Markus Metz about 1 year ago

Victor Olaya wrote:

Regarding the ParameterRange, I have seen that some descriptions have different default values set. Unfortunately, there was a bug in the ParameterRange class, and they were not correctly processed. I have fixed it (already in r207) and it should work now.

Cool, works fine for me, thanks!

Linux and Windows version call GRASS differently, because in windows the GRASS_BATCH_JOB does not work so perfectly. It would be great to use the same approach for both, but windows is a bad platform in this case...so that's why there is that other method. i will change the GRASS_MESSAGE_FORMAT to gui in the linux version as well, so they behave the same, and the current system for parsing GRASS output can be used in both OSs

In my experience the approach you use for Windows is also safer on Linux. That's why I suggested to skip GRASS_BATCH_JOB completely and to use GrassUtils.createGrassScript() with some minor platform-specific modifications on all platforms, not only Windows. But I can not judge how much work that will be.

Yet another patch attached for the interface descriptions...

Updated by Markus Neteler - 12 months ago

Victor: are our patches now available in 1.0.7? Thanks, MarkusN

Updated by Victor Olaya 12 months ago

I have just checked the current description files, and they contain your descriptions, so they should appear.

Just one randomly chosen:

r.patch
r.patch - Creates a composite raster map layer by using one (or more) map layer(s) to fill in areas of "no data" in another map layer.
Raster (r.*)
ParameterMultipleInput|input|Name of raster maps to be patched together|1.0|False
ParameterBoolean|-z|Use zero (0) for transparency instead of NULL|False
OutputRaster|output|Name for resultant raster map

Seems it is fine, right? It appears correct from the toolbox, as well.

Have you installed 1.0.7 without problems?

(sorry if I do not answer quickly in case you detect any problem, since i will be away this week...but hope to fix anything if needed once I am back...)

Updated by Markus Neteler - 12 months ago

It looks good to me, thanks for the great work!

Updated by Giovanni Manghi 6 months ago

Markus Neteler - wrote:

It looks good to me, thanks for the great work!

can we close this ticket?

Updated by Markus Neteler - 6 months ago

  • Status changed from Feedback to Resolved

Updated by Giovanni Manghi 6 months ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF