I’m writing a tool script in python and at a certain point I want to use the GRASS tool r.series. I want the algorithem to read all raster files from a folder and calculate the maximum with r.series. The thing is I’m getting the error: “Wrong parameter value: None” when using the code below:


import glob, os, processing

list = ( Select_directory + "/" + "*.tif" )

processing.runalg('grass7:r.series', list ,False,6,'-10000000000,10000000000',None,30.0, Save_results + "/" + "Output.tif")

It must have something to do with the extend, but I can't figure out what. When I'm using the tool directly in QGIS, erverything works fine. Any Ideas?

1 Answer 1


Yes, the extent probably has to be explicitly defined before you can run the algorithm. Seen a few posts about this. The following might work (note that I used grass:r.series and not grass7:r.series):


import glob, os, processing
from PyQt4.QtCore import QFileInfo
from qgis.core import QgsRasterLayer, QgsRectangle

list = []
extent = QgsRectangle()
for raster in glob.glob("*.tif"):
    fileInfo = QFileInfo(raster)
    baseName = fileInfo.baseName()
    rlayer = QgsRasterLayer(raster, baseName)
    # Combine raster layers to list
    # Combine raster extents

# Get extent    
xmin = extent.xMinimum()
xmax = extent.xMaximum()
ymin = extent.yMinimum()
ymax = extent.yMaximum()
# Run algorithm
processing.runalg('grass:r.series', list ,False,6,'-10000000000,10000000000',"%f,%f,%f,%f"% (xmin, xmax, ymin, ymax),30.0, Save_results + "/" + "Output.tif")  
  • Well that looks good but I get the error „Error: Wrong parameter value: []”. I run it with “grass7:r.series”
    – Miron
    Apr 4, 2016 at 8:51
  • @Miron - Forgot to mention that I haven't used this tool before so I guessed that the minimum extent would be the combined extent of all rasters (maybe I'm wrong?). I tested it with several rasters in the same folder and got a result but this is with grass6. I do not have grass7 installed so cannot test this but I wouldn't expect there to be that much difference for it to cause an error. Not sure if I could help with much more, apologies!
    – Joseph
    Apr 4, 2016 at 9:11
  • My mistake, works like a charm, thank you very much!
    – Miron
    Apr 4, 2016 at 12:14
  • @Miron - Most welcome buddy but what was the mistake if I may ask? ;)
    – Joseph
    Apr 4, 2016 at 12:16
  • Since this is the second step my processing model I integrated the code in my model and confused the Input and Output folder ;)
    – Miron
    Apr 4, 2016 at 13:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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