AnsweredAssumed Answered

Raster Calculator Expression used during iteration loop

Question asked by wtgeographer on Apr 22, 2014
Latest reply on May 23, 2014 by wtgeographer
I was wondering if someone can help with the following Raster Calculator Expression.  I am trying to calculate the output least cost path raster to "null" where the end points overlap full least cost path raster.  Additionally I am trying to use in -line variable substitution in the expression as the following snippet iterates 3 times.

I hope I have made sense.  I appreciate any suggestions?

Entire function:
# Process: Cost Distance           arcpy.gp.CostDistance_sa(destValue, weighted_Raster, "distance_Raster", "", 'backlink_Raster')      # Process: Cost Path     Least_Cost_Path = arcpy.gp.CostPath_sa(originValue,"distance_Raster", "backlink_Raster", os.path.join(savepath + "\\Results.gdb" + "\\lcp_" + str(count)), "EACH_CELL", "OBJECTID")      global count      while count < 3:          # Local variables:         End_Pts = 'End_Pts'         Output_polyline_features = 'Output_polyline_features'         End_Pts_Raster = 'End_Pts_Raster'         Least_Cost_Route = 'Least_Cost_Route'         Reclass_rast1 = 'Reclass_rast1'          # Process: Raster to Polyline         arcpy.RasterToPolyline_conversion(Least_Cost_Path, Output_polyline_features, "ZERO", "0", "SIMPLIFY", "")          # Process: Feature Vertices To Points         arcpy.FeatureVerticesToPoints_management(Output_polyline_features, End_Pts, "BOTH_ENDS")          # Process: Point to Raster         arcpy.PointToRaster_conversion(End_Pts, "", End_Pts_Raster, "MOST_FREQUENT", "NONE", Least_Cost_Path)          # Process: Raster Calculator         arcpy.gp.RasterCalculator_sa("SetNull(~IsNull("%End_Pts_Raster%"), \"%Least_Cost_Path%\")", Least_Cost_Route)

Set null statement:
       arcpy.gp.RasterCalculator_sa("SetNull(~IsNull("%End_Pts_Raster%"), \"%Least_Cost_Path%\")", Least_Cost_Route)

Outcomes