# -*- coding: utf-8 -*-
# ---------------------------------------------------------------------------
# slope.py
# Created on: 2016-06-05 21:59:23.00000
#   (generated by ArcGIS/ModelBuilder)
# Description: 
# ---------------------------------------------------------------------------

# Import arcpy module
import arcpy


# Local variables:
elevnad83 = "C:\\Users\\hmpou\\Documents\\TXDEM051915\\grids\\std_exents\\elevnad83"
slope83 = "C:\\Users\\hmpou\\Documents\\TXDEM051915\\smoothed060216\\slope83"
slopewgs = "C:\\Users\\hmpou\\Documents\\TXDEM051915\\smoothed060216\\slopewgs"
cm_elev = "C:\\Users\\hmpou\\Documents\\TXDEM051915\\final_zipped_grids\\CM\\elev.asc"
masked_cm = "C:\\Users\\hmpou\\Documents\\ArcGIS\\Default.gdb\\Extract_slop1"
slope_asc = "C:\\Users\\hmpou\\Documents\\TXDEM051915\\final_zipped_grids\\CM\\slope.asc"
gm_elev = "C:\\Users\\hmpou\\Documents\\TXDEM051915\\final_zipped_grids\\GM\\elev.asc"
masked_gm = "C:\\Users\\hmpou\\Documents\\ArcGIS\\Default.gdb\\Extract_slop2"
slope_asc__3_ = "C:\\Users\\hmpou\\Documents\\TXDEM051915\\final_zipped_grids\\GM\\slope.asc"
dm_elev = "C:\\Users\\hmpou\\Documents\\TXDEM051915\\final_zipped_grids\\DM\\DM\\elev.asc"
masked_dm = "C:\\Users\\hmpou\\Documents\\ArcGIS\\Default.gdb\\Extract_slop3"
slope_asc__2_ = "C:\\Users\\hmpou\\Documents\\TXDEM051915\\final_zipped_grids\\DM\\DM\\slope.asc"

# Process: Slope
arcpy.gp.Slope_sa(elevnad83, slope83, "DEGREE", "1")

# Process: Project Raster
arcpy.ProjectRaster_management(slope83, slopewgs, "GEOGCS['GCS_WGS_1984',DATUM['D_WGS_1984',SPHEROID['WGS_1984',6378137.0,298.257223563]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]]", "NEAREST", "2.83559221965916E-04 2.83559221965916E-04", "WGS_1984_(ITRF00)_To_NAD_1983", "", "PROJCS['NAD_1983_UTM_Zone_13N',GEOGCS['GCS_North_American_1983',DATUM['D_North_American_1983',SPHEROID['GRS_1980',6378137.0,298.257222101]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]],PROJECTION['Transverse_Mercator'],PARAMETER['False_Easting',500000.0],PARAMETER['False_Northing',0.0],PARAMETER['Central_Meridian',-105.0],PARAMETER['Scale_Factor',0.9996],PARAMETER['Latitude_Of_Origin',0.0],UNIT['Meter',1.0]]")

# Process: extract mask CM
tempEnvironment0 = arcpy.env.snapRaster
arcpy.env.snapRaster = "C:\\Users\\hmpou\\Documents\\TXDEM051915\\final_zipped_grids\\CM\\elev.asc"
tempEnvironment1 = arcpy.env.extent
arcpy.env.extent = "-103.6698019919 29.032009197477 -102.942579769096 29.529231420097"
tempEnvironment2 = arcpy.env.cellSize
arcpy.env.cellSize = "2.77777778000001E-04"
tempEnvironment3 = arcpy.env.mask
arcpy.env.mask = "C:\\Users\\hmpou\\Documents\\TXDEM051915\\final_zipped_grids\\CM\\elev.asc"
arcpy.gp.ExtractByMask_sa(slopewgs, cm_elev, masked_cm)
arcpy.env.snapRaster = tempEnvironment0
arcpy.env.extent = tempEnvironment1
arcpy.env.cellSize = tempEnvironment2
arcpy.env.mask = tempEnvironment3

# Process: Raster to ASCII CM
arcpy.RasterToASCII_conversion(masked_cm, slope_asc)

# Process: extract mask GM
tempEnvironment0 = arcpy.env.snapRaster
arcpy.env.snapRaster = "C:\\Users\\hmpou\\Documents\\TXDEM051915\\final_zipped_grids\\GM\\elev.asc"
tempEnvironment1 = arcpy.env.extent
arcpy.env.extent = "-105.1699300894 31.718225977625 -104.48520786663 32.186559311333"
tempEnvironment2 = arcpy.env.cellSize
arcpy.env.cellSize = "2.77777778000002E-04"
tempEnvironment3 = arcpy.env.mask
arcpy.env.mask = "C:\\Users\\hmpou\\Documents\\TXDEM051915\\final_zipped_grids\\GM\\elev.asc"
arcpy.gp.ExtractByMask_sa(slopewgs, gm_elev, masked_gm)
arcpy.env.snapRaster = tempEnvironment0
arcpy.env.extent = tempEnvironment1
arcpy.env.cellSize = tempEnvironment2
arcpy.env.mask = tempEnvironment3

# Process: Raster to ASCII GM
arcpy.RasterToASCII_conversion(masked_gm, slope_asc__3_)

# Process: extract mask DM
tempEnvironment0 = arcpy.env.snapRaster
arcpy.env.snapRaster = "C:\\Users\\hmpou\\Documents\\TXDEM051915\\final_zipped_grids\\DM\\DM\\elev.asc"
tempEnvironment1 = arcpy.env.extent
arcpy.env.extent = "-104.57461785062 30.448603245144 -103.671562294342 31.073047690088"
tempEnvironment2 = arcpy.env.cellSize
arcpy.env.cellSize = "2.77777778000002E-04"
tempEnvironment3 = arcpy.env.mask
arcpy.env.mask = "C:\\Users\\hmpou\\Documents\\TXDEM051915\\final_zipped_grids\\DM\\DM\\elev.asc"
arcpy.gp.ExtractByMask_sa(slopewgs, dm_elev, masked_dm)
arcpy.env.snapRaster = tempEnvironment0
arcpy.env.extent = tempEnvironment1
arcpy.env.cellSize = tempEnvironment2
arcpy.env.mask = tempEnvironment3

# Process: Raster to ASCII DM
arcpy.RasterToASCII_conversion(masked_dm, slope_asc__2_)

