I'm trying to multiply my raster to 100 from my ListRasters. I've adapted the code (especially the for loop portion) also from this site.
Now, I'm encountering an error at the last line, when saving the raster.
How can I successfully run this code?
#import the module
import arcpy
from arcpy.sa import *
from arcpy import env
arcpy.CheckOutExtension("Spatial")
env.overwriteOutput = True
#set the workspace
arcpy.env.workspace = r"C:\Users\Windows\Documents\JO_GIS_Analyst"
#Create a list of raster files
rasterList = arcpy.ListRasters("reprojected*", "TIF")
#Loop through the list of ListRaster
for k in rasterList:
print k #check the presence of rasters
OutRaster = (k)*100) #multiplying the raster by 100
OutRaster_Name = "nofpt" + k #specifying the output name
OutRaster.save(OutRaster_Name) #saving the raster
Best Answer
I believe the problem is that the code trying to multiply the name of the raster, rather than the raster itself. Try: