I am using ArcMap 9.1 and I would like to have a batch file that will perform operations in Spatial Analyst for me. For example, I would like to take a bunch of rasters/arc grids and perform an spatial analyst operation on them (e.g. Raster calculator operations: (Grid_A) + (Grid_A * 10) = Grid_B, then CON([Grid_B] == 21, [Grid_B], [Grid_C])
In English: I want to take grid A and add it to grid A times 10, then use this new grid B and combine in with Grid C, but use grid B where the value = 21, otherwise use Grid C.
Basically, I don't know much about programming but I'd like to have a code that is easily modified. I would also appreciate annotation.
I'd like it to save each new file from the final operation with a sequential two-digit number appended to the end (e.g. 01, 02, 75, etc)
Esri's help gives scripting examples for the specific procedures, but I still need help.
I used python to create the following script which performed the following operation and I also don't know why it works exactly, but it does. I forgot what the '.strip' does. (Its work in 9.2, but I'd like it to work in 9.1 if possible, also its using python 2.4):
CON(ISNULL(donut grid), landcovergrid, landcovergrid * -1
# Runs an expression bu
# Import system modules
import sys, arcgisscripting
# Create the Geoprocessor object
gp = arcgisscripting.create()
f = open(sys.argv,'r')
circlefile = open(sys.argv,'r')
count = 1
dir = 'c:\\temp\\'
for landcover in f.readlines():
donut = circlefile.readline()
# Set local variables
Outfile = dir + 'LC16_H' + `count`
InExpression = "CON(ISNULL(" + donut.strip() + ")," + landcover.strip() + "," + landcover.strip() + " * -1)"
# Check out Spatial Analyst extension license
# Process: MapAlgebra
count = count + 1
# If an error occurred while running a tool, then print the messages.