Bug report #6379

HTML output does not work for Processing/GRASS modules

Added by Pedro Venâncio almost 12 years ago. Updated about 9 years ago.

Status:Closed
Priority:High
Assignee:Victor Olaya
Category:Processing/GRASS
Affected QGIS version:master Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:15639

Description

new description:
see subject.

Outputting to file

OutputFile|outputtext|...

works

old description:
r.quantile does not generate any results, and also does not give any error.

Sextante.runalg("grass:r.quantile","/home/pedro/resultados_3/perigosidade.tif",5,"",True,"273634.516689,299606.738614,402654.775401,445200.224599",25)

Related issues

Duplicated by QGIS Application - Bug report #12789: r.surf.area misses an output Closed 2015-05-20

Associated revisions

Revision a842d475
Added by Victor Olaya about 9 years ago

[processing] fixed text and html output in GRASS algorithms

This changes the way text outputs are handled.
Now the output of the command is piped to a file, and with that file, the raw and HTML outputs are generated.

More formatting for the HTML file should be added in the future, since it is now rather basic

fixes #6379

History

#1 Updated by Pedro Venâncio over 11 years ago

I do not know, but the result of r.quantile could be a new raster with reclassification in quantile classes applied.
Of course, if this is possible.

Thanks!

#2 Updated by Filipe Dias over 11 years ago

Can you check again? I just tried and it seemed to work.

#3 Updated by Pedro Venâncio over 11 years ago

What is the result that you obtain? And what are the parameters you employ?

I still do not get results.

I'm on Xubuntu 12.04.

#4 Updated by Pedro Venâncio over 11 years ago

Sorry, I've seen that appear in History and log -> Info, but I think it should, at least, appear in Sextante results viewer.

Ideally, it would create a new raster reclassified according to quantiles / percentiles, for this tool can be used in the Modeler.

#5 Updated by elcuco - over 11 years ago

I have the same problem. The r.quantile does not generate any results, with any kind of error. Besides that, the History and log -> Info does not report any data... I'm usind Ubuntu 12.04. And I'm usind the same parameters as Pedro Venâncio.

#6 Updated by Markus Neteler about 11 years ago

The module writes to stdout (!). It generates input for e.g. r.recode:

GRASS 6.4.3svn (nc_spm_08):~ > g.region rast=elevation
GRASS 6.4.3svn (nc_spm_08):~ > r.quantile input=elevation percentiles=0.1,1,10,25,50,75,90,99,99.9
Computing histogram
100%
Computing bins
Binning data
100%
Sorting bins
100%
Computing quantiles
0:0.100000:59.870384
1:1.000000:68.065155
2:10.000000:84.523346
3:25.000000:94.789986
4:50.000000:108.879921
5:75.000000:126.791985
6:90.000000:138.660385
7:99.000000:149.824585
8:99.900000:153.375854

The result is formatted to be used in r.recode. See also

http://grasswiki.osgeo.org/wiki/Quantile_classification

#7 Updated by Pedro Venâncio about 11 years ago

Hi Markus,

Markus Neteler - wrote:

The module writes to stdout (!). It generates input for e.g. r.recode:

How can we achieve this within Sextante?

The result of r.quantile is saved in a html file. In my case, at this moment, in the html file that is generated, is only saved the header:

<h2>r.quantile</h2>

Nevertheless, the result appears correctly in the logs.

Another option would be to use a plain text file for r.recode. To get this, r.quantile should save a plain text file in the format expected by r.recode, and thus it would be possible to use the two algorithms (together) in Modeler.

What do you think?

#8 Updated by Victor Olaya about 11 years ago

  • Status changed from Open to Feedback

The HTML file is generated fine, but it's true that it's not as useful as it can be.

I am thinking of this solution: when this is needed, add in the description an output of type OutputFile, with a special name, so SEXTANTE instead of passing it to GRASS, uses it to pipe the result of the corresponding command into that file.

I think it can work

By the way the output of r.quantile is different in windows:

GRASS_INFO_MESSAGE(5216,1): Calculando histograma
GRASS_INFO_END(5216,1)

GRASS_INFO_MESSAGE(5216,2): Computing bins
GRASS_INFO_END(5216,2)

GRASS_INFO_MESSAGE(5216,3): Binning data
GRASS_INFO_END(5216,3)

GRASS_INFO_MESSAGE(5216,4): Sorting bins
GRASS_INFO_END(5216,4)

0:25.000000:1111.000000
1:50.000000:1402.000000
2:75.000000:1735.000000

GRASS_INFO_MESSAGE(5216,5): Calculando quantiles
GRASS_INFO_END(5216,5)

IS this also ok to be parsed by other GRASS commands?

#9 Updated by Victor Olaya about 11 years ago

  • Status changed from Feedback to Resolved

Ok, I added the piping. All those messages are not piped (I gues they are wrriten to err...), so it should work fine

