Closed qgib closed 5 years ago
Author Name: Giovanni Manghi (@gioman)
This is critical to be solved before 2.18 ships as new LTR.
Author Name: Jürgen Fischer (@jef-n)
Does that also happen with OSGeo4W's saga-ltr?
Author Name: Pedro Venâncio (Pedro Venâncio)
A different problem with OSGeo4W's saga-ltr, Jurgen:
Unexpected parameter '0'
Algorithm Raster calculator starting...
io_gdal 0 -TRANSFORM -INTERPOL 0 -GRIDS "C:\\Users\\pedro\\AppData\\Local\\Temp\\processing9f5e24d6e7234d1f96bc0c51710e11cd\\246df25cfcbd420fbfd46f0a0f59cc7c\\baciaslee2014201817Binary.sgrd" -FILES "D:\\SIG\\CRIF2010\\POM_2017\\LEE_2017\\bacias_lee_2014_2018_17_Binary.tif"
grid_calculus "Grid Calculator" -GRIDS "C:\\Users\\pedro\\AppData\\Local\\Temp\\processing9f5e24d6e7234d1f96bc0c51710e11cd\\246df25cfcbd420fbfd46f0a0f59cc7c\\baciaslee2014201817Binary.sgrd" -FORMULA "int(a)" -TYPE 5 -RESULT "C:\\Users\\pedro\\AppData\\Local\\Temp\\processing9f5e24d6e7234d1f96bc0c51710e11cd\\beff0bb51d65463a805800f4efc946c8\\RESULT.sdat"
C:\\OSGeo4W64\\bin>set SAGA=C:\\OSGeo4W64\\apps\\saga-ltr
C:\\OSGeo4W64\\bin>set SAGA_MLB=C:\\OSGeo4W64\\apps\\saga-ltr\\modules
C:\\OSGeo4W64\\bin>PATH=C:\\OSGEO4~1\\apps\\Python27\\lib\\site-packages\\Shapely-1.2.18-py2.7-win-amd64.egg\\shapely\\DLLs;C:\\OSGEO4~1\\apps\\Python27\\DLLs;C:\\OSGEO4~1\\apps\\Python27\\lib\\site-packages\
umpy\\core;C:\\OSGEO4~1\\apps\\qgis-rel-dev\\bin;C:\\OSGEO4~1\\apps\\grass\\grass-7.2.0\\lib;C:\\OSGEO4~1\\apps\\grass\\grass-7.2.0\\bin;C:\\OSGEO4~1\\apps\\Python27\\Scripts;C:\\OSGEO4~1\\bin;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\WBem;C:\\OSGEO4~1\\apps\\msys\\bin;C:\\OSGeo4W64\\apps\\saga-ltr;C:\\OSGeo4W64\\apps\\saga-ltr\\modules
C:\\OSGeo4W64\\bin>saga_cmd io_gdal 0 -TRANSFORM -INTERPOL 0 -GRIDS "C:\\Users\\pedro\\AppData\\Local\\Temp\\processing9f5e24d6e7234d1f96bc0c51710e11cd\\246df25cfcbd420fbfd46f0a0f59cc7c\\baciaslee2014201817Binary.sgrd" -FILES "D:\\SIG\\CRIF2010\\POM_2017\\LEE_2017\\bacias_lee_2014_2018_17_Binary.tif"
Unexpected parameter '0'
____________________________
##### ## ##### ##
### ### ## ###
### # ## ## #### # ##
### ##### ## # #####
##### # ## ##### # ##
____________________________
SAGA Version: 2.3.2 (64 bit)
____________________________
library path: C:\\OSGeo4W64\\apps\\saga-ltr\\modules\\
library name: io_gdal
library : GDAL/OGR
tool : Import Raster
author : O.Conrad (c) 2007 (A.Ringeler)
processors : 4 [4]
____________________________
Usage: saga_cmd io_gdal 0 [-GRIDS ] [-FILES ] [-SELECTION ] [-SELECT_SORT ] [-TRANSFORM ] [-RESAMPLING ]
-GRIDS: Grids
Grid list (output)
-FILES: Files
File path
-SELECTION: Select from Multiple Bands
Text
-SELECT_SORT: Alphanumeric Sorting
Boolean
Default: 1
-TRANSFORM: Transformation
Boolean
Default: 1
-RESAMPLING: Resampling
Choice
Available Choices:
[0] Nearest Neighbour
[1] Bilinear Interpolation
[2] Bicubic Spline Interpolation
[3] B-Spline Interpolation
Default: 3
C:\\OSGeo4W64\\bin>saga_cmd grid_calculus "Grid Calculator" -GRIDS "C:\\Users\\pedro\\AppData\\Local\\Temp\\processing9f5e24d6e7234d1f96bc0c51710e11cd\\246df25cfcbd420fbfd46f0a0f59cc7c\\baciaslee2014201817Binary.sgrd" -FORMULA "int(a)" -TYPE 5 -RESULT "C:\\Users\\pedro\\AppData\\Local\\Temp\\processing9f5e24d6e7234d1f96bc0c51710e11cd\\beff0bb51d65463a805800f4efc946c8\\RESULT.sdat"
____________________________
##### ## ##### ##
### ### ## ###
### # ## ## #### # ##
### ##### ## # #####
##### # ## ##### # ##
____________________________
SAGA Version: 2.3.2 (64 bit)
____________________________
library path: C:\\OSGeo4W64\\apps\\saga-ltr\\modules\\
library name: grid_calculus
library : Calculus
tool : Grid Calculator
author : A.Ringeler (c) 2003
processors : 4 [4]
____________________________
Load grid: C:\\Users\\pedro\\AppData\\Local\\Temp\\processing9f5e24d6e7234d1f96bc0c51710e11cd\\246df25cfcbd420fbfd46f0a0f59cc7c\\baciaslee2014201817Binary.sgrd...
failed
Grid Calculator: could not initialize data objects
Error: executing tool [Grid Calculator]
C:\\OSGeo4W64\\bin>exit
Converting outputs
Loading resulting layers
The following layers were not correctly generated.
Calculated
You can check the log messages to find more information about the execution of the algorithm
Author Name: Pedro Venâncio (Pedro Venâncio)
Sorry, tested 2.18.5 before close all QGIS projets. So with QGIS 2.18.5 and SAGA 2.3.2 (osgeo4w saga-ltr) everything seems to work ok.
With QGIS 3:
Algorithm Raster calculator starting...
io_gdal 0 -TRANSFORM -RESAMPLING 0 -GRIDS "C:\\Users\\pedro\\AppData\\Local\\Temp\\processingb6b8add68afd4ac9acdff98353efb6b7\\e43b1f2c4cb440f28e8cd8cb2d0f0872\\SRTMPT25mclip.sgrd" -FILES "D:/SIG/MDT/SRTM_25m_JAG/SRTM_PT_25m_clip.tif"
grid_calculus "Grid Calculator" -GRIDS "C:\\Users\\pedro\\AppData\\Local\\Temp\\processingb6b8add68afd4ac9acdff98353efb6b7\\e43b1f2c4cb440f28e8cd8cb2d0f0872\\SRTMPT25mclip.sgrd" -FORMULA "a*2" -TYPE 7 -RESULT "C:\\Users\\pedro\\AppData\\Local\\Temp\\processingb6b8add68afd4ac9acdff98353efb6b7\\9acc2bbc236d4153997a498172525417\\RESULT.sdat"
C:\\OSGeo4W64\\bin>set SAGA=C:/OSGeo4W64/apps/saga-ltr
C:\\OSGeo4W64\\bin>set SAGA_MLB=C:/OSGeo4W64/apps/saga-ltr\\modules
C:\\OSGeo4W64\\bin>PATH=C:\\OSGEO4~1\\apps\\Python36\\lib\\site-packages\
umpy\\core;C:\\OSGEO4~1\\apps\\qgis-dev\\bin;C:\\OSGEO4~1\\apps\\grass\\grass-7.2.0\\lib;C:\\OSGEO4~1\\apps\\grass\\grass-7.2.0\\bin;C:\\OSGEO4~1\\apps\\Python36;C:\\OSGEO4~1\\apps\\Python36\\Scripts;C:\\OSGEO4~1\\apps\\qt5\\bin;C:\\OSGEO4~1\\apps\\Python27\\Scripts;C:\\OSGEO4~1\\bin;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\WBem;C:\\OSGEO4~1\\apps\\msys\\bin;C:/OSGeo4W64/apps/saga-ltr;C:/OSGeo4W64/apps/saga-ltr\\modules
C:\\OSGeo4W64\\bin>saga_cmd io_gdal 0 -TRANSFORM -RESAMPLING 0 -GRIDS "C:\\Users\\pedro\\AppData\\Local\\Temp\\processingb6b8add68afd4ac9acdff98353efb6b7\\e43b1f2c4cb440f28e8cd8cb2d0f0872\\SRTMPT25mclip.sgrd" -FILES "D:/SIG/MDT/SRTM_25m_JAG/SRTM_PT_25m_clip.tif"
Unexpected parameter '0'
____________________________
##### ## ##### ##
### ### ## ###
### # ## ## #### # ##
### ##### ## # #####
##### # ## ##### # ##
____________________________
SAGA Version: 2.3.2 (64 bit)
____________________________
library path: C:\\OSGeo4W64\\apps\\saga-ltr\\modules\\
library name: io_gdal
library : GDAL/OGR
tool : Import Raster
author : O.Conrad (c) 2007 (A.Ringeler)
processors : 4 [4]
____________________________
Usage: saga_cmd io_gdal 0 [-GRIDS ] [-FILES ] [-SELECTION ] [-SELECT_SORT ] [-TRANSFORM ] [-RESAMPLING ]
-GRIDS: Grids
Grid list (output)
-FILES: Files
File path
-SELECTION: Select from Multiple Bands
Text
-SELECT_SORT: Alphanumeric Sorting
Boolean
Default: 1
-TRANSFORM: Transformation
Boolean
Default: 1
-RESAMPLING: Resampling
Choice
Available Choices:
[0] Nearest Neighbour
[1] Bilinear Interpolation
[2] Bicubic Spline Interpolation
[3] B-Spline Interpolation
Default: 3
C:\\OSGeo4W64\\bin>saga_cmd grid_calculus "Grid Calculator" -GRIDS "C:\\Users\\pedro\\AppData\\Local\\Temp\\processingb6b8add68afd4ac9acdff98353efb6b7\\e43b1f2c4cb440f28e8cd8cb2d0f0872\\SRTMPT25mclip.sgrd" -FORMULA "a*2" -TYPE 7 -RESULT "C:\\Users\\pedro\\AppData\\Local\\Temp\\processingb6b8add68afd4ac9acdff98353efb6b7\\9acc2bbc236d4153997a498172525417\\RESULT.sdat"
____________________________
##### ## ##### ##
### ### ## ###
### # ## ## #### # ##
### ##### ## # #####
##### # ## ##### # ##
____________________________
SAGA Version: 2.3.2 (64 bit)
____________________________
library path: C:\\OSGeo4W64\\apps\\saga-ltr\\modules\\
library name: grid_calculus
library : Calculus
tool : Grid Calculator
author : A.Ringeler (c) 2003
processors : 4 [4]
____________________________
Load grid: C:\\Users\\pedro\\AppData\\Local\\Temp\\processingb6b8add68afd4ac9acdff98353efb6b7\\e43b1f2c4cb440f28e8cd8cb2d0f0872\\SRTMPT25mclip.sgrd...
failed
Grid Calculator: could not initialize data objects
Error: executing tool [Grid Calculator]
C:\\OSGeo4W64\\bin>exit
Converting outputs
'NoneType' object has no attribute 'crs' See log for more details
I think the problem is on
https://github.com/qgis/QGIS/blob/master/python/plugins/processing/algs/saga/SagaAlgorithm.py#L328
return 'io_gdal 0 -TRANSFORM -RESAMPLING 0 -GRIDS "' + destFilename + '" -FILES "' + source + '"'
should be
return 'io_gdal 0 -TRANSFORM 1 -RESAMPLING 0 -GRIDS "' + destFilename + '" -FILES "' + source + '"'
Author Name: Pedro Venâncio (Pedro Venâncio)
Besides the error in https://github.com/qgis/QGIS/blob/master/python/plugins/processing/algs/saga/SagaAlgorithm.py#L328
I've found something strange, that can be tested running SAGA - Raster Calculator, with SAGA-LTR (from OSGeo4W) and
Sample file: https://cld.pt/dl/download/6ac21f8c-0244-45a5-823e-6047bb99b208/bacias_lee_2014_2018_17_Binary.tif Formula: int(a) Use NoData: no Data Type: [5] unsigned 4 byte integer
The purpose of this exercise is to pass the original raster to integer. When I do this in SAGA 2.3.2, pixels with a value of 1 go to nodata.
Using SAGA 2.3.2 GUI, I get the correct result (value 1). Same with SAGA 2.1.2.
The problem is related to the import (io_gdal).
After some tests,
On Linux, with SAGA 2.3.1, it works well;
On Windows, with SAGA 2.1.2, it works well;
On Windows, with SAGA 2.3.2 GUI, it works well;
On Windows, with SAGA 2.3.2, the import:
saga_cmd io_gdal 0 -TRANSFORM 1 -RESAMPLING 0 -GRIDS "C:\\Users\\PedroVenancio\\qgis\\baciaslee2014201817Binary.sgrd" -FILES "C:\\Users\\PedroVenancio\\qgis\\bacias_lee_2014_2018_17_Binary.tif"
passes the pixels with value 1 to nodata, both on QGIS and on osgeo4w shell.
- On Windows, with SAGA 2.3.1 from https://sourceforge.net/projects/saga-gis/files/SAGA%20-%202.3/, it works well on cli. This version, through QGIS, gives the problem of not loading the io_gdal module that I reported above.
Author Name: Victor Olaya (@volaya)
Looks like there was an issue in the syntax supported. It wasnt correctl using 2.3.x syntax in QGIS 3. I just fied it, so QGIS 3 should work fine with the saga-ltr shipped in osgeo4w
Author Name: Giovanni Manghi (@gioman)
For sake of clarity this has been replaced by #24332, #24331 and #24330
Author Name: Pedro Venâncio (Pedro Venâncio) Original Redmine Issue: 16408 Affected QGIS version: 2.18.4 Redmine category:processing/saga Assignee: Alexander Bruy
For some reason, SAGA 2.3.1 io_gdal module is not loaded (both on QGIS 2.18.5 and QGIS 3), and Processing SAGA algs does not work. Some examples:
With OSGeo4W Shell I get:
Running saga_cmd directly from the folder I get: