Hi Joe,
I checked out this thread and the script you created. I'm glad you were able to reach a solution.
I wanted to show you another way to script it, using arcpy.env.workspace, and a boolean variable.
Using arcpy.env.workspace, you don't need to code the full path to every image in your list.
Using a boolean variable (i.e. 'tifOut' and some 'if' logic), you only need to update the code in one place, if you wish to switch from TIF to fgdb.
Please reach out if you have questions.
Happy scripting!
Dana
import arcpy
from arcpy.sa import *
import os
arcpy.env.workspace = r'C:\JoesStuff\SouthernImages'
tifOut = False
fgdbOut = 'Rasters.gdb'
imageList = ['12TVK1276.tif',
'12TVK1474.tif',
'12TVK1476.tif',
'C12TVK1674.tif',
'12TVK1676.tif',
'12TVK1874.tif',
'12TVK1876.tif',
'12TVK1877.tif',
'12TVK1976.tif',
'12TVK1977.tif',
'hh12TVK1200076000.img',
'hh12TVK1200078000.img',
'hh12TVK1400076000.img',
'hh12TVK1400078000.img',
'hh12TVK1600076000.img',
'hh12TVK1600078000.img',
'hh12TVK1800074000.img',
'hh12TVK1800076000.img',
'hh12TVK1800078000.img']
for image in imageList:
inRaster = image
outRaster = 'Slope' + os.path.splitext(image)[0]
if tifOut == True:
outRaster = outRaster + ".tif"
else:
outRaster = os.path.join(fgdbOut,outRaster)
outMeasurement = 'PERCENT_RISE'
zFactor = 1
method = 'PLANAR'
zUnit = 'METER'
outSlope = Slope(inRaster, outMeasurement, zFactor, method, zUnit)
outSlope.save(outRaster)