#10 Updated by Pedro Venâncio about 11 years ago

  • Status changed from Resolved to Feedback

Hi Victor,
Thank you very much! Now is working!

But for some reason, in my case, the html file continues just registering the header info (<h2>r.quantile</h2>).
In the text file everything appears correctly.

Now I just have a doubt. r.quantile returns the upper limit value corresponding to each class, right?
But r.recode, uses r.quantile result as closed interval in the lower value and open interval in the upper value. In other words, assuming that r.quantile returns the following result:

2.000000:6.000000:1
6.000000:8.000000:2
8.000000:12.000000:3
12.000000:20.000000:4
20.000000:872.727295:5

r.recode will use these data as follows:

[2.000000:6.000000[ -> 1
[6.000000:8.000000[ -> 2
[8.000000:12.000000[ -> 3
[12.000000:20.000000[ -> 4
[20.000000:872.727295[ -> 5

But this is not correct. According to quantiles method, the reclassification should be as follows:

]2.000000:6.000000] -> 1
]6.000000:8.000000] -> 2
]8.000000:12.000000] -> 3
]12.000000:20.000000] -> 4
]20.000000:872.727295] -> 5

or am I wrong?

Thanks!

#11 Updated by Pedro Venâncio about 11 years ago

  • Priority changed from Normal to Severe/Regression

Hi,

As suspected, we can not directly use the output of r.quantile in r.recode. See this thread in the GRASS-user mailing list:

http://osgeo-org.1560.x6.nabble.com/Using-r-quantile-result-with-r-recode-td5046747.html

There are times when this method results, particularly when the boundary values ​​are not values ​​from the input data, but this not always happen, producing erroneous results. For this reason, I increased the priority level for this ticket to blocker.

Any idea about a possible solution?

Thanks!

#12 Updated by Giovanni Manghi almost 11 years ago

  • Priority changed from Severe/Regression to High

Pedro Venâncio wrote:

Hi,

As suspected, we can not directly use the output of r.quantile in r.recode. See this thread in the GRASS-user mailing list:

http://osgeo-org.1560.x6.nabble.com/Using-r-quantile-result-with-r-recode-td5046747.html

There are times when this method results, particularly when the boundary values ​​are not values ​​from the input data, but this not always happen, producing erroneous results. For this reason, I increased the priority level for this ticket to blocker.

Any idea about a possible solution?

Thanks!

Hi Pedro,
the SEXTANTE tickets have been merged with the QGIS desktop ones, so I guess we have to lower the priority of this ticket as is not a regression. I understand this an annoying issue, but it is kind of an edge one. Do you agree?

#13 Updated by Pedro Venâncio almost 11 years ago

Hi Giovanni,

Yes, I agree, it really isn't a regression. However, the use of r.quantile with r.recode can lead to erroneous results, and so it seems to me a tool to "fix" with priority. I think "High priority" is fine.

#14 Updated by Giovanni Manghi almost 11 years ago

Pedro Venâncio wrote:

Hi Giovanni,

Yes, I agree, it really isn't a regression. However, the use of r.quantile with r.recode can lead to erroneous results, and so it seems to me a tool to "fix" with priority. I think "High priority" is fine.

yes, this is how "high" priority is (should) used for.

#15 Updated by Giovanni Manghi over 9 years ago

  • Project changed from 78 to QGIS Application
  • Category deleted (59)
  • Affected QGIS version set to 2.4.0
  • Crashes QGIS or corrupts data set to No

#16 Updated by Giovanni Manghi over 9 years ago

  • Category set to Processing/GRASS

#17 Updated by Giovanni Manghi about 9 years ago

  • Target version set to Future Release - High Priority
  • Status changed from Feedback to Open
  • Affected QGIS version changed from 2.4.0 to master

Still empty result on master, see also #12764

#18 Updated by Giovanni Manghi about 9 years ago

  • Subject changed from r.quantile does not generate any results to HTML output does not work for Processing/GRASS modules

#19 Updated by Giovanni Manghi about 9 years ago

  • Status changed from Open to Feedback

well... it seems to work at least on Windows. In my case does not work under Linux, but for others is ok. Before closing I would like to gather more feedback.

#20 Updated by Filipe Dias about 9 years ago

Here on ubuntu 14.04 with grass 7 it also doesn't work, the html is not created

#21 Updated by Giovanni Manghi about 9 years ago

  • Status changed from Feedback to Open

On Windows there is the html output, but in the results viewer it is shown the html code instead of the formatted text.
It seems that there are Linux systems where there is the html output (instead of empty) but still it show the raw html in the result viewer.

#22 Updated by Giovanni Manghi about 9 years ago

see also #12710

#23 Updated by Victor Olaya about 9 years ago

  • Status changed from Open to Closed

Also available in: Atom PDF