1

I'm looking for computing different descriptive statistics through a set of raster layers. I need to make it with a python script capable of running into a standalone tool within the QGIS. To do so first I made it by using the "Model Builder" within the QGIS and from the model I have extracted the script. I used the r.series from GRASS and it works as a model. The script is the following, for the case of the "maximum":

##=name

##1=raster 

##3=raster

##2=raster

##4=raster

##maximum=output raster

outputs_GRASSR.SERIES_1=processing.runalg('grass:r.series',[1,3,2,4],True,6,'-10000000000,10000000000',None,0.0,maximum)

Actually at this point I need to use a "multiple raster" instead of 1,2,3,4. I mean I would like to make something like:

##MAXIMUM=name

##RASTERS=multiple raster

##maximum=output raster

import os
import processing

lddLrs = RASTERS.split(';')
for lyr in lddLrs:
    processing.runalg('grass:r.series', RASTERS,True,6,'-10000000000,10000000000',None,0.0,maximum)

But this doesn't work. Any idea to solve it?

I have tried the following:

##=name

##1=multiple raster

##maximum=output raster

import processing

processing.runalg('grass:r.series', [1],True,6,None,0.0,'-10000000000,10000000000',maximum)

But it still doesn.t work. Any solution?

Your Answer

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

Browse other questions tagged or ask your own question.