[GRASS-user] How to use the neighborhood modifier of grass:r.mapcalculator in PyQGIS

Sophie Crommelinck sophie.crommelinck at gmail.com
Thu Nov 17 22:20:00 PST 2016


Hello,

I would like use r.mapcalculator in a PyQGIS processing script to change
values from one raster in another accordingly. I don't know how to call the
variables row and col, which are now read as simple strings in the
following code:

processing.runalg('grass:r.mapcalculator',{"amap": rlayer, "bmap":
emptylayer, "formula": "amap[row,col]=bmap[(%i+row*%i),(%i+col*%i)]"%
(offset,scale,offset,scale), "GRASS_REGION_PARAMETER": "%f,%f,%f,%f"%
(xmin, xmax, ymin, ymax), "outfile": bdry_resamp})

Does anyone know the correct syntax to use this? It would be fine to do it
manually calling the module from the processing toolbox in QGIS as well,
but then I would have to specify the 'formula' as well.

Thanks,

Sophie
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20161118/9b205870/attachment.html>


More information about the grass-user mailing list