# Multiplying Rasters Problem

Question asked by racheski on Sep 25, 2012
Latest reply on Sep 25, 2012 by racheski
I am having a very frustrating problem with using the Times() function to multiply two rasters together. One of the rasters is created by ReclassByTable, and for some odd reason its output is not recognized as a raster (see red):
`#Import modulesimport osimport arcpyfrom arcpy import envfrom arcpy.sa import *arcpy.CheckOutExtension("Spatial")#Set local variableswks = arcpy.GetParameterAsText(0) # input workspaceinRaster1 = arcpy.GetParameterAsText(1) # input raster layerinRaster2 = arcpy.GetParameterAsText(2) # input raster layerinRaster3 = arcpy.GetParameterAsText(3) # input raster layerinRaster4 = arcpy.GetParameterAsText(4) # input raster layerinRaster5 = arcpy.GetParameterAsText(5) # input raster layerinRaster6 = arcpy.GetParameterAsText(6) # input raster layerinRaster7 = arcpy.GetParameterAsText(7) # input raster layerinRaster8 = arcpy.GetParameterAsText(8) # input raster layerinRaster9 = arcpy.GetParameterAsText(9) # input raster layerinRaster10 = arcpy.GetParameterAsText(10) # input raster layerenv.workspace = wkscellSize = 100outExtent = Extent(871599.89, 982834.44, 912502.09, 1070920.9)ReMapTable_dbf = "P:\\Crime_Analysis\\Testing_Training\\RiskTerrainModeling\\RobinAdrienne\\AggAssaults\\ReMapTable.dbf"#Multiply Raster by a constant with CreateConstantRasterconstantValue1 = arcpy.GetParameterAsText(11) # input weight valueoutConstRaster1 = CreateConstantRaster(constantValue1, "FLOAT", cellSize, outExtent)outReclass1 = ReclassByTable(inRaster1, ReMapTable_dbf , "FROM", "TO", "VALUE", "DATA")outTimes1 = Raster(outReclass1)* outConstRaster1outRaster1 = "Wt_" + os.path.basename(inRaster1)outTimes1.save(outRaster1) # save raster`

I keep getting the same error:
[PHP]outTimes1 = Raster(outReclass1)* outConstRaster1
TypeError: expected a raster or layer name
[/PHP]

I already checked that the ReMap Table was working b/c when I save outReclass1 it gives me a raster where all the values are equal to 1 (which is what I want). In previous versions of the script, I had used a model builder to create the raster where all values are equal to 1 and used the times function successfully with outConstRaster1. However, I want to use the ReclassByTable in a python script because it is faster than model builder, but it is not working for me.

I also tried making outReclass1 a raster layer for the times function, but that did not work either.