hi, just trying to run a simple code:
>>> import arcpy
... arcpy.CheckOutExtension("Spatial")
... arcpy.env.workspace = "C:\stuff\SCHISM_SLR_stuff\Con_Rasters\Con_0625"
... allRasters = arcpy.ListRasters("*","TIF")
... for eachRaster in allRasters:
... theRaster = Raster(eachRaster)
... outRaster = 6.25 - theRaster
... outRaster.save(eachRaster.replace('.tif','_Final.tif'))
The error is:
Runtime error
Traceback (most recent call last):
File "<string>", line 6, in <module>
NameError: name 'Raster' is not defined
Thanks for any help!
Dan
Solved! Go to Solution.
It should be "arcpy.Raster" instead of "Raster"
Also put an r before the workspace location:
arcpy.env.workspace = r"C:\stuff\SCHISM_SLR_stuff\Con_Rasters\Con_0625"
It should be "arcpy.Raster" instead of "Raster"
Also put an r before the workspace location:
arcpy.env.workspace = r"C:\stuff\SCHISM_SLR_stuff\Con_Rasters\Con_0625"
Thanks Xander!
What command is "Raster" supposed to be?
It converts a path to a raster into a raster object that allows you to the substract the rasters with the need to use the Minus tool.