Bug report #19494
Named outputs from raster algorithms fail when used as inputs in processing models
Status: | Closed | ||
---|---|---|---|
Priority: | High | ||
Assignee: | Luigi Pirelli | ||
Category: | Processing/Core | ||
Affected QGIS version: | 3.3(master) | Regression?: | Yes |
Operating System: | Windows 10 | Easy fix?: | No |
Pull Request or Patch supplied: | No | Resolution: | |
Crashes QGIS or corrupts data: | No | Copied to github as #: | 27322 |
Description
Bug report #19372 was similar, but the scope of the example was a vector algorithm, and the resolution worked for vectors. The attached model takes an input raster, runs gdal_calc on layer A, with a simple expression 'A' (output should equal input) with a named output, which it passes that to gdal_calc again. The second iteration of gdal_calc fails, because it can't find the input.
Tested on nightly 1ac5e29da6.
The algorithm log is as follows (the issue being INPUT_A: ''
for the second algorithm):
Processing algorithm…
Algorithm 'polygonize from named output' starting…
Input parameters: { 'gdal:rastercalculator_2:named raster' : 'C:/Users/rudi_000/AppData/Local/Temp/processing_5604e667e782439e8f8517c3a2008540/89af213244d44313ae4bdf7acda5b694/gdal_rastercalculator_2_named raster.tif', 'gdal:rastercalculator_3:result' : 'C:/Users/rudi_000/AppData/Local/Temp/processing_5604e667e782439e8f8517c3a2008540/86ad966eb2204e9390a67e0fd2fa31f5/gdal_rastercalculator_3_result.tif', 'raster' : 'C:/Users/rudi_000/Downloads/named_output_used_as_input_test/named_output_used_as_input_test/dem.tif' }Prepare algorithm: gdal:rastercalculator_2
Running named output [1/2]
Input Parameters: { BAND_A: 1, BAND_B: None, BAND_C: None, BAND_D: None, BAND_E: None, BAND_F: None, EXTRA: '', FORMULA: 'A', INPUT_A: 'C:/Users/rudi_000/Downloads/named_output_used_as_input_test/named_output_used_as_input_test/dem.tif', INPUT_B: None, INPUT_C: None, INPUT_D: None, INPUT_E: None, INPUT_F: None, NO_DATA: -9999, OPTIONS: '', OUTPUT: 'C:/Users/rudi_000/AppData/Local/Temp/processing_5604e667e782439e8f8517c3a2008540/89af213244d44313ae4bdf7acda5b694/gdal_rastercalculator_2_named raster.tif', RTYPE: 1 }
GDAL command:
gdal_calc --calc "A" --format GTiff --type Int16 --NoDataValue -9999.0 -A C:/Users/rudi_000/Downloads/named_output_used_as_input_test/named_output_used_as_input_test/dem.tif --A_band 1 --outfile "C:/Users/rudi_000/AppData/Local/Temp/processing_5604e667e782439e8f8517c3a2008540/89af213244d44313ae4bdf7acda5b694/gdal_rastercalculator_2_named raster.tif"
GDAL command output:
0 .. 10 .. 20 .. 30 .. 40 .. 50 .. 60 .. 70 .. 80 .. 90 .. 100 - DoneOK. Execution took 4.981 s (1 outputs).
Prepare algorithm: gdal:rastercalculator_3
Running Raster calculator [2/2]
Input Parameters: { BAND_A: 1, BAND_B: None, BAND_C: None, BAND_D: None, BAND_E: None, BAND_F: None, EXTRA: '', FORMULA: 'A*2', INPUT_A: '', INPUT_B: None, INPUT_C: None, INPUT_D: None, INPUT_E: None, INPUT_F: None, NO_DATA: -9999, OPTIONS: '', OUTPUT: 'C:/Users/rudi_000/AppData/Local/Temp/processing_5604e667e782439e8f8517c3a2008540/86ad966eb2204e9390a67e0fd2fa31f5/gdal_rastercalculator_3_result.tif', RTYPE: 1 }
Traceback (most recent call last):
File "C:/OSGEO4~1/apps/qgis-dev/./python/plugins\processing\algs\gdal\GdalAlgorithm.py", line 119, in processAlgorithm
commands = self.getConsoleCommands(parameters, context, feedback, executing=True)
File "C:/OSGEO4~1/apps/qgis-dev/./python/plugins\processing\algs\gdal\gdalcalc.py", line 219, in getConsoleCommands
raise QgsProcessingException(self.invalidRasterError(parameters, self.INPUT_A))
_core.QgsProcessingException: Could not load source layer for INPUT_A: invalid valueError encountered while running Raster calculator
Error encountered while running Raster calculator
Execution failed after 5.48 secondsLoading resulting layers
The following layers were not correctly generated.<ul><li>C:/Users/rudi_000/AppData/Local/Temp/processing_5604e667e782439e8f8517c3a2008540/86ad966eb2204e9390a67e0fd2fa31f5/gdal_rastercalculator_3_result.tif</li></ul>You can check the 'Log Messages Panel' in QGIS main window to find more information about the execution of the algorithm.
History
#1 Updated by Rudi von Staden over 6 years ago
I should have mentioned that I have tested this on a few algorithms that take raster inputs, and all seem to fail when the input is the named output of an earlier algorithm. The attached project folder contains sample data and models which demonstrate the issue. The simplest model is `raster_calc_from_named_output.model3`.
#2 Updated by Jürgen Fischer over 6 years ago
- Description updated (diff)
#3 Updated by Rudi von Staden about 6 years ago
- Assignee set to Luigi Pirelli
- Status changed from Open to Closed
Fixed in 2a19a1d655f480742d555f4a009912a0b4b765fd.