-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathChapter3-3_Class_Creation.py
190 lines (145 loc) · 14.5 KB
/
Chapter3-3_Class_Creation.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
# -*- coding: utf-8 -*-
# ---------------------------------------------------------------------------
# Classes_AllOthers.py
# Created on: 2019-01-15 09:52:25.00000
# (generated by ArcGIS/ModelBuilder)
# Usage: Classes_AllOthers <Output_Folder> <Output_Feature_Class__12_> <Output_Feature_Class__11_> <Output_Feature_Class__10_> <Output_Feature_Class__9_> <Output_Feature_Class__8_> <Output_Feature_Class__7_> <Output_Feature_Class__6_> <Output_Feature_Class__5_> <Output_Feature_Class__4_> <Output_Feature_Class__3_> <Output_Feature_Class__2_> <Output_Feature_Class> <Input_RTP>
# Description:
# ---------------------------------------------------------------------------
# Import arcpy module
import arcpy
# Script arguments
Output_Folder = arcpy.GetParameterAsText(0)
if Output_Folder == '#' or not Output_Folder:
Output_Folder = "C:\\Kelsey\\Fall_Sem\\WCW_3m\\elev_k" # provide a default value if unspecified
Output_Feature_Class__12_ = arcpy.GetParameterAsText(1)
if Output_Feature_Class__12_ == '#' or not Output_Feature_Class__12_:
Output_Feature_Class__12_ = "wcw_s14x_12b.shp" # provide a default value if unspecified
Output_Feature_Class__11_ = arcpy.GetParameterAsText(2)
if Output_Feature_Class__11_ == '#' or not Output_Feature_Class__11_:
Output_Feature_Class__11_ = "wcw_s14x_11b.shp" # provide a default value if unspecified
Output_Feature_Class__10_ = arcpy.GetParameterAsText(3)
if Output_Feature_Class__10_ == '#' or not Output_Feature_Class__10_:
Output_Feature_Class__10_ = "wcw_s14x_10bshp.shp" # provide a default value if unspecified
Output_Feature_Class__9_ = arcpy.GetParameterAsText(4)
if Output_Feature_Class__9_ == '#' or not Output_Feature_Class__9_:
Output_Feature_Class__9_ = "wcw_s14x_9b.shp" # provide a default value if unspecified
Output_Feature_Class__8_ = arcpy.GetParameterAsText(5)
if Output_Feature_Class__8_ == '#' or not Output_Feature_Class__8_:
Output_Feature_Class__8_ = "wcw_s14x_8b.shp" # provide a default value if unspecified
Output_Feature_Class__7_ = arcpy.GetParameterAsText(6)
if Output_Feature_Class__7_ == '#' or not Output_Feature_Class__7_:
Output_Feature_Class__7_ = "wcw_s14x_7b.shp" # provide a default value if unspecified
Output_Feature_Class__6_ = arcpy.GetParameterAsText(7)
if Output_Feature_Class__6_ == '#' or not Output_Feature_Class__6_:
Output_Feature_Class__6_ = "wcw_s14x_6bshp.shp" # provide a default value if unspecified
Output_Feature_Class__5_ = arcpy.GetParameterAsText(8)
if Output_Feature_Class__5_ == '#' or not Output_Feature_Class__5_:
Output_Feature_Class__5_ = "wcw_s14x_5b.shp" # provide a default value if unspecified
Output_Feature_Class__4_ = arcpy.GetParameterAsText(9)
if Output_Feature_Class__4_ == '#' or not Output_Feature_Class__4_:
Output_Feature_Class__4_ = "wcw_s14x_4bshp.shp" # provide a default value if unspecified
Output_Feature_Class__3_ = arcpy.GetParameterAsText(10)
if Output_Feature_Class__3_ == '#' or not Output_Feature_Class__3_:
Output_Feature_Class__3_ = "wcw_s14x_3b.shp" # provide a default value if unspecified
Output_Feature_Class__2_ = arcpy.GetParameterAsText(11)
if Output_Feature_Class__2_ == '#' or not Output_Feature_Class__2_:
Output_Feature_Class__2_ = "wcw_s14x_2b.shp" # provide a default value if unspecified
Output_Feature_Class = arcpy.GetParameterAsText(12)
if Output_Feature_Class == '#' or not Output_Feature_Class:
Output_Feature_Class = "wcw_s14_1b.shp" # provide a default value if unspecified
Input_RTP = arcpy.GetParameterAsText(13)
if Input_RTP == '#' or not Input_RTP:
Input_RTP = "C:\\Kelsey\\Fall_2016\\WC_1m\\Sept_2014\\elev_b\\wc_s14_b_rtp.shp" # provide a default value if unspecified
# Local variables:
v1 = Input_RTP
v2 = Input_RTP
v3 = Input_RTP
v4 = Input_RTP
v5 = Input_RTP
v6 = Input_RTP
v7 = Input_RTP
v8 = Input_RTP
v9 = Input_RTP
v10 = Input_RTP
v11 = Input_RTP
v12 = Input_RTP
# Process: Feature Class to Feature Class
arcpy.FeatureClassToFeatureClass_conversion(Input_RTP, Output_Folder, Output_Feature_Class, "\"GRIDCODE\" = 1", "ID \"ID\" true true false 10 Long 0 10 ,First,#,C:\\Kelsey\\Fall_2016\\WC_1m\\Sept_2014\\elev_b\\wc_s14_b_rtp.shp,ID,-1,-1;GRIDCODE \"GRIDCODE\" true true false 10 Long 0 10 ,First,#,C:\\Kelsey\\Fall_2016\\WC_1m\\Sept_2014\\elev_b\\wc_s14_b_rtp.shp,GRIDCODE,-1,-1", "")
# Process: Feature Class to Feature Class (2)
arcpy.FeatureClassToFeatureClass_conversion(Input_RTP, Output_Folder, Output_Feature_Class__2_, "\"GRIDCODE\" = 2", "ID \"ID\" true true false 10 Long 0 10 ,First,#,C:\\Kelsey\\Fall_2016\\WC_1m\\Sept_2014\\elev_b\\wc_s14_b_rtp.shp,ID,-1,-1;GRIDCODE \"GRIDCODE\" true true false 10 Long 0 10 ,First,#,C:\\Kelsey\\Fall_2016\\WC_1m\\Sept_2014\\elev_b\\wc_s14_b_rtp.shp,GRIDCODE,-1,-1", "")
# Process: Feature Class to Feature Class (3)
arcpy.FeatureClassToFeatureClass_conversion(Input_RTP, Output_Folder, Output_Feature_Class__3_, "\"GRIDCODE\" = 3", "ID \"ID\" true true false 10 Long 0 10 ,First,#,C:\\Kelsey\\Fall_2016\\WC_1m\\Sept_2014\\elev_b\\wc_s14_b_rtp.shp,ID,-1,-1;GRIDCODE \"GRIDCODE\" true true false 10 Long 0 10 ,First,#,C:\\Kelsey\\Fall_2016\\WC_1m\\Sept_2014\\elev_b\\wc_s14_b_rtp.shp,GRIDCODE,-1,-1", "")
# Process: Feature Class to Feature Class (4)
arcpy.FeatureClassToFeatureClass_conversion(Input_RTP, Output_Folder, Output_Feature_Class__4_, "\"GRIDCODE\" = 4", "ID \"ID\" true true false 10 Long 0 10 ,First,#,C:\\Kelsey\\Fall_2016\\WC_1m\\Sept_2014\\elev_b\\wc_s14_b_rtp.shp,ID,-1,-1;GRIDCODE \"GRIDCODE\" true true false 10 Long 0 10 ,First,#,C:\\Kelsey\\Fall_2016\\WC_1m\\Sept_2014\\elev_b\\wc_s14_b_rtp.shp,GRIDCODE,-1,-1", "")
# Process: Feature Class to Feature Class (5)
arcpy.FeatureClassToFeatureClass_conversion(Input_RTP, Output_Folder, Output_Feature_Class__5_, "\"GRIDCODE\" = 5", "ID \"ID\" true true false 10 Long 0 10 ,First,#,C:\\Kelsey\\Fall_2016\\WC_1m\\Sept_2014\\elev_b\\wc_s14_b_rtp.shp,ID,-1,-1;GRIDCODE \"GRIDCODE\" true true false 10 Long 0 10 ,First,#,C:\\Kelsey\\Fall_2016\\WC_1m\\Sept_2014\\elev_b\\wc_s14_b_rtp.shp,GRIDCODE,-1,-1", "")
# Process: Feature Class to Feature Class (6)
arcpy.FeatureClassToFeatureClass_conversion(Input_RTP, Output_Folder, Output_Feature_Class__6_, "\"GRIDCODE\" = 6", "ID \"ID\" true true false 10 Long 0 10 ,First,#,C:\\Kelsey\\Fall_2016\\WC_1m\\Sept_2014\\elev_b\\wc_s14_b_rtp.shp,ID,-1,-1;GRIDCODE \"GRIDCODE\" true true false 10 Long 0 10 ,First,#,C:\\Kelsey\\Fall_2016\\WC_1m\\Sept_2014\\elev_b\\wc_s14_b_rtp.shp,GRIDCODE,-1,-1", "")
# Process: Feature Class to Feature Class (7)
arcpy.FeatureClassToFeatureClass_conversion(Input_RTP, Output_Folder, Output_Feature_Class__7_, "\"GRIDCODE\" = 7", "ID \"ID\" true true false 10 Long 0 10 ,First,#,C:\\Kelsey\\Fall_2016\\WC_1m\\Sept_2014\\elev_b\\wc_s14_b_rtp.shp,ID,-1,-1;GRIDCODE \"GRIDCODE\" true true false 10 Long 0 10 ,First,#,C:\\Kelsey\\Fall_2016\\WC_1m\\Sept_2014\\elev_b\\wc_s14_b_rtp.shp,GRIDCODE,-1,-1", "")
# Process: Feature Class to Feature Class (8)
arcpy.FeatureClassToFeatureClass_conversion(Input_RTP, Output_Folder, Output_Feature_Class__8_, "\"GRIDCODE\" = 8", "ID \"ID\" true true false 10 Long 0 10 ,First,#,C:\\Kelsey\\Fall_2016\\WC_1m\\Sept_2014\\elev_b\\wc_s14_b_rtp.shp,ID,-1,-1;GRIDCODE \"GRIDCODE\" true true false 10 Long 0 10 ,First,#,C:\\Kelsey\\Fall_2016\\WC_1m\\Sept_2014\\elev_b\\wc_s14_b_rtp.shp,GRIDCODE,-1,-1", "")
# Process: Feature Class to Feature Class (9)
arcpy.FeatureClassToFeatureClass_conversion(Input_RTP, Output_Folder, Output_Feature_Class__9_, "\"GRIDCODE\" = 9", "ID \"ID\" true true false 10 Long 0 10 ,First,#,C:\\Kelsey\\Fall_2016\\WC_1m\\Sept_2014\\elev_b\\wc_s14_b_rtp.shp,ID,-1,-1;GRIDCODE \"GRIDCODE\" true true false 10 Long 0 10 ,First,#,C:\\Kelsey\\Fall_2016\\WC_1m\\Sept_2014\\elev_b\\wc_s14_b_rtp.shp,GRIDCODE,-1,-1", "")
# Process: Feature Class to Feature Class (10)
arcpy.FeatureClassToFeatureClass_conversion(Input_RTP, Output_Folder, Output_Feature_Class__10_, "\"GRIDCODE\" = 10", "ID \"ID\" true true false 10 Long 0 10 ,First,#,C:\\Kelsey\\Fall_2016\\WC_1m\\Sept_2014\\elev_b\\wc_s14_b_rtp.shp,ID,-1,-1;GRIDCODE \"GRIDCODE\" true true false 10 Long 0 10 ,First,#,C:\\Kelsey\\Fall_2016\\WC_1m\\Sept_2014\\elev_b\\wc_s14_b_rtp.shp,GRIDCODE,-1,-1", "")
# Process: Feature Class to Feature Class (11)
arcpy.FeatureClassToFeatureClass_conversion(Input_RTP, Output_Folder, Output_Feature_Class__11_, "\"GRIDCODE\" = 11", "ID \"ID\" true true false 10 Long 0 10 ,First,#,C:\\Kelsey\\Fall_2016\\WC_1m\\Sept_2014\\elev_b\\wc_s14_b_rtp.shp,ID,-1,-1;GRIDCODE \"GRIDCODE\" true true false 10 Long 0 10 ,First,#,C:\\Kelsey\\Fall_2016\\WC_1m\\Sept_2014\\elev_b\\wc_s14_b_rtp.shp,GRIDCODE,-1,-1", "")
# Process: Feature Class to Feature Class (12)
arcpy.FeatureClassToFeatureClass_conversion(Input_RTP, Output_Folder, Output_Feature_Class__12_, "\"GRIDCODE\" = 12", "ID \"ID\" true true false 10 Long 0 10 ,First,#,C:\\Kelsey\\Fall_2016\\WC_1m\\Sept_2014\\elev_b\\wc_s14_b_rtp.shp,ID,-1,-1;GRIDCODE \"GRIDCODE\" true true false 10 Long 0 10 ,First,#,C:\\Kelsey\\Fall_2016\\WC_1m\\Sept_2014\\elev_b\\wc_s14_b_rtp.shp,GRIDCODE,-1,-1", "")
# Script arguments
Output_Folder = arcpy.GetParameterAsText(0)
if Output_Folder == '#' or not Output_Folder:
Output_Folder = "C:\\Kelsey\\Fall_Sem\\WCW_3m\\aspect_f" # provide a default value if unspecified
Input_raster = arcpy.GetParameterAsText(1)
RTP_DEM = arcpy.GetParameterAsText(2)
if RTP_DEM == '#' or not RTP_DEM:
RTP_DEM = "C:\\Kelsey\\Fall_Sem\\WCW_3m\\aspect_f\\wcw_s14x_f_rtp.shp" # provide a default value if unspecified
# Local variables:
Simplify_polygons = "false"
v1f = RTP_DEM
v2f_premerge = RTP_DEM
v3f = RTP_DEM
v4f = RTP_DEM
v5f = RTP_DEM
v6f = RTP_DEM
v7f = RTP_DEM
v8f = RTP_DEM
v9f = RTP_DEM
v10f_premerge = RTP_DEM
v1f_poly = "wcw_s14x_1f.shp"
v3f_poly = "wcw_s14x_3k.shp"
v4f_poly = "wcw_s14x_4k.shp"
v5f_poly = "wcw_s14x_5k.shp"
v6f_poly = "wcw_s14x_6k.shp"
v7f_poly = "wcw_s14x_7k.shp"
v8f_poly = "wcw_s14x_8k.shp"
v9f_poly = "wcw_s14x_9k.shp"
v2f_poly = "wcw_s14x_2f_premerge.shp"
v10f_poly = "wcw_s14x_10k.shp"
merged_2f = "C:\\Users\\kelsey.cartwright\\Documents\\ArcGIS\\Default.gdb\\wcw_s14x_2f_Merge"
# Process: Raster to Polygon
arcpy.RasterToPolygon_conversion(Input_raster, RTP_DEM, Simplify_polygons, "")
# Process: 1f_unclipped
arcpy.FeatureClassToFeatureClass_conversion(RTP_DEM, Output_Folder, v1f_poly, "\"GRIDCODE\" = 1", "ID \"ID\" true true false 0 Long 0 0 ,First,#,C:\\Kelsey\\Fall_Sem\\WCW_3m\\aspect_f\\wcw_s14x_f_rtp.shp,ID,-1,-1;GRIDCODE \"GRIDCODE\" true true false 0 Long 0 0 ,First,#,C:\\Kelsey\\Fall_Sem\\WCW_3m\\aspect_f\\wcw_s14x_f_rtp.shp,GRIDCODE,-1,-1", "")
# Process: 3f_unclipped
arcpy.FeatureClassToFeatureClass_conversion(RTP_DEM, Output_Folder, v3f_poly, "\"GRIDCODE\" = 3", "ID \"ID\" true true false 0 Long 0 0 ,First,#,C:\\Kelsey\\Fall_Sem\\WCW_3m\\aspect_f\\wcw_s14x_f_rtp.shp,ID,-1,-1;GRIDCODE \"GRIDCODE\" true true false 0 Long 0 0 ,First,#,C:\\Kelsey\\Fall_Sem\\WCW_3m\\aspect_f\\wcw_s14x_f_rtp.shp,GRIDCODE,-1,-1", "")
# Process: 4f_unclipped
arcpy.FeatureClassToFeatureClass_conversion(RTP_DEM, Output_Folder, v4f_poly, "\"GRIDCODE\" = 4", "ID \"ID\" true true false 0 Long 0 0 ,First,#,C:\\Kelsey\\Fall_Sem\\WCW_3m\\aspect_f\\wcw_s14x_f_rtp.shp,ID,-1,-1;GRIDCODE \"GRIDCODE\" true true false 0 Long 0 0 ,First,#,C:\\Kelsey\\Fall_Sem\\WCW_3m\\aspect_f\\wcw_s14x_f_rtp.shp,GRIDCODE,-1,-1", "")
# Process: 5f_unclipped
arcpy.FeatureClassToFeatureClass_conversion(RTP_DEM, Output_Folder, v5f_poly, "\"GRIDCODE\" = 5", "ID \"ID\" true true false 0 Long 0 0 ,First,#,C:\\Kelsey\\Fall_Sem\\WCW_3m\\aspect_f\\wcw_s14x_f_rtp.shp,ID,-1,-1;GRIDCODE \"GRIDCODE\" true true false 0 Long 0 0 ,First,#,C:\\Kelsey\\Fall_Sem\\WCW_3m\\aspect_f\\wcw_s14x_f_rtp.shp,GRIDCODE,-1,-1", "")
# Process: 6f_unclipped
arcpy.FeatureClassToFeatureClass_conversion(RTP_DEM, Output_Folder, v6f_poly, "\"GRIDCODE\" = 6", "ID \"ID\" true true false 0 Long 0 0 ,First,#,C:\\Kelsey\\Fall_Sem\\WCW_3m\\aspect_f\\wcw_s14x_f_rtp.shp,ID,-1,-1;GRIDCODE \"GRIDCODE\" true true false 0 Long 0 0 ,First,#,C:\\Kelsey\\Fall_Sem\\WCW_3m\\aspect_f\\wcw_s14x_f_rtp.shp,GRIDCODE,-1,-1", "")
# Process: 7f_unclipped
arcpy.FeatureClassToFeatureClass_conversion(RTP_DEM, Output_Folder, v7f_poly, "\"GRIDCODE\" = 7", "ID \"ID\" true true false 0 Long 0 0 ,First,#,C:\\Kelsey\\Fall_Sem\\WCW_3m\\aspect_f\\wcw_s14x_f_rtp.shp,ID,-1,-1;GRIDCODE \"GRIDCODE\" true true false 0 Long 0 0 ,First,#,C:\\Kelsey\\Fall_Sem\\WCW_3m\\aspect_f\\wcw_s14x_f_rtp.shp,GRIDCODE,-1,-1", "")
# Process: 8f_unclipped
arcpy.FeatureClassToFeatureClass_conversion(RTP_DEM, Output_Folder, v8f_poly, "\"GRIDCODE\" = 8", "ID \"ID\" true true false 0 Long 0 0 ,First,#,C:\\Kelsey\\Fall_Sem\\WCW_3m\\aspect_f\\wcw_s14x_f_rtp.shp,ID,-1,-1;GRIDCODE \"GRIDCODE\" true true false 0 Long 0 0 ,First,#,C:\\Kelsey\\Fall_Sem\\WCW_3m\\aspect_f\\wcw_s14x_f_rtp.shp,GRIDCODE,-1,-1", "")
# Process: 9f_unclipped
arcpy.FeatureClassToFeatureClass_conversion(RTP_DEM, Output_Folder, v9f_poly, "\"GRIDCODE\" = 9", "ID \"ID\" true true false 0 Long 0 0 ,First,#,C:\\Kelsey\\Fall_Sem\\WCW_3m\\aspect_f\\wcw_s14x_f_rtp.shp,ID,-1,-1;GRIDCODE \"GRIDCODE\" true true false 0 Long 0 0 ,First,#,C:\\Kelsey\\Fall_Sem\\WCW_3m\\aspect_f\\wcw_s14x_f_rtp.shp,GRIDCODE,-1,-1", "")
# Process: 2f_unclipped
arcpy.FeatureClassToFeatureClass_conversion(RTP_DEM, Output_Folder, v2f_poly, "\"GRIDCODE\" = 2", "ID \"ID\" true true false 0 Long 0 0 ,First,#,C:\\Kelsey\\Fall_Sem\\WCW_3m\\aspect_f\\wcw_s14x_f_rtp.shp,ID,-1,-1;GRIDCODE \"GRIDCODE\" true true false 0 Long 0 0 ,First,#,C:\\Kelsey\\Fall_Sem\\WCW_3m\\aspect_f\\wcw_s14x_f_rtp.shp,GRIDCODE,-1,-1", "")
# Process: 10f_unclipped
arcpy.FeatureClassToFeatureClass_conversion(RTP_DEM, Output_Folder, v10f_poly, "\"GRIDCODE\" = 10", "ID \"ID\" true true false 0 Long 0 0 ,First,#,C:\\Kelsey\\Fall_Sem\\WCW_3m\\aspect_f\\wcw_s14x_f_rtp.shp,ID,-1,-1;GRIDCODE \"GRIDCODE\" true true false 0 Long 0 0 ,First,#,C:\\Kelsey\\Fall_Sem\\WCW_3m\\aspect_f\\wcw_s14x_f_rtp.shp,GRIDCODE,-1,-1", "")
# Process: 2&10 merge
arcpy.Merge_management("C:\\Kelsey\\Fall_Sem\\WCW_3m\\aspect_f\\wcw_s14x_2f_premerge.shp;C:\\Kelsey\\Fall_Sem\\WCW_3m\\aspect_f\\wcw_s14x_10k.shp", merged_2f, "ID \"ID\" true true false 0 Long 0 0 ,First,#,C:\\Kelsey\\Fall_Sem\\WCW_3m\\aspect_f\\wcw_s14x_10k.shp,ID,-1,-1,C:\\Kelsey\\Fall_Sem\\WCW_3m\\aspect_f\\wcw_s14x_2f_premerge.shp,ID,-1,-1;GRIDCODE \"GRIDCODE\" true true false 0 Long 0 0 ,First,#,C:\\Kelsey\\Fall_Sem\\WCW_3m\\aspect_f\\wcw_s14x_10k.shp,GRIDCODE,-1,-1,C:\\Kelsey\\Fall_Sem\\WCW_3m\\aspect_f\\wcw_s14x_2f_premerge.shp,GRIDCODE,-1,-1")