# -*- coding: utf-8 -*-
# ---------------------------------------------------------------------------
# Pour_Point_to_Watershed.py
# Created on: 2020-12-03 18:15:27.00000
#   (generated by ArcGIS/ModelBuilder)
# Usage: Pour_Point_to_Watershed <Pour_Point> <Flow_Accumulation> <Flow_Direction> <Wetland_Watershed_Raster> <Pour_Point_Raster>
# Description: Create watershed from a point on the streams feature created with the accompanying DEM/Watershed to streams script.
# ---------------------------------------------------------------------------

# Import modules
import arcpy
from arcpy.sa import *  #imports spatial analyst module

# Set Environment
print("Enter workspace:")  #workspace environment
w = raw_input("")
arcpy.env.workspace = w
print("Enter scratch workspace:")  #scratch workspace environment
sw = raw_input("")
arcpy.env.scratchWorkspace = sw
print("Output overwrite = False")
arcpy.env.overwriteOutput = False

#Extension Check out
arcpy.CheckOutExtension("Spatial")

# Script arguments
print("Enter single pour point feature shapefile:") #Point shapefile with 1 feature input, do not have more than 1 point in this feature
Pour_Point = raw_input("")

print("Enter flow accumulation raster: ")   #Enter the flow accumulation raster created from the accompanying script
Flow_Accumulation = raw_input("")

print("Enter pour point raster output name with extension:") #Enter the pour point raster output name.  Change it so it does not match another pour point.
Pour_Point_Raster = raw_input("")

print("Enter flow direction raster:")   #Enter the flow direction raster created from the accompanying script
Flow_Direction = raw_input("")

print("Enter watershed raster output name with extension:") #Enter the watershed output name.  Change it so it does not match another watershed. Recommended to match it with the pour point.
Wetland_Watershed_Raster = raw_input("")



# Local variables:


# Process: Snap Pour Point
print("Executing Snap Pour Point tool")
Raster_Pour_Point = SnapPourPoint(Pour_Point,
                                  Flow_Accumulation,
                                  "30",
                                  "")
Raster_Pour_Point.save(Pour_Point_Raster)

# Process: Watershed
print("Snape Pour Point tool completed, now executing Watershed tool")
Raster_Wetland_Watershed = Watershed(Flow_Direction,
                                     Raster_Pour_Point,
                                     "")
Raster_Wetland_Watershed.save(Wetland_Watershed_Raster)
