12345678910111213141516171819202122232425262728293031323334353637 |
- #!/usr/bin/env python3
- # %module
- # % description: Adds the values of two rasters (A + B)
- # % keyword: raster
- # % keyword: algebra
- # % keyword: sum
- # %end
- # %option G_OPT_R_INPUT
- # % key: araster
- # % description: Name of input raster A in an expression A + B
- # %end
- # %option G_OPT_R_INPUT
- # % key: braster
- # % description: Name of input raster B in an expression A + B
- # %end
- # %option G_OPT_R_OUTPUT
- # %end
- import grass.script as gs
- def main():
- options, flags = gs.parser()
- araster = options['araster']
- braster = options['braster']
- output = options['output']
- gs.mapcalc('{r} = {a} + {b}'.format(r=output, a=araster, b=braster))
- return 0
- if __name__ == "__main__":
- main()
|