I need to iteratively add each raster map of viewshed analysis obtained from a series of single observer locations. For this i used grass.mapcalc with Python (GRASS 7 for Windows). However, my problem is that in
grass.mapcalc you cannot allow functions like the following that we do apply in normal programming.
grass.mapcalc("viewshedN = viewshed + ViewshedN", overwrite = True, quiet = True)
Therefore, i have a trouble in adding each raster iteratively. Is it possible to add an incremental number to the output each time a new raster created? I just tried this in a loop with an integer variable but failed (parse error) in the following code. Is there any other work around/ method or alternative to add each raster result iteratively in GRASS with Python?
formula = 'viewshed' + str(i) grass.mapcalc(formula, overwrite = True, quiet = True)