1 | # --------------------------------------------------------------------------- |
---|
2 | # Carnarvon4distribution.py |
---|
3 | # Created on: Thu Apr 30 2009 03:51:03 PM |
---|
4 | # (generated by ArcGIS/ModelBuilder) |
---|
5 | # --------------------------------------------------------------------------- |
---|
6 | |
---|
7 | # Import system modules |
---|
8 | import sys, string, os, arcgisscripting |
---|
9 | |
---|
10 | # Create the Geoprocessor object |
---|
11 | gp = arcgisscripting.create() |
---|
12 | |
---|
13 | # Check out any necessary licenses |
---|
14 | gp.CheckOutExtension("spatial") |
---|
15 | |
---|
16 | # Load required toolboxes... |
---|
17 | gp.AddToolbox("C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Spatial Analyst Tools.tbx") |
---|
18 | gp.AddToolbox("C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Data Management Tools.tbx") |
---|
19 | gp.overwriteoutput = 1 |
---|
20 | |
---|
21 | community = 'Busselton' |
---|
22 | output_loc = "\\\\nas2\\gemd\\georisk_models\\inundation\\data\\western_australia\\FESA_outputs_Dec_08\\ARCgrids\\April_2009\\" |
---|
23 | input_scenario = "\\\\nas2\\gemd\\georisk_models\\inundation\\data\\western_australia\\busselton_tsunami_scenario\\" |
---|
24 | input_output = input_scenario + "\\anuga\\outputs\\" |
---|
25 | |
---|
26 | locations = ['Bunbury', 'Busselton'] |
---|
27 | |
---|
28 | in_Tsunami_1_HAT = input_output + "20090327_152717_run_final_0.6_27283_Bt_kvanputt\\raster.gdb\\" |
---|
29 | in_Tsunami_1_MSL = input_output + "20090330_120458_run_final_0_27283_Bt_kvanputt\\raster.gdb\\" |
---|
30 | in_Tsunami_2_HAT = input_output + "20090324_134328_run_final_0.6_27255_Bt_kvanputt\\raster.gdb\\" |
---|
31 | in_Tsunami_2_MSL = input_output + "20090327_160646_run_final_0_27255_Bt_kvanputt\\raster.gdb\\" |
---|
32 | in_Tsunami_3_HAT = input_output + "20090324_140747_run_final_0.6_68693_Bt_kvanputt\\raster.gdb\\" |
---|
33 | in_Tsunami_3_MSL = input_output + "20090327_161520_run_final_0_68693_Bt_kvanputt\\raster.gdb\\" |
---|
34 | |
---|
35 | Tsunami_1_HAT = output_loc + "Tsunami1-Exmouth\\" + community + "_HAT.gdb\\" |
---|
36 | Tsunami_1_MSL = output_loc + "Tsunami1-Exmouth\\" + community + "_MSL.gdb\\" |
---|
37 | Tsunami_2_HAT = output_loc + "Tsunami2-Perth\\" + community + "_HAT.gdb\\" |
---|
38 | Tsunami_2_MSL = output_loc + "Tsunami2-Perth\\" + community + "_MSL.gdb\\" |
---|
39 | Tsunami_3_HAT = output_loc + "Tsunami3-1833\\" + community + "_HAT.gdb\\" |
---|
40 | Tsunami_3_MSL = output_loc + "Tsunami3-1833\\" + community + "_MSL.gdb\\" |
---|
41 | |
---|
42 | hr = community + '_runup' |
---|
43 | |
---|
44 | for location in locations: |
---|
45 | |
---|
46 | # Local variables... |
---|
47 | if location == 'Bunbury': |
---|
48 | # polygon clip |
---|
49 | extent = input_scenario + "map_work\\Busselton.gdb\\internal_polygons\\bunbury_1km" |
---|
50 | # name of rasters |
---|
51 | depth = 'Bun_depth_M_E' |
---|
52 | speed = 'Bun_speed_M' |
---|
53 | elif location == 'Busselton': |
---|
54 | # polygon clip |
---|
55 | extent = input_scenario + "map_work\\Busselton.gdb\\Internal_polygons\\busselton_1km" |
---|
56 | # name of rasters |
---|
57 | depth = 'Bus_depth_M_E' |
---|
58 | speed = 'Bus_speed_M' |
---|
59 | else: |
---|
60 | print 'No recognisable location entered' |
---|
61 | |
---|
62 | print 'location', location |
---|
63 | print 'extent', extent |
---|
64 | |
---|
65 | # Output locations |
---|
66 | |
---|
67 | hr_1_HAT = Tsunami_1_HAT +"highest_runup" |
---|
68 | hr_1_MSL = Tsunami_1_MSL +"highest_runup" |
---|
69 | hr_2_HAT = Tsunami_2_HAT +"highest_runup" |
---|
70 | hr_2_MSL = Tsunami_2_MSL +"highest_runup" |
---|
71 | hr_3_HAT = Tsunami_3_HAT +"highest_runup" |
---|
72 | hr_3_MSL = Tsunami_3_MSL +"highest_runup" |
---|
73 | |
---|
74 | depth_1_HAT = Tsunami_1_HAT + location + "_depth" |
---|
75 | depth_1_MSL = Tsunami_1_MSL + location + "_depth" |
---|
76 | depth_2_HAT = Tsunami_2_HAT + location + "_depth" |
---|
77 | depth_2_MSL = Tsunami_2_MSL + location + "_depth" |
---|
78 | depth_3_HAT = Tsunami_3_HAT + location + "_depth" |
---|
79 | depth_3_MSL = Tsunami_3_MSL + location + "_depth" |
---|
80 | |
---|
81 | speed_1_HAT = Tsunami_1_HAT + location + "_speed" |
---|
82 | speed_1_MSL = Tsunami_1_MSL + location + "_speed" |
---|
83 | speed_2_HAT = Tsunami_2_HAT + location + "_speed" |
---|
84 | speed_2_MSL = Tsunami_2_MSL + location + "_speed" |
---|
85 | speed_3_HAT = Tsunami_3_HAT + location + "_speed" |
---|
86 | speed_3_MSL = Tsunami_3_MSL + location + "_speed" |
---|
87 | |
---|
88 | |
---|
89 | # Input locations |
---|
90 | |
---|
91 | in_depth_1_HAT = in_Tsunami_1_HAT + depth |
---|
92 | in_depth_1_MSL = in_Tsunami_1_MSL + depth |
---|
93 | in_depth_2_HAT = in_Tsunami_2_HAT + depth |
---|
94 | in_depth_2_MSL = in_Tsunami_2_MSL + depth |
---|
95 | in_depth_3_HAT = in_Tsunami_3_HAT + depth |
---|
96 | in_depth_3_MSL = in_Tsunami_3_MSL + depth |
---|
97 | |
---|
98 | in_speed_1_HAT = in_Tsunami_1_HAT + speed |
---|
99 | in_speed_1_MSL = in_Tsunami_1_MSL + speed |
---|
100 | in_speed_2_HAT = in_Tsunami_2_HAT + speed |
---|
101 | in_speed_2_MSL = in_Tsunami_2_MSL + speed |
---|
102 | in_speed_3_HAT = in_Tsunami_3_HAT + speed |
---|
103 | in_speed_3_MSL = in_Tsunami_3_MSL + speed |
---|
104 | |
---|
105 | in_hr_1_HAT = in_Tsunami_1_HAT + hr |
---|
106 | in_hr_1_MSL = in_Tsunami_1_MSL + hr |
---|
107 | in_hr_2_HAT = in_Tsunami_2_HAT + hr |
---|
108 | in_hr_2_MSL = in_Tsunami_2_MSL + hr |
---|
109 | in_hr_3_HAT = in_Tsunami_3_HAT + hr |
---|
110 | in_hr_3_MSL = in_Tsunami_3_MSL + hr |
---|
111 | |
---|
112 | |
---|
113 | # Process: Extract by Mask |
---|
114 | print 'Extract by mask for depth' |
---|
115 | gp.ExtractByMask_sa(in_depth_1_HAT, extent, depth_1_HAT) |
---|
116 | gp.ExtractByMask_sa(in_depth_1_MSL, extent, depth_1_MSL) |
---|
117 | gp.ExtractByMask_sa(in_depth_2_HAT, extent, depth_2_HAT) |
---|
118 | gp.ExtractByMask_sa(in_depth_2_MSL, extent, depth_2_MSL) |
---|
119 | gp.ExtractByMask_sa(in_depth_3_HAT, extent, depth_3_HAT) |
---|
120 | gp.ExtractByMask_sa(in_depth_3_MSL, extent, depth_3_MSL) |
---|
121 | |
---|
122 | print 'Extract by mask for speed' |
---|
123 | gp.ExtractByMask_sa(in_speed_1_HAT, extent, speed_1_HAT) |
---|
124 | gp.ExtractByMask_sa(in_speed_1_MSL, extent, speed_1_MSL) |
---|
125 | gp.ExtractByMask_sa(in_speed_2_HAT, extent, speed_2_HAT) |
---|
126 | gp.ExtractByMask_sa(in_speed_2_MSL, extent, speed_2_MSL) |
---|
127 | gp.ExtractByMask_sa(in_speed_3_HAT, extent, speed_3_HAT) |
---|
128 | gp.ExtractByMask_sa(in_speed_3_MSL, extent, speed_3_MSL) |
---|
129 | |
---|
130 | |
---|
131 | # Process: Copy Features... |
---|
132 | |
---|
133 | print 'Copy Highest Runup' |
---|
134 | gp.CopyFeatures_management(in_hr_1_HAT, hr_1_HAT, "", "0", "0", "0") |
---|
135 | gp.CopyFeatures_management(in_hr_1_MSL, hr_1_MSL, "", "0", "0", "0") |
---|
136 | gp.CopyFeatures_management(in_hr_2_HAT, hr_2_HAT, "", "0", "0", "0") |
---|
137 | gp.CopyFeatures_management(in_hr_2_MSL, hr_2_MSL, "", "0", "0", "0") |
---|
138 | gp.CopyFeatures_management(in_hr_3_HAT, hr_3_HAT, "", "0", "0", "0") |
---|
139 | gp.CopyFeatures_management(in_hr_3_MSL, hr_3_MSL, "", "0", "0", "0") |
---|
140 | |
---|