I am looking for the right formula for reclassifying a slope raster. I need to switch the values 1 = bad, 10 = good to 1 = good, 10 = bad. This Formula worked fine using the normal raster calculator: 10 - %"Recoded@1"% + 1 but I can't figure out the right formula using the SAGA or Gdal Raster Calculator for my processing model. Any ideas!?
A direct answer using SAGA Raster Calculator, would be
11- g1 (same as
10 - g1 + 1).
SAGA | Raster tools Invert grid does the same job.
If we test with this example (sorry... I forgot to input
1... and ended up with
10 - g1 + 2).
Since OP's equation had been successful with QGIS raster calculator, I will not worry too much about continuous data. If input was continuous data (e.g. 1.23 - 10.00), the output gets funny and easily recognized.
Try using the SAGA Tool "Reclassify values". Here you can easily replace one value with another one (for example 1 with 10). Depending on your data, you might have to repeat the process several times to achieve the desired format