# -*- coding: utf-8 -*-
# ---------------------------------------------------------------------------
# weighted_overlay.py
# Created on: 2020-01-19 19:13:54.00000
#   (generated by ArcGIS/ModelBuilder)
# Usage: weighted_overlay <Clipped_Streams> <Pos_Climbing_Areas> <yoseglg_clp> <Springs_EDist> <Trails_EDist> <Roads_EDist> <Rivers_EDist> <Parking_EDist> <Climb_EDist> <Best_YosemiteV_Climbing> 
# Description: 
# ---------------------------------------------------------------------------

# Import arcpy module
import arcpy

# Script arguments
Clipped_Streams = arcpy.GetParameterAsText(0)

Pos_Climbing_Areas = arcpy.GetParameterAsText(1)

yoseglg_clp = arcpy.GetParameterAsText(2)

Springs_EDist = arcpy.GetParameterAsText(3)

Trails_EDist = arcpy.GetParameterAsText(4)

Roads_EDist = arcpy.GetParameterAsText(5)

Rivers_EDist = arcpy.GetParameterAsText(6)

Parking_EDist = arcpy.GetParameterAsText(7)

Climb_EDist = arcpy.GetParameterAsText(8)

Best_YosemiteV_Climbing = arcpy.GetParameterAsText(9)
if Best_YosemiteV_Climbing == '#' or not Best_YosemiteV_Climbing:
    Best_YosemiteV_Climbing = "C:\\GIS\\scratch.gdb\\Best_YosemiteV_Climbing" # provide a default value if unspecified

# Local variables:
Reclass_Trai1 = ""
Reclass_Clim1 = ""
Reclass_Rive1 = ""
Reclass_Park1 = ""
Reclass_Road1 = ""
yoseglg_clp_Dissolve = ""
yoseglg_clp_Dissolve_Polygon = ""
Reclass_yose2 = ""
Reclass_Spri2 = ""
Reclass_Pos_1 = ""
Clipped_Streams_PolylineToRa1 = ""
Expand_Clipp1 = ""
Reclass_Expa3 = ""
Best_Climbing_Criteria = ""
Input_true_raster_or_constant_value = "1"
con__2_ = ""
RasterT_con1 = ""

# Set Geoprocessing environments
arcpy.env.scratchWorkspace = "C:\\GIS\\scratch.gdb"
arcpy.env.workspace = "C:\\GIS\\scratch.gdb"

# Process: Reclassify (6)
arcpy.gp.Reclassify_sa(Trails_EDist, "", "0 200 10;200 400 9;400 600 8;600 800 7;800 1000 6;1000 1200 5;1200 1400 4;1400 1600 3;1600 1800 2;1800 2300 1", Reclass_Trai1, "DATA")

# Process: Reclassify (1)
arcpy.gp.Reclassify_sa(Climb_EDist, "", "0 250 10;250 500 9;500 750 8;750 1000 7;1000 1250 6;1250 1500 5;1500 1750 4;1750 2000 3;2000 2250 2;2250 10357.391602 1", Reclass_Clim1, "DATA")

# Process: Reclassify (5)
arcpy.gp.Reclassify_sa(Rivers_EDist, "", "0 20 0;20 200 9;200 1000 8;1000 2000 7;2000 3000 6;3000 4000 5;4000 5000 4;5000 6000 3;6000 7000 2;7000 12300 1", Reclass_Rive1, "DATA")

# Process: Reclassify (2)
arcpy.gp.Reclassify_sa(Parking_EDist, "", "0 1000 10;1000 2000 9;2000 3000 8;3000 4000 7;4000 5000 6;5000 6000 5;6000 7000 4;7000 8000 3;8000 9000 2;9000 10545.710938 1", Reclass_Park1, "DATA")

# Process: Reclassify (4)
arcpy.gp.Reclassify_sa(Roads_EDist, "", "0 500 10;500 1000 9;1000 2000 8;2000 3000 7;3000 4000 6;4000 5000 5;5000 6000 4;6000 7000 3;7000 8000 2;8000 9700 1", Reclass_Road1, "DATA")

# Process: Dissolve
arcpy.Dissolve_management(yoseglg_clp, yoseglg_clp_Dissolve, "GLG_SYM", "GLG_SYM COUNT;GLG_AGE_NO FIRST", "MULTI_PART", "DISSOLVE_LINES")

# Process: Polygon to Raster
arcpy.PolygonToRaster_conversion(yoseglg_clp_Dissolve, "OBJECTID", yoseglg_clp_Dissolve_Polygon, "CELL_CENTER", "NONE", Pos_Climbing_Areas)

# Process: Reclassify (3)
arcpy.gp.Reclassify_sa(yoseglg_clp_Dissolve_Polygon, "", "1 17 2;17 23 1", Reclass_yose2, "DATA")

# Process: Reclassify
arcpy.gp.Reclassify_sa(Springs_EDist, "", "0 600 10;600 1200 9;1200 1800 8;1800 2400 7;2400 3000 6;3000 3600 5;3600 4200 4;4200 4800 3;4800 5400 2;5400 6440 1", Reclass_Spri2, "DATA")

# Process: Reclassify (7)
arcpy.gp.Reclassify_sa(Pos_Climbing_Areas, "", "0.002473 16.158496 1;16.158496 25.641379 2;25.641379 33.368173 3;33.368173 40.041313 4;40.041313 46.714452 5;46.714452 53.387592 6;53.387592 60.411950 7;60.411950 67.787526 8;67.787526 76.216755 9;76.216755 89.914253 10", Reclass_Pos_1, "DATA")

# Process: Weighted Overlay
arcpy.gp.WeightedOverlay_sa("('' 2 'Value' (1 1; 2 2; 3 3; 4 4; 5 5; 6 6; 7 7; 8 8; 9 9; 10 10;NODATA NODATA); '' 50 'Value' (1 Restricted; 2 Restricted; 3 Restricted; 4 Restricted; 5 Restricted; 6 Restricted; 7 7; 8 8; 9 9; 10 10;NODATA NODATA));1 10 1", Best_YosemiteV_Climbing)

# Process: Polyline to Raster (2)
arcpy.PolylineToRaster_conversion(Clipped_Streams, "grid_code", Clipped_Streams_PolylineToRa1, "MAXIMUM_LENGTH", "NONE", Pos_Climbing_Areas)

# Process: Expand
arcpy.gp.Expand_sa(Clipped_Streams_PolylineToRa1, Expand_Clipp1, "4", "1;2;3;4;5;6;7;8;9")

# Process: Reclassify (9)
arcpy.gp.Reclassify_sa(Expand_Clipp1, "", "1 1.800000 1;1.800000 2.600000 2;2.600000 3.400000 3;3.400000 4.200000 4;4.200000 5 5;5 5.800000 6;5.800000 6.600000 7;6.600000 7.400000 8;7.400000 8.200000 9;8.200000 9 10", Reclass_Expa3, "DATA")

# Process: Con
arcpy.gp.Con_sa(Best_Climbing_Criteria, Input_true_raster_or_constant_value, con__2_, "", "Value = 10")

# Process: Raster to Polygon
arcpy.RasterToPolygon_conversion(con__2_, RasterT_con1, "SIMPLIFY", "", "MULTIPLE_OUTER_PART", "")

