My Python code throws an error at the first raster calculator statement claiming that no cell size or extent are set. I don't see why this is necessary in this script but I put in some extent and cell size statements anyway. That didn't help, the code still throws the same error at the first raster calculator statement. Any help is welcomed.try:
import arcpy, os, sys, traceback
from arcpy.sa import *
arcpy.CheckOutExtension("Spatial")
degreesSlope = Raster(r"C:\gtemp\FS_test\slope_degree")
totalSoilThickness = Raster(r"C:\gtemp\FS_test\soildepth")
saturatedSoilThickness = Raster(r"C:\gtemp\FS_test\dw")
treeRootStrength = Raster(r"C:\gtemp\FS_test\rootcohesion")
treeSurcharge = Raster(r"C:\gtemp\FS_test\surcharge")
moistSoilUnitWeight = Raster(r"C:\gtemp\FS_test\moist_uw")
numerator = "numerator"
denominator = "denominator"
#Constants...
soilCohesion = 10.0
effectiveInternalAngleofFriction = 10.0
drySoilUnitWeight = 10.0
saturatedSoilUnitWeight = 10.0
waterUnitWeight = 10.0
rastercalc = r"C:\gtemp\FS_test\dwrastercalc"
arcpy.env.cellSize = "MAXOF"
arcpy.env.extent = "MAXOF"
arcpy.gp.RasterCalculator_sa((treeRootStrength + soilCohesion + Square(Cos(degreesSlope))*(treeSurcharge + moistSoilUnitWeight*(totalSoilThickness - saturatedSoilThickness)+ (saturatedSoilUnitWeight-waterUnitWeight)*saturatedSoilThickness)*Tan(effectiveInternalAngleofFriction)), numerator)
arcpy.gp.RasterCalculator_sa((Sin(degreesSlope)*Cos(degreesSlope))*(treeSurcharge + moistSoilUnitWeight*(totalSoilThickness - saturatedSoilThickness) + drySoilUnitWeight * saturatedSoilThickness), denominator)
arcpy.gp.RasterCalculator_sa(numerator/denominator, rastercalc )
arcpy.AddMessage("Done!")
except arcpy.ExecuteError:
msgs = arcpy.GetMessages(2)
arcpy.AddError(msgs)
print msgs
except:
tb = sys.exc_info()[2]
tbinfo = traceback.format_tb(tb)[0]
pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str(sys.exc_info()[1])
msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages(2) + "\n"
arcpy.AddError(pymsg)
arcpy.AddError(msgs)
print pymsg + "\n"
print msgs