Bug report #19494

Updated by Jürgen Fischer over 5 years ago

Bug report #19372 (https://issues.qgis.org/issues/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 - Done
>
> OK. 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 value
>
> Error encountered while running Raster calculator
> Error encountered while running Raster calculator
> Execution failed after 5.48 seconds
>
> Loading 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.

Back