Bug report #12517

Raster layer statistics SAGA module not working on Processing

Added by Paolo Cavallini over 9 years ago. Updated over 9 years ago.

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

Description

See the log:

Output della console di esecuzione di SAGA
Error: no grids in selection
Error: executing tool [Statistics for Grids]
____________________

  1. ## ##### ##
  1. ### ## ###
  2. # ## ## #### # ##
  3. ##### ## # #####
    1. # ## ##### # ##
      ____________________

SAGA Version: 2.1.4

____________________
library path: /usr/lib/x86_64-linux-gnu/saga/
library name: libstatistics_grid
library : Grids
tool : Statistics for Grids
author : O.Conrad (c) 2005
processors : 4 [4]
____________________

Load grid: /tmp/processing/7faba3084eca4dc89a573271c4cd05b4/dem25.sgrd...

Parameters

Grid system: 25; 601x 410y; 262859.025725x 4454037.5y
Grids: 1 object (dem25)
Arithmetic Mean: Arithmetic Mean
Minimum: Minimum
Maximum: Maximum
Range: <not set>
Sum: <not set>
Variance: Variance
Standard Deviation: Standard Deviation
Mean less Standard Deviation: Mean less Standard Deviation
Mean plus Standard Deviation: Mean plus Standard Deviation
Percentile: <not set>
Percentile: 50.000000

Error: Grid file could not be opened.
Error: executing tool [GDAL: Export Raster]
____________________

  1. ## ##### ##
  1. ### ## ###
  2. # ## ## #### # ##
  3. ##### ## # #####
    1. # ## ##### # ##
      ____________________

SAGA Version: 2.1.4

____________________
library path: /usr/lib/x86_64-linux-gnu/saga/
library name: libio_gdal
library : GDAL/OGR
tool : GDAL: Export Raster
author : O.Conrad (c) 2007
processors : 4 [4]
____________________

Load grid: /tmp/processing/9674cad24de5457c90abfae3a89f9007/MEAN.tif.sgrd...
failed
GDAL: Export Raster: could not initialize data objects
Error: Grid file could not be opened.
Error: executing tool [GDAL: Export Raster]
____________________

  1. ## ##### ##
  1. ### ## ###
  2. # ## ## #### # ##
  3. ##### ## # #####
    1. # ## ##### # ##
      ____________________

SAGA Version: 2.1.4

____________________
library path: /usr/lib/x86_64-linux-gnu/saga/
library name: libio_gdal
library : GDAL/OGR
tool : GDAL: Export Raster
author : O.Conrad (c) 2007
processors : 4 [4]
____________________

Load grid: /tmp/processing/583586ef0928494b9bb70907bcf6db24/MIN.tif.sgrd...
failed
GDAL: Export Raster: could not initialize data objects
Error: Grid file could not be opened.
Error: executing tool [GDAL: Export Raster]
____________________

  1. ## ##### ##
  1. ### ## ###
  2. # ## ## #### # ##
  3. ##### ## # #####
    1. # ## ##### # ##
      ____________________

SAGA Version: 2.1.4

____________________
library path: /usr/lib/x86_64-linux-gnu/saga/
library name: libio_gdal
library : GDAL/OGR
tool : GDAL: Export Raster
author : O.Conrad (c) 2007
processors : 4 [4]
____________________

Load grid: /tmp/processing/cfbb8cc2f86c4979acf1b9e5f5f23de1/MAX.tif.sgrd...
failed
GDAL: Export Raster: could not initialize data objects
Error: Grid file could not be opened.
Error: executing tool [GDAL: Export Raster]
____________________

  1. ## ##### ##
  1. ### ## ###
  2. # ## ## #### # ##
  3. ##### ## # #####
    1. # ## ##### # ##
      ____________________

SAGA Version: 2.1.4

____________________
library path: /usr/lib/x86_64-linux-gnu/saga/
library name: libio_gdal
library : GDAL/OGR
tool : GDAL: Export Raster
author : O.Conrad (c) 2007
processors : 4 [4]
____________________

Load grid: /tmp/processing/61f6b0e430664ddb8ad7d138334bb116/VAR.tif.sgrd...
failed
GDAL: Export Raster: could not initialize data objects
Error: Grid file could not be opened.
Error: executing tool [GDAL: Export Raster]
____________________

  1. ## ##### ##
  1. ### ## ###
  2. # ## ## #### # ##
  3. ##### ## # #####
    1. # ## ##### # ##
      ____________________

SAGA Version: 2.1.4

____________________
library path: /usr/lib/x86_64-linux-gnu/saga/
library name: libio_gdal
library : GDAL/OGR
tool : GDAL: Export Raster
author : O.Conrad (c) 2007
processors : 4 [4]
____________________

Load grid: /tmp/processing/e9983a4b236f491b8544b4f406692b21/STDDEV.tif.sgrd...
failed
GDAL: Export Raster: could not initialize data objects
Error: Grid file could not be opened.
Error: executing tool [GDAL: Export Raster]
____________________

  1. ## ##### ##
  1. ### ## ###
  2. # ## ## #### # ##
  3. ##### ## # #####
    1. # ## ##### # ##
      ____________________

SAGA Version: 2.1.4

____________________
library path: /usr/lib/x86_64-linux-gnu/saga/
library name: libio_gdal
library : GDAL/OGR
tool : GDAL: Export Raster
author : O.Conrad (c) 2007
processors : 4 [4]
____________________

Load grid: /tmp/processing/c3ab01f76ead4674ade3ce80bbc240ae/STDDEVLO.tif.sgrd...
failed
GDAL: Export Raster: could not initialize data objects
Error: Grid file could not be opened.
Error: executing tool [GDAL: Export Raster]
____________________

  1. ## ##### ##
  1. ### ## ###
  2. # ## ## #### # ##
  3. ##### ## # #####
    1. # ## ##### # ##
      ____________________

