Hi Chris,I already ran the code that you shared with me. I tested the code with only five rasters. When I ran the code it says:>>> ERROR: No matching entry in raster value look up dictionary!ERROR: No matching entry in raster value look up dictionary!ERROR: No matching entry in raster value look up dictionary!ERROR: No matching entry in raster value look up dictionary!ERROR: No matching entry in raster value look up dictionary!I checked each variable in code and it is okay, except for newRaster. When I enter the command >>> print newRaster it says NameError: name 'newRaster' is not definedBelow is the code that you gave me. Sorry for this, I am still learning how to write python codes. And it is a steep learning curve for me.Thanks,-Leoimport arcpy, os
rasterValDict = {"raster1": 11.2, "raster2": 14.9, "raster3": 9.4, "raster4": 9.4, "raster5": 9.4}
rasterDirPath = r'E:\Test\Criteria'
outputDirPath = r'E:\Test\rastercalc'
arcpy.env.workspace = rasterDirPath
rasterList = arcpy.ListRasters()
for raster in rasterList:
rasterObj = arcpy.Raster(raster)
if raster in rasterValDict:
newRaster = rasterObj / rasterValDict[raster] * 100
newRaster.save(outputDirPath + "\\" + raster)
else:
print "ERROR: No matching entry in raster value look up dictionary!"