import sys, string, os, arcgisscripting, math, arcpy
gp = arcgisscripting.create()
gp.OverWriteOutput = 1
gp.CheckOutExtension("spatial")
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 = rasters.next()
while raster:
print raster
raster = rasters.next()
rasters.reset()
raster = rasters.next()
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")
arcpy.gp.RasterCalculator_sa("0.5913 *" + InRaster + " + 0.3896", OutRaster)
print raster
raster = rasters.next()
# If an error occurred while running a tool, then print the messages.
print gp.GetMessages()
Solved! Go to Solution.
import sys, string, os, arcgisscripting, math, arcpy
gp = arcgisscripting.create()
gp.OverWriteOutput = 1
gp.CheckOutExtension("spatial")
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 = rasters.next()
while raster:
print raster
raster = rasters.next()
rasters.reset()
raster = rasters.next()
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")
gp.Times_sa(InRaster, 0.5913 , OutRaster)
outTimes = Raster(InRaster) * 0.5913
outPlus = outTimes + 0.3896
outPlus.save(OutRaster)
print raster
raster = rasters.next()
# If an error occurred while running a tool, then print the messages.
print gp.GetMessages()
]print gp.GetMessages()
import sys, string, os, arcgisscripting, math, arcpy
gp = arcgisscripting.create()
gp.OverWriteOutput = 1
gp.CheckOutExtension("spatial")
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 = rasters.next()
while raster:
print raster
raster = rasters.next()
rasters.reset()
raster = rasters.next()
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")
gp.Times_sa(InRaster, 0.5913 , OutRaster)
outTimes = Raster(InRaster) * 0.5913
outPlus = outTimes + 0.3896
outPlus.save(OutRaster)
print raster
raster = rasters.next()
# If an error occurred while running a tool, then print the messages.
print gp.GetMessages()
]