SAGA Version: 2.1.4

____________________
library path: /usr/lib/x86_64-linux-gnu/saga/
library name: libio_gdal
library : GDAL/OGR
tool : GDAL: Export Raster
author : O.Conrad (c) 2007
processors : 4 [4]
____________________

Load grid: /tmp/processing/77e755b712a9491d86e0e6bae205c2a0/STDDEVHI.tif.sgrd...
failed
GDAL: Export Raster: could not initialize data objects

History

#2 Updated by Giovanni Manghi over 9 years ago

  • Status changed from Open to Feedback
  • Resolution set to up/downstream

There is nothing wrong in Processing with this module. In SAGA 2.1.4 there are only a few new parameters and this is the new description file

Statistics for Grids
statistics_grid
ParameterMultipleInput|GRIDS|Grids|3|False
ParameterNumber|PCTL_VAL|Percentile|0.0|100.0|50.0
OutputRaster|MEAN|Arithmetic Mean
OutputRaster|MIN|Minimum
OutputRaster|MAX|Maximum
OutputRaster|VAR|Variance
OutputRaster|SUM|Sum
OutputRaster|RANGE|Range
OutputRaster|PCTL|Percentile
OutputRaster|STDDEV|Standard Deviation
OutputRaster|STDDEVLO|Mean less Standard Deviation
OutputRaster|STDDEVHI|Mean plus Standard Deviation

the problem is that this module SAGA does not creates any output.

This:

saga_cmd io_gdal -TRANSFORM -INTERPOL 0 -GRIDS "mdt.sgrd" -FILES "mdt.tif"

imports correctly the raster in the SAGA data model, but then

saga_cmd statistics_grid "Statistics for Grids" -GRIDS "mdt.sgrd" -PCTL_VAL 50 -MEAN "MEAN.tif.sgrd"

do not create any output and do not give any error.

#3 Updated by Giovanni Manghi over 9 years ago

  • Status changed from Feedback to Closed

The description has been updated, now is a SAGA issue.

#4 Updated by Paolo Cavallini over 9 years ago

  • Status changed from Closed to Feedback

Could you please open a ticket upstream? Thanks.

#5 Updated by Giovanni Manghi over 9 years ago

  • Status changed from Feedback to Closed

Paolo Cavallini wrote:

Could you please open a ticket upstream? Thanks.

for some reason I'm unable to login on sourceforge and file a ticket there.

#7 Updated by Paolo Cavallini over 9 years ago

  • Resolution deleted (up/downstream)
  • Status changed from Closed to Reopened

with the command above you should see an error: "no grids in selection". The reason is that the tool requires at least two input grids in order to calculate cell statistics. For a test you can simply provide the input grid two times:

saga_cmd statistics_grid "Statistics for Grids" -GRIDS "mdt.sgrd;mdt.sgrd" -MEAN "MEAN.tif.sgrd"

see link above

#8 Updated by Giovanni Manghi over 9 years ago

  • Status changed from Reopened to Closed
  • Resolution set to invalid

Paolo Cavallini wrote:

with the command above you should see an error: "no grids in selection".

no such error message in the saga command line output

The reason is that the tool requires at least two input grids in order to calculate cell statistics. For a test you can simply provide the input grid two times:

saga_cmd statistics_grid "Statistics for Grids" -GRIDS "mdt.sgrd;mdt.sgrd" -MEAN "MEAN.tif.sgrd"

see link above

so there is nothing to fix: the processing module already allows choose multiple raster inputs (and is you do it works). There is no way (as far as I know) to force two, or at least two, but this is another issue.

#9 Updated by Paolo Cavallini over 9 years ago

  • Resolution deleted (invalid)
  • Status changed from Closed to Reopened

The command is still not working properly, as the user should be forced to send the correct input. Please do not close it.

#10 Updated by Giovanni Manghi over 9 years ago

  • Status changed from Reopened to Closed

Paolo Cavallini wrote:

The command is still not working properly, as the user should be forced to send the correct input.

see #12580

Please do not close it.

the module works if you choose at least two raster inputs, as you suggests. The issue is the missing check for the minimum number of inputs, but this does not mean that this module is not working because of a wrong definition. An additional (mandatory) raster input cannot be used as workaround because this SAGA module do not allow it, the only possible input option is a single grid list

Usage: saga_cmd statistics_grid 4 -GRIDS <str> [-MEAN <str>] [-MIN <str>] [-MAX <str>] [-RANGE <str>] [-SUM <str>] [-VAR <str>] [-STDDEV <str>] [-STDDEVLO <str>] [-STDDEVHI <str>] [-PCTL <str>] [-PCTL_VAL <str>]
-GRIDS:<str> Grids
Grid list (input)
-MEAN:<str> Arithmetic Mean
Grid (optional output)
-MIN:<str> Minimum
Grid (optional output)
-MAX:<str> Maximum
Grid (optional output)
-RANGE:<str> Range
Grid (optional output)
-SUM:<str> Sum
Grid (optional output)
-VAR:<str> Variance
Grid (optional output)
-STDDEV:<str> Standard Deviation
Grid (optional output)
-STDDEVLO:<str> Mean less Standard Deviation
Grid (optional output)
-STDDEVHI:<str> Mean plus Standard Deviation
Grid (optional output)
-PCTL:<str> Percentile
Grid (optional output)
-PCTL_VAL:<str> Percentile
Floating point
Minimum: 0.000000
Maximum: 100.000000
Default: 50.000000

Also available in: Atom PDF