# Import arcpy module
import arcpy
# Load required toolboxes
arcpy.ImportToolbox("Model Functions")
# Script arguments
Your_AMU_Name = arcpy.GetParameterAsText(0)
if Your_AMU_Name == '#' or not Your_AMU_Name:
Your_AMU_Name = "BNDRYNAME = 'AB'" # provide a default value if unspecified
Your_Projected_LSD_Grid = arcpy.GetParameterAsText(1)
if Your_Projected_LSD_Grid == '#' or not Your_Projected_LSD_Grid:
Your_Projected_LSD_Grid = "Abr_Grid_GP_U_CH" # provide a default value if unspecified
Your_NPR = arcpy.GetParameterAsText(2)
if Your_NPR == '#' or not Your_NPR:
Your_NPR = "GP_U_CH_H" # provide a default value if unspecified
Exported_AMU_Layer__not_SDE_ = arcpy.GetParameterAsText(3)
if Exported_AMU_Layer__not_SDE_ == '#' or not Exported_AMU_Layer__not_SDE_:
Exported_AMU_Layer__not_SDE_ = "AMU_1" # provide a default value if unspecified
Tool_test_2_Layer = arcpy.GetParameterAsText(4)
if Tool_test_2_Layer == '#' or not Tool_test_2_Layer:
Tool_test_2_Layer = "Abr_Grid_GP_U_CH_Layer" # provide a default value if unspecified
# Local variables:
AMU_1__4_ = Your_AMU_Name
Abr_Grid_GP_U_CH__2_ = AMU_1__4_
Abr_Grid_GP_U_CH__3_ = Abr_Grid_GP_U_CH__2_
Output_Layer = Abr_Grid_GP_U_CH__3_
Selected_Countour = AMU_1__4_
GP_U_CH_Statistics1 = Selected_Countour
Value__2_ = GP_U_CH_Statistics1
Value = Value__2_
# Process: Select Layer By Attribute
arcpy.SelectLayerByAttribute_management(Exported_AMU_Layer__not_SDE_, "NEW_SELECTION", Your_AMU_Name)
# Process: Select Layer By Location (2)
arcpy.SelectLayerByLocation_management(Your_Projected_LSD_Grid, "INTERSECT", AMU_1__4_, "", "NEW_SELECTION")
# Process: Select Layer By Location
arcpy.SelectLayerByLocation_management(Abr_Grid_GP_U_CH__2_, "INTERSECT", Your_NPR, "", "SUBSET_SELECTION")
# Process: Make Feature Layer
arcpy.MakeFeatureLayer_management(Abr_Grid_GP_U_CH__3_, Output_Layer, "", "", "FID FID VISIBLE NONE;Shape Shape VISIBLE NONE;DLS_TAG DLS_TAG VISIBLE NONE;H1 H1 VISIBLE NONE")
# Process: Select Layer By Location (3)
arcpy.SelectLayerByLocation_management(Your_NPR, "INTERSECT", AMU_1__4_, "", "NEW_SELECTION")
# Process: Summary Statistics
arcpy.Statistics_analysis(Selected_Countour, GP_U_CH_Statistics1, "Elevation MAX", "")
# Process: Get Field Value
arcpy.GetFieldValue_mb(GP_U_CH_Statistics1, "MAX_Elevation", "Long", "0")
# Process: For
arcpy.IterateCount_mb("0", Value__2_, "1")
# Process: Add Field
arcpy.AddField_management(Output_Layer, "H%Value%", "SHORT", "", "", "", "", "NULLABLE", "NON_REQUIRED", "")