luc4s

How to multiply of two rasters in Python

Discussion created by luc4s on May 3, 2011
Latest reply on May 4, 2011 by luc4s
How to multiply two rasters in Python?

I wrote script:
import arcpy
from arcpy import env
arcpy.CheckOutExtension('Spatial')
#folder with pixels: 0-bad and 1-good value
env.workspace = "B:\mask"
masks = arcpy.ListRasters("*", "")
#folder with  value of pixels from 0 to 255
env.workspace = "B:\raster"
rastlist = arcpy.ListRasters("*", "")
for mask in masks:
    maskname = str(mask)
    for raster in rastlist:
        rastname = str(raster)
        if maskname[:25]==rastname[:25]:
          r= mask*raster
          env.workspace = "B:\MODIS\MOD15A2\converted\n"
          r.save(rastname)

But it doesn't multiply rasters. It is some problem with :
r= mask*raster
In Python window shows :

"Runtime error <type 'exceptions.TypeError'>: can't multiply sequence by non-int of type 'unicode'"

Outcomes