I am using QGIS 2.18.15.
I want to streamline multiple SAGA raster calculator calculations using the output of one calculation (not loading it into the table of contents) as input raster for the next and so one. I found some useful things at Pipe output of one processing algorithm as input into another algorithm in QGIS 2.18 Processing script and in the QGIS doc here.
I built a script looking like this:
##MaechtigkeitunterhalbeinerHoehe=name
##Input_Raster=raster
##Hoehe= string 28.65
##Pos_Differenzen=output raster
formula='a-{}'.format(Hoehe)
Differenzen=processing.runalg('saga:rastercalculator',Input_Raster,[],formula,0,False,7,None)
Pos_Differenzenalg=processing.runalg('saga:rastercalculator', Differenzen['Result'],[],'a*(a>0)',0,False,7,Pos_Differenzen)
As you can see I am trying to access the output of "Differenzen" by using Differenzen['Result']
as the input parameter for "Pos_Differenzen". When I define an output rater parameter like ## Differenzenout=output raster
it at least generates no error through the first part, but it load the result into the table of content (which I am trying to avoid) and also gives me an error for the second part. I have also tried 'OUTPUT'
instead of 'RESULT'
but to no avail. If I run the second algorithm on its own with the previously calculated temporary raster from the Diffrenzen algorithm as ##Input_raster
it works fine again.
What am I doing wrong?