Playa

ModelBuilder: "Merge Branch"

Discussion created by Playa on Feb 20, 2013
I've generated a model in ModelBuilder to automate the terrain preprocessing steps within ArcHydro. I've taken it a step further and generated a python condition script based on an argument supplied by the user to determine if Batch Watershed and Batch Subwatershed analysis is required. I then want to use "Merge Branch" to run the remaining processes as they are the same for Watersheds or Subwatershed. The problem that I have is either Batch Watershed or Batch Subwatershed will run due to the python condition statement and when I add both output to Merge Branch it won't run as its expecting both and not one or the other. I've attached my Python Script and as well as my ArcHydro Model.

Python Script:

# Import system modules
import arcpy

#Set the parameters
basinType = arcpy.GetParameterAsText(0)

try:
    if basinType == "Subwatershed":
        arcpy.SetParameterAsText(1,"True")
        arcpy.SetParameterAsText(2,"False")

    elif basinType == "Watershed":
        arcpy.SetParameterAsText(1,"False")
        arcpy.SetParameterAsText(2,"True")

except Exception as e:
        AddPrintMessage (e[0],2)

Attachments

Outcomes