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 = 'Perth' |
---|
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\\perth_tsunami_scenario\\" |
---|
24 | input_output = input_scenario + "\\anuga\\outputs\\" |
---|
25 | |
---|
26 | locations = ['Fremantle', 'Rockingham', 'Geordie', 'Sorrento'] |
---|
27 | |
---|
28 | in_Tsunami_1_HAT = input_output + "20090324_155028_run_final_0.6_27283_Bt_kvanputt\\raster.gdb\\" |
---|
29 | in_Tsunami_1_MSL = input_output + "20090327_155353_run_final_0_27283_Bt_kvanputt\\raster.gdb\\" |
---|
30 | in_Tsunami_2_HAT = input_output + "20090324_135427_run_final_0.6_27255_Bt_kvanputt\\raster.gdb\\" |
---|
31 | in_Tsunami_2_MSL = input_output + "20090327_155659_run_final_0_27255_Bt_kvanputt\\raster.gdb\\" |
---|
32 | in_Tsunami_3_HAT = input_output + "20090324_154957_run_final_0.6_68693_Bt_kvanputt\\raster.gdb\\" |
---|
33 | in_Tsunami_3_MSL = input_output + "20090327_155803_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 == 'Fremantle': |
---|
48 | # polygon clip |
---|
49 | extent = input_scenario + "map_work\\Perth.gdb\\Internal_Polygons\\CBD_coastal" |
---|
50 | # name of rasters |
---|
51 | depth = 'Fre_dep_M_E' |
---|
52 | speed = 'Fre_spe_M_' |
---|
53 | elif location == 'Rockingham': |
---|
54 | # polygon clip |
---|
55 | extent = input_scenario + "map_work\\Perth.gdb\\Internal_Polygons\\rockingham_penguin" |
---|
56 | # name of rasters |
---|
57 | depth = 'Roc_dep_M_E' |
---|
58 | speed = 'Roc_spe_M_' |
---|
59 | elif location == 'Geordie': |
---|
60 | # polygon clip |
---|
61 | extent = input_scenario + "map_work\\Perth.gdb\\Internal_Polygons\\Geordie_Bay" |
---|
62 | # name of rasters |
---|
63 | depth = 'Geo_dep_M_E' |
---|
64 | speed = 'Geo_spe_M_' |
---|
65 | elif location == 'Sorrento': |
---|
66 | # polygon clip |
---|
67 | extent = input_scenario + "map_work\\Perth.gdb\\Internal_Polygons\\Sorrento_gauge" |
---|
68 | # name of rasters |
---|
69 | depth = 'Sor_dep_M_E' |
---|
70 | speed = 'Sor_spe_M_' |
---|
71 | else: |
---|
72 | print 'No recognisable location entered' |
---|
73 | |
---|
74 | print 'location', location |
---|
75 | print 'extent', extent |
---|
76 | |
---|
77 | # Output locations |
---|
78 | |
---|
79 | hr_1_HAT = Tsunami_1_HAT +"highest_runup" |
---|
80 | hr_1_MSL = Tsunami_1_MSL +"highest_runup" |
---|
81 | hr_2_HAT = Tsunami_2_HAT +"highest_runup" |
---|
82 | hr_2_MSL = Tsunami_2_MSL +"highest_runup" |
---|
83 | hr_3_HAT = Tsunami_3_HAT +"highest_runup" |
---|
84 | hr_3_MSL = Tsunami_3_MSL +"highest_runup" |
---|
85 | |
---|
86 | depth_1_HAT = Tsunami_1_HAT + location + "_depth" |
---|
87 | depth_1_MSL = Tsunami_1_MSL + location + "_depth" |
---|
88 | depth_2_HAT = Tsunami_2_HAT + location + "_depth" |
---|
89 | depth_2_MSL = Tsunami_2_MSL + location + "_depth" |
---|
90 | depth_3_HAT = Tsunami_3_HAT + location + "_depth" |
---|
91 | depth_3_MSL = Tsunami_3_MSL + location + "_depth" |
---|
92 | |
---|
93 | speed_1_HAT = Tsunami_1_HAT + location + "_speed" |
---|
94 | speed_1_MSL = Tsunami_1_MSL + location + "_speed" |
---|
95 | speed_2_HAT = Tsunami_2_HAT + location + "_speed" |
---|
96 | speed_2_MSL = Tsunami_2_MSL + location + "_speed" |
---|
97 | speed_3_HAT = Tsunami_3_HAT + location + "_speed" |
---|
98 | speed_3_MSL = Tsunami_3_MSL + location + "_speed" |
---|
99 | |
---|
100 | |
---|
101 | # Input locations |
---|
102 | |
---|
103 | in_depth_1_HAT = in_Tsunami_1_HAT + depth |
---|
104 | in_depth_1_MSL = in_Tsunami_1_MSL + depth |
---|
105 | in_depth_2_HAT = in_Tsunami_2_HAT + depth |
---|
106 | in_depth_2_MSL = in_Tsunami_2_MSL + depth |
---|
107 | in_depth_3_HAT = in_Tsunami_3_HAT + depth |
---|
108 | in_depth_3_MSL = in_Tsunami_3_MSL + depth |
---|
109 | |
---|
110 | in_speed_1_HAT = in_Tsunami_1_HAT + speed |
---|
111 | in_speed_1_MSL = in_Tsunami_1_MSL + speed |
---|
112 | in_speed_2_HAT = in_Tsunami_2_HAT + speed |
---|
113 | in_speed_2_MSL = in_Tsunami_2_MSL + speed |
---|
114 | in_speed_3_HAT = in_Tsunami_3_HAT + speed |
---|
115 | in_speed_3_MSL = in_Tsunami_3_MSL + speed |
---|
116 | |
---|
117 | in_hr_1_HAT = in_Tsunami_1_HAT + hr |
---|
118 | in_hr_1_MSL = in_Tsunami_1_MSL + hr |
---|
119 | in_hr_2_HAT = in_Tsunami_2_HAT + hr |
---|
120 | in_hr_2_MSL = in_Tsunami_2_MSL + hr |
---|
121 | in_hr_3_HAT = in_Tsunami_3_HAT + hr |
---|
122 | in_hr_3_MSL = in_Tsunami_3_MSL + hr |
---|
123 | |
---|
124 | |
---|
125 | # Process: Extract by Mask |
---|
126 | print 'Extract by mask for depth' |
---|
127 | gp.ExtractByMask_sa(in_depth_1_HAT, extent, depth_1_HAT) |
---|
128 | gp.ExtractByMask_sa(in_depth_1_MSL, extent, depth_1_MSL) |
---|
129 | gp.ExtractByMask_sa(in_depth_2_HAT, extent, depth_2_HAT) |
---|
130 | gp.ExtractByMask_sa(in_depth_2_MSL, extent, depth_2_MSL) |
---|
131 | gp.ExtractByMask_sa(in_depth_3_HAT, extent, depth_3_HAT) |
---|
132 | gp.ExtractByMask_sa(in_depth_3_MSL, extent, depth_3_MSL) |
---|
133 | |
---|
134 | print 'Extract by mask for speed' |
---|
135 | gp.ExtractByMask_sa(in_speed_1_HAT, extent, speed_1_HAT) |
---|
136 | gp.ExtractByMask_sa(in_speed_1_MSL, extent, speed_1_MSL) |
---|
137 | gp.ExtractByMask_sa(in_speed_2_HAT, extent, speed_2_HAT) |
---|
138 | gp.ExtractByMask_sa(in_speed_2_MSL, extent, speed_2_MSL) |
---|
139 | gp.ExtractByMask_sa(in_speed_3_HAT, extent, speed_3_HAT) |
---|
140 | gp.ExtractByMask_sa(in_speed_3_MSL, extent, speed_3_MSL) |
---|
141 | |
---|
142 | |
---|
143 | # Process: Copy Features... |
---|
144 | |
---|
145 | print 'Copy Highest Runup' |
---|
146 | gp.CopyFeatures_management(in_hr_1_HAT, hr_1_HAT, "", "0", "0", "0") |
---|
147 | gp.CopyFeatures_management(in_hr_1_MSL, hr_1_MSL, "", "0", "0", "0") |
---|
148 | gp.CopyFeatures_management(in_hr_2_HAT, hr_2_HAT, "", "0", "0", "0") |
---|
149 | gp.CopyFeatures_management(in_hr_2_MSL, hr_2_MSL, "", "0", "0", "0") |
---|
150 | gp.CopyFeatures_management(in_hr_3_HAT, hr_3_HAT, "", "0", "0", "0") |
---|
151 | gp.CopyFeatures_management(in_hr_3_MSL, hr_3_MSL, "", "0", "0", "0") |
---|
152 | |
---|