AnsweredAssumed Answered

Raster Calculator within loop

Question asked by workshop1 on Nov 26, 2010
Latest reply on Nov 26, 2010 by workshop1
Hi guys,
I want to use raster calculator with loop to consider many raters. however i got the following error:
ExecuteError: Failed to execute. Parameters are not valid.
ERROR 000989: Python syntax error: Parsing error <type 'exceptions.SyntaxError'>: invalid syntax (line 1)
Failed to execute (RasterCalculator).

any help would appreciate

Python script is:

import sys, string, os, arcgisscripting, math, arcpy
gp = arcgisscripting.create()
gp.OverWriteOutput = 1
gp.AddToolbox("C:/Program Files/ArcGIS/Desktop10.0/ArcToolbox/Toolboxes/Spatial Analyst Tools.tbx")

gp.workspace = "D:/Rc_FPAR_test/FPAR1000"

out_workspace = "D:/Rc_FPAR_test/FPAR250"
# Get a list of grids in the workspace.
rasters = gp.ListRasters("","TIF")

raster =
while raster:
    print raster
    raster =
raster =

print gp.GetMessages()

while raster:
    # Set local variables
    InRaster = raster
    # Set the outputname for each output to be the same as the input.
    OutRaster = out_workspace + "/" + raster
    # Check out Spatial Analyst extension license
    gp.CheckOutExtension("Spatial")"0.5913 *" + InRaster + " + 0.3896", OutRaster)
    print raster
    raster =
    # If an error occurred while running a tool, then print the messages.
    print gp.GetMessages()