# -*- coding: utf-8 -*-
# ---------------------------------------------------------------------------
# ClippingGeneralizationTool.py
# Created on: 2016-05-19 15:40:35.00000
#   (generated by ArcGIS/ModelBuilder)
# Usage: ClippingGeneralizationTool <NHD_Flowline_Input> <Save_NHD_Flowline_Clip> <Original_Geology_Input> <Save_Original_Geology_Clip> <Save_Generalized_Geology> <PRISM_Input> <Save_PRISM_Clip> <Clip_Features>
# Description:
# ---------------------------------------------------------------------------

# Import arcpy module
import arcpy, sys
from arcpy.sa import *
arcpy.env.overwriteOutput = True

# Script arguments
line_in = arcpy.GetParameterAsText(0) # Input NHD flowline
line_out = arcpy.GetParameterAsText(1) # Save flowline clip
geo_in = arcpy.GetParameterAsText(2) # Input original geology
geo_clip = arcpy.GetParameterAsText(3) # Save original geology clip
geo_out = arcpy.GetParameterAsText(4) # Save generalized geology
prism_in = arcpy.GetParameterAsText(5) # Input prism
prism_out = arcpy.GetParameterAsText(6) # Save clipped PRISM output
clip_file = arcpy.GetParameterAsText(7) # Clip feature

# Process: NHD Flowline Clip
arcpy.AddMessage("Clipping the NHD flowline layer")
arcpy.Clip_analysis(line_in, clip_file, line_out, "")

# Process: Clip
arcpy.AddMessage("Clipping the original geology layer")
arcpy.Clip_analysis(geo_in, clip_file, geo_clip, "")

# Process: Dissolve
arcpy.AddMessage("Creating a generalized geology layer")
arcpy.Dissolve_management(geo_clip, geo_out, "ROCKTYPE1", "", "MULTI_PART", "DISSOLVE_LINES")

# Process: Clip PRISM
arcpy.AddMessage("Clipping the PRISM layer")
arcpy.Clip_management(prism_in, "", prism_out, clip_file, "", "NONE", "NO_MAINTAIN_EXTENT")

arcpy.AddMessage("Processing complete!")