I'm trying to use the process saga:paramemeltonruggednessnumber as following :

melton_saga = processing.run("saga:parememeltonruggednessnumber",
         {'DEM' : path_filled,
          'AREA' : path_area,
          'ZMAX' : path_zmax,
          'MRN' : melton_layer})

It makes me the following error :

call saga_cmd ta_hydrology "ParameMelton Ruggedness Number" -DEM "C:\Users\UTILIS~1\AppData\Local\Temp\tmpff7k_q4j\filled.sgrd" -AREA "C:\Users\UTILIS~1\AppData\Local\Temp\tmpff7k_q4j\area.tif" -ZMAX "C:\Users\UTILIS~1\AppData\Local\Temp\tmpff7k_q4j\zmax.tif" -MRN "C:/Users/Utilisateur/AppData/Local/Temp/processing_HIbIsN/94cd52427f7048f5b877831b3172d028/melton.tif"
             Error: select a tool

The Saga Gis command line must be like :

Usage: saga_cmd ta_hydrology 23 [-DEM <str>] [-AREA <str>] [-ZMAX <str>] [-MRN <str>]
  -DEM:<str>    Elevation
    Grid (input)
  -AREA:<str>   Catchment Area
    Grid (output)
  -ZMAX:<str>   Maximum Height
    Grid (output)
  -MRN:<str>    Melton Ruggedness Number
    Grid (output)

The problem here is that i'm missing the number 23, how can I implant it ?


  • On which version of QGIS are you working on ?
    – wanderzen
    Jun 25 '20 at 15:24
  • Actually I have Qgis 3.10 and 3.14 Jun 26 '20 at 7:16

If I were you I would try to run the tool within a model to check if the issue is related to your QGIS version or not. I've quickly tried on QGIS 3.1 & 3.12 and the tool works smoothly on both version.

Here is the script if it can help you out:

from qgis.core import QgsProcessing
from qgis.core import QgsProcessingAlgorithm
from qgis.core import QgsProcessingMultiStepFeedback
import processing

class Modle(QgsProcessingAlgorithm):

    def initAlgorithm(self, config=None):

    def processAlgorithm(self, parameters, context, model_feedback):
        # Use a multi-step feedback, so that individual child algorithm progress reports are adjusted for the
        # overall progress through the model
        feedback = QgsProcessingMultiStepFeedback(1, model_feedback)
        results = {}
        outputs = {}

        # Paramemelton ruggedness number
        alg_params = {
            'DEM': 'F:/test/MNT_brouillon.tif',
            'AREA': QgsProcessing.TEMPORARY_OUTPUT,
            'MRN': QgsProcessing.TEMPORARY_OUTPUT,
            'ZMAX': QgsProcessing.TEMPORARY_OUTPUT
        outputs['ParamemeltonRuggednessNumber'] = processing.run('saga:paramemeltonruggednessnumber', alg_params, context=context, feedback=feedback, is_child_algorithm=True)
        return results

    def name(self):
        return 'Modèle'

    def displayName(self):
        return 'Modèle'

    def group(self):
        return ''

    def groupId(self):
        return ''

    def createInstance(self):
        return Modle()
  • Thanks for the help. Sadly your script gives me the same error : Error: select a tool I've tried to run it on Qgis 3.10 and 3.14, and does not work on both.. I've tried to replace the ta-hydrology.dll of Saga with a most recent one, but the error still occurs... Any idea ? Jun 26 '20 at 7:15
  • Does the tool work if you run it directly from the processing toolbox ?
    – wanderzen
    Jun 26 '20 at 7:18
  • No.. but I've tried to run it directly from Saga and it works Jun 26 '20 at 7:38
  • That's weird, it works fine on my QGIS 3.10 ! Did you try to uninstall / reinstall QGIS (just in case) ?
    – wanderzen
    Jun 26 '20 at 7:56
  • Yeah.. I made a clean installation yesterday.. As you said, pretty weird ! Jun 26 '20 at 8:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.