-
Notifications
You must be signed in to change notification settings - Fork 0
/
Script-5-Model.py
69 lines (53 loc) · 5.01 KB
/
Script-5-Model.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# -*- coding: utf-8 -*-
"""
Generated by ArcGIS ModelBuilder on : 2023-03-07 19:12:13
"""
import arcpy
from arcpy.sa import *
def Model(): # Model
# To allow overwriting outputs change overwriteOutput option to True.
arcpy.env.overwriteOutput = False
# Model Environment settings
with arcpy.EnvManager(cellSize="Elevation", extent="427738.551679547 210122.964165066 494453.949501122 234223.418565066 PROJCS["NAD_1983_StatePlane_Vermont_FIPS_4400",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",-72.5],PARAMETER["Scale_Factor",0.9999642857142857],PARAMETER["Latitude_Of_Origin",42.5],UNIT["Meter",1.0]],VERTCS["Unknown VCS",VDATUM["Unknown"],PARAMETER["Vertical_Shift",0.0],PARAMETER["Direction",1.0],UNIT["Foot_US",0.3048006096012192]]", mask="Elevation",
outputCoordinateSystem="PROJCS["NAD_1983_StatePlane_Vermont_FIPS_4400",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",-72.5],PARAMETER["Scale_Factor",0.9999642857142857],PARAMETER["Latitude_Of_Origin",42.5],UNIT["Meter",1.0]],VERTCS["Unknown VCS",VDATUM["Unknown"],PARAMETER["Vertical_Shift",0.0],PARAMETER["Direction",1.0],UNIT["Foot_US",0.3048006096012192]]"):
Streams = "Streams"
Elevation = arcpy.Raster("Elevation")
LandUse = arcpy.Raster("LandUse")
# Process: Distance Accumulation (Distance Accumulation) (sa)
Distanc_Stre1 = "C:\\Users\\akunna1\\Desktop\\GEOG 592\\Lab_5\\Lab_5_Akunna\\Default.gdb\\Distanc_Stre1"
Distance_Accumulation = Distanc_Stre1
Out_back_direction_raster = ""
Out_source_direction_raster = ""
Out_source_location_raster = ""
Distanc_Stre1 = arcpy.sa.DistanceAccumulation(in_source_data=Streams, in_barrier_data="", in_surface_raster="", in_cost_raster="", in_vertical_raster="", vertical_factor="BINARY 1 -30 30", in_horizontal_raster="", horizontal_factor="BINARY 1 45", out_back_direction_raster=Out_back_direction_raster, out_source_direction_raster=Out_source_direction_raster, out_source_location_raster=Out_source_location_raster, source_initial_accumulation="", source_maximum_accumulation="", source_cost_multiplier="", source_direction="", distance_method="PLANAR")
Distanc_Stre1.save(Distance_Accumulation)
# Process: Slope (Slope) (sa)
Slope_Elevat1 = "C:\\Users\\akunna1\\Desktop\\GEOG 592\\Lab_5\\Lab_5_Akunna\\Default.gdb\\Slope_Elevat1"
Slope = Slope_Elevat1
Slope_Elevat1 = arcpy.sa.Slope(in_raster=Elevation, output_measurement="DEGREE", z_factor=0.30480060960121924, method="PLANAR", z_unit="METER")
Slope_Elevat1.save(Slope)
# Process: Reclassify (Reclassify) (sa)
Reclass_Slop1 = "C:\\Users\\akunna1\\Desktop\\GEOG 592\\Lab_5\\Lab_5_Akunna\\Default.gdb\\Reclass_Slop1"
Reclassify = Reclass_Slop1
Reclass_Slop1 = arcpy.sa.Reclassify(in_raster=Slope_Elevat1, reclass_field="VALUE", remap="0 3 1;3 10 3;10 25 6;25 90 0", missing_values="DATA")
Reclass_Slop1.save(Reclassify)
# Process: Reclassify (2) (Reclassify) (sa)
Reclass_Land1 = "C:\\Users\\akunna1\\Desktop\\GEOG 592\\Lab_5\\Lab_5_Akunna\\Default.gdb\\Reclass_Land1"
Reclassify_2_ = Reclass_Land1
Reclass_Land1 = arcpy.sa.Reclassify(in_raster=LandUse, reclass_field="VALUE", remap="1 1;2 1;3 1;4 2;5 8;6 10;7 10;8 10;9 6;10 2;11 10;12 1", missing_values="DATA")
Reclass_Land1.save(Reclassify_2_)
# Process: Rescale by Function (Rescale by Function) (sa)
Rescale_Dist1 = "C:\\Users\\akunna1\\Desktop\\GEOG 592\\Lab_5\\Lab_5_Akunna\\Default.gdb\\Rescale_Dist1"
Rescale_by_Function = Rescale_Dist1
with arcpy.EnvManager(compression="NONE", pyramid="NONE"):
Rescale_Dist1 = arcpy.sa.RescaleByFunction(in_raster=Distanc_Stre1, transformation_function=[["MSSMALL", "", "", "", "", 1, 1, ""]], from_scale=1, to_scale=10)
Rescale_Dist1.save(Rescale_by_Function)
# Process: Raster Calculator (Raster Calculator) (sa)
reclas_raste = "C:\\Users\\akunna1\\Desktop\\GEOG 592\\Lab_5\\Lab_5_Akunna\\default.gdb\\reclas_raste"
Raster_Calculator = reclas_raste
reclas_raste = (Reclass_Slop1 * 0.3) + (Reclass_Land1 * 0.3) + ( Rescale_Dist1 *0.4)
reclas_raste.save(Raster_Calculator)
if __name__ == '__main__':
# Global Environment settings
with arcpy.EnvManager(scratchWorkspace=r"C:\Users\akunna1\Desktop\GEOG 592\Lab_5\Lab_5_Akunna\Default.gdb", workspace=r"C:\Users\akunna1\Desktop\GEOG 592\Lab_5\Lab_5_Akunna\Default.gdb"):
Model()