SaturatedSoilThickness = Raster(saturatedSoilThickness) TotalSoilThickness = Raster(totalSoilThickness) #Cast input rasters to in-memory raster layers. #Set the output cell size, mask, and cell registration. #moistSoilUnitWeight = r"C:\gtemp\FS_test\moist_uw" #treeSurcharge = r"C:\gtemp\FS_test\surcharge" #treeRootStrength = r"C:\gtemp\FS_test\rootcohesion" #saturatedSoilThickness = r"C:\gtemp\FS_test\dw" #totalSoilThickness = r"C:\gtemp\FS_test\soildepth" #degreesSlope = r"C:\gtemp\FS_test\slope_degree" Rastercalc = arcpy.GetParameterAsText(11) WaterUnitWeight = float(arcpy.GetParameterAsText(10)) SaturatedSoilUnitWeight = float(arcpy.GetParameterAsText(9)) MoistSoilUnitWeight = arcpy.GetParameterAsText(8) SoilCohesion = float(arcpy.GetParameterAsText(5))ĮffectiveInternalAngleofFriction = float(arcpy.GetParameterAsText(6))ĭrySoilUnitWeight = float(arcpy.GetParameterAsText(7)) TreeSurcharge = arcpy.GetParameterAsText(4) TreeRootStrength = arcpy.GetParameterAsText(3) SaturatedSoilThickness = arcpy.GetParameterAsText(2) TotalSoilThickness = arcpy.GetParameterAsText(1) #Get input parameters using ArcToolbox toolĭegreesSlope = arcpy.GetParameterAsText(0) It throws an error at line 62 (numerator) where the standalone does not.looks line another bug.Īrcpy.AddMessage("beta by Gerry Gabrisch, 5-4-2012") Now that I got my tool running as a standalone script I set it to work as an ArcToolbox tool. #arcpy.gp.RasterCalculator_sa("treeRootStrength soilCohesion Square(Cos(degreesSlope))*(treeSurcharge moistSoilUnitWeight*(totalSoilThickness - saturatedSoilThickness) (saturatedSoilUnitWeigh-waterUnitWeight)*saturatedSoilThickness)*Tan(effectiveInternalAngleofFriction))/((Sin(degreesSlope)*Cos(degreesSlope))*(treeSurcharge moistSoilUnitWeight*(totalSoilThickness - saturatedSoilThickness) drySoilUnitWeight * saturatedSoilThickness))", rastercalc) Numerator =((treeRootStrength soilCohesion Square(Cos(degreesSlope))*(treeSurcharge moistSoilUnitWeight*(totalSoilThickness - saturatedSoilThickness) (saturatedSoilUnitWeight-waterUnitWeight)*saturatedSoilThickness)*Tan(effectiveInternalAngleofFriction)))ĭenominator =((Sin(degreesSlope)*Cos(degreesSlope))*(treeSurcharge moistSoilUnitWeight*(totalSoilThickness - saturatedSoilThickness) drySoilUnitWeight * saturatedSoilThickness), denominator) I can get something like the below to work without error, but I cant get passed 'numerator' in the code below without getting the cell size and extent not set error.Īrcpy.AddMessage("\n\nCalculate Slope Factor of Safety") According to the literature I can use raster calculator like expression ( ,-,/.) as long as I cast the raster as 'rasters'. OK, I removed the raster calculator functions from the script. Msgs = "ArcPy ERRORS:\n" arcpy.GetMessages(2) "\n" Pymsg = "PYTHON ERRORS:\nTraceback info:\n" tbinfo "\nError Info:\n" str(sys.exc_info()) Rastercalc = r"C:\gtemp\FS_test\dwrastercalc"Īrcpy.gp.RasterCalculator_sa((treeRootStrength soilCohesion Square(Cos(degreesSlope))*(treeSurcharge moistSoilUnitWeight*(totalSoilThickness - saturatedSoilThickness) (saturatedSoilUnitWeight-waterUnitWeight)*saturatedSoilThickness)*Tan(effectiveInternalAngleofFriction)), numerator)Īrcpy.gp.RasterCalculator_sa((Sin(degreesSlope)*Cos(degreesSlope))*(treeSurcharge moistSoilUnitWeight*(totalSoilThickness - saturatedSoilThickness) drySoilUnitWeight * saturatedSoilThickness), denominator)Īrcpy.gp.RasterCalculator_sa(numerator/denominator, rastercalc ) MoistSoilUnitWeight = Raster(r"C:\gtemp\FS_test\moist_uw") TreeSurcharge = Raster(r"C:\gtemp\FS_test\surcharge") TreeRootStrength = Raster(r"C:\gtemp\FS_test\rootcohesion") SaturatedSoilThickness = Raster(r"C:\gtemp\FS_test\dw") TotalSoilThickness = Raster(r"C:\gtemp\FS_test\soildepth") Any help is welcomed.ĭegreesSlope = Raster(r"C:\gtemp\FS_test\slope_degree") That didn't help, the code still throws the same error at the first raster calculator statement. I don't see why this is necessary in this script but I put in some extent and cell size statements anyway. My Python code throws an error at the first raster calculator statement claiming that no cell size or extent are set.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |