1 | """Common filenames and locations for topographic data, meshes and outputs. |
---|
2 | Also includes origin for slump scenario. |
---|
3 | """ |
---|
4 | |
---|
5 | from os import sep, environ, getenv, getcwd,umask |
---|
6 | from os.path import expanduser, basename |
---|
7 | from anuga.utilities.polygon import read_polygon, plot_polygons, polygon_area, is_inside_polygon, number_mesh_triangles |
---|
8 | import sys |
---|
9 | from anuga.coordinate_transforms.redfearn import degminsec2decimal_degrees |
---|
10 | from time import localtime, strftime, gmtime |
---|
11 | from anuga.utilities.system_tools import get_user_name, get_host_name |
---|
12 | |
---|
13 | #codename = 'project.py' |
---|
14 | |
---|
15 | home = getenv('INUNDATIONHOME') + sep +'data'+sep #Sandpit's parent dir |
---|
16 | user = get_user_name() |
---|
17 | host = get_host_name() |
---|
18 | #needed when running using mpirun, mpirun doesn't inherit umask from .bashrc |
---|
19 | umask(002) |
---|
20 | |
---|
21 | #Making assumptions about the location of scenario data |
---|
22 | state = 'western_australia' |
---|
23 | scenario_name = 'exmouth' |
---|
24 | scenario = 'exmouth_tsunami_scenario' |
---|
25 | |
---|
26 | #time stuff |
---|
27 | time = strftime('%Y%m%d_%H%M%S',gmtime()) #gets time for new dir |
---|
28 | build_time = time+'_build' |
---|
29 | run_time = time+'_run' |
---|
30 | |
---|
31 | #tide = -1.4 |
---|
32 | #tide = 0 |
---|
33 | tide = 1.4 |
---|
34 | |
---|
35 | #Maybe will try to make project a class to allow these parameters to be passed in. |
---|
36 | alpha = 0.1 |
---|
37 | friction=0.01 |
---|
38 | starttime=3600 |
---|
39 | finaltime=25000 |
---|
40 | setup='final' |
---|
41 | #source='onslow' |
---|
42 | #source='dampier' |
---|
43 | source='exmouth' |
---|
44 | |
---|
45 | if setup =='trial': |
---|
46 | print'trial' |
---|
47 | res_factor=10 |
---|
48 | time_thinning=48 |
---|
49 | yieldstep=240 |
---|
50 | if setup =='basic': |
---|
51 | print'basic' |
---|
52 | res_factor=4 |
---|
53 | time_thinning=12 |
---|
54 | yieldstep=120 |
---|
55 | if setup =='final': |
---|
56 | print'final' |
---|
57 | res_factor=1 |
---|
58 | time_thinning=4 |
---|
59 | yieldstep=60 |
---|
60 | if setup =='store': |
---|
61 | print'store' |
---|
62 | res_factor=10 |
---|
63 | time_thinning=48 |
---|
64 | yieldstep=240 |
---|
65 | |
---|
66 | |
---|
67 | dir_comment='_'+setup+'_'+str(tide)+'_'+str(source)+'_'+str(user) |
---|
68 | |
---|
69 | onshore_name = 'DLI' |
---|
70 | onshore_name1 = 'DTED' |
---|
71 | # offshore |
---|
72 | offshore_name = 'Exmouth_bathymetry' |
---|
73 | #offshore_name1 = 'inferred_north' |
---|
74 | #offshore_name2 = 'inferred_south' |
---|
75 | coast_name = 'Exmouth_coastline' |
---|
76 | |
---|
77 | #final topo name |
---|
78 | combined_name ='exmouth_combined_elevation' |
---|
79 | #combined_name1 ='exmouth_combined_elevation1' |
---|
80 | #combined_name_unclipped1 ='exmouth_combined_elevation_unclipped1' |
---|
81 | combined_small_name = 'exmouth_combined_elevation_small' |
---|
82 | |
---|
83 | anuga_dir = home+state+sep+scenario+sep+'anuga'+sep |
---|
84 | |
---|
85 | topographies_in_dir = home+state+sep+scenario+sep+'elevation_final'+sep+'points'+sep |
---|
86 | topographies_dir = anuga_dir+'topographies'+sep |
---|
87 | |
---|
88 | # input topo file location |
---|
89 | onshore_in_dir_name = topographies_in_dir + onshore_name |
---|
90 | onshore1_in_dir_name = topographies_in_dir + onshore_name1 |
---|
91 | coast_in_dir_name = topographies_in_dir + coast_name |
---|
92 | offshore_in_dir_name = topographies_in_dir + offshore_name |
---|
93 | #offshore_in_dir_name1 = topographies_in_dir + offshore_name1 |
---|
94 | #offshore_in_dir_name2 = topographies_in_dir + offshore_name2 |
---|
95 | |
---|
96 | onshore_dir_name = topographies_dir + onshore_name |
---|
97 | onshore1_dir_name = topographies_dir + onshore_name1 |
---|
98 | coast_dir_name = topographies_dir + coast_name |
---|
99 | offshore_dir_name = topographies_dir + offshore_name |
---|
100 | #offshore_dir_name1 = topographies_dir + offshore_name1 |
---|
101 | #offshore_dir_name2 = topographies_dir + offshore_name2 |
---|
102 | |
---|
103 | #final topo files |
---|
104 | combined_dir_name = topographies_dir + combined_name |
---|
105 | #combined_dir_name_unclipped1 = topographies_dir + combined_name_unclipped1 |
---|
106 | #combined_dir_name1 = topographies_dir + combined_name1 |
---|
107 | combined_small_dir_name = topographies_dir + combined_small_name |
---|
108 | |
---|
109 | meshes_dir = anuga_dir+'meshes'+sep |
---|
110 | meshes_dir_name = meshes_dir + scenario_name |
---|
111 | |
---|
112 | polygons_dir = anuga_dir+'polygons'+sep |
---|
113 | tide_dir = anuga_dir+'tide_data'+sep |
---|
114 | |
---|
115 | if source =='dampier': |
---|
116 | boundaries_name = 'exmouth_3854_17042007' #Dampier gun |
---|
117 | boundaries_in_dir = anuga_dir+'boundaries'+sep+'urs'+sep+'dampier'+sep+'1_10000'+sep |
---|
118 | |
---|
119 | if source=='onslow': |
---|
120 | boundaries_name = 'exmouth_3859_16052007' #onslow_hedland_broome gun |
---|
121 | boundaries_in_dir = anuga_dir+'boundaries'+sep+'urs'+sep+'onslow_hedland_broome'+sep+'1_10000'+sep |
---|
122 | |
---|
123 | if source=='exmouth': |
---|
124 | boundaries_name = 'exmouth_3103_18052007' #exmouth gun |
---|
125 | boundaries_in_dir = anuga_dir+'boundaries'+sep+'urs'+sep+'exmouth'+sep+'1_10000'+sep |
---|
126 | |
---|
127 | #boundaries locations |
---|
128 | boundaries_source = '' |
---|
129 | #boundaries_in_dir = anuga_dir+'boundaries'+sep |
---|
130 | boundaries_in_dir_name = boundaries_in_dir + boundaries_name |
---|
131 | |
---|
132 | #output locations |
---|
133 | output_dir = anuga_dir+'outputs'+sep |
---|
134 | output_build_time_dir = output_dir+build_time+sep |
---|
135 | #output_run_time_dir = output_dir +run_time+dir_comment+sep |
---|
136 | output_run_time_dir = output_dir +'20070619_042140_run_final_0_onslow_nbartzis'+sep |
---|
137 | output_run_time_dir_name = output_run_time_dir + scenario_name #Used by post processing |
---|
138 | |
---|
139 | #gauges |
---|
140 | beach_gauges = 'beach_gauges.csv' |
---|
141 | gauge_name = 'exmouth_gauges.csv' |
---|
142 | |
---|
143 | gauges_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'gauges'+sep |
---|
144 | beach_gauges = gauges_dir + 'beach_gauges.csv' |
---|
145 | gauges_dir_name = gauges_dir + gauge_name |
---|
146 | |
---|
147 | community_filename = gauges_dir + 'CHINS_v2.csv' |
---|
148 | community_exmouth = gauges_dir + 'community_exmouth.csv' |
---|
149 | |
---|
150 | buildings_filename = gauges_dir +'Exmouth_res_Project.csv' |
---|
151 | buildings_filename_out = output_run_time_dir +'Exmouth_res_Project_modified.csv' |
---|
152 | |
---|
153 | ############################### |
---|
154 | # Domain definitions |
---|
155 | ############################### |
---|
156 | from anuga.utilities.polygon import read_polygon, plot_polygons, polygon_area, is_inside_polygon |
---|
157 | |
---|
158 | poly_all = read_polygon(polygons_dir+'extent_more_points.csv') |
---|
159 | |
---|
160 | print 'Area of bounding polygon', polygon_area(poly_all)/1000000.0 |
---|
161 | |
---|
162 | res_poly_all = 150000*res_factor |
---|
163 | |
---|
164 | ############################### |
---|
165 | # Interior region definitions |
---|
166 | ############################### |
---|
167 | |
---|
168 | |
---|
169 | poly_coast = read_polygon(polygons_dir+'coast_new_pts.csv') |
---|
170 | #poly_coast = read_polygon(polygons_dir+'pts_coast.csv') |
---|
171 | res_coast = 10000*res_factor |
---|
172 | |
---|
173 | #poly_coast1 = read_polygon(polygons_dir+'pts_coast1.csv') |
---|
174 | #res_0 = 20000*res_factor |
---|
175 | |
---|
176 | poly_coast2 = read_polygon(polygons_dir+'coast2_new_pts.csv') |
---|
177 | #poly_coast2 = read_polygon(polygons_dir+'pts_coast2.csv') |
---|
178 | #res_0 = 20000*res_factor |
---|
179 | |
---|
180 | poly_coast3 = read_polygon(polygons_dir+'pts_coast3.csv') |
---|
181 | #res_0 = 20000*res_factor |
---|
182 | |
---|
183 | poly_exmouth = read_polygon(polygons_dir+'exmouth_new_pts.csv') |
---|
184 | #poly_exmouth = read_polygon(polygons_dir+'pts_exmouth.csv') |
---|
185 | res_exmouth = 500*res_factor |
---|
186 | |
---|
187 | poly_exmouth_south = read_polygon(polygons_dir+'exmouth_south_pts.csv') |
---|
188 | #res_exmouth = 500*res_factor |
---|
189 | |
---|
190 | poly_carpark1 = read_polygon(polygons_dir+'carpark1_pts.csv') |
---|
191 | #res_exmouth = 500*res_factor |
---|
192 | |
---|
193 | poly_carpark2 = read_polygon(polygons_dir+'carpark2_pts.csv') |
---|
194 | #res_exmouth = 500*res_factor |
---|
195 | |
---|
196 | poly_carpark3 = read_polygon(polygons_dir+'carpark3_pts.csv') |
---|
197 | #res_exmouth = 500*res_factor |
---|
198 | |
---|
199 | poly_nth_defence = read_polygon(polygons_dir+'pts_nth_defence.csv') |
---|
200 | res_nth_defence = 5000*res_factor |
---|
201 | |
---|
202 | poly_middle = read_polygon(polygons_dir+'middle_new_pts.csv') |
---|
203 | #poly_middle = read_polygon(polygons_dir+'pts_middle.csv') |
---|
204 | res_middle = 30000*res_factor |
---|
205 | |
---|
206 | poly_airport = read_polygon(polygons_dir+'pts_airport.csv') |
---|
207 | res_airport = 5000*res_factor |
---|
208 | |
---|
209 | interior_regions = [[poly_coast,res_coast],[poly_coast2,res_coast] |
---|
210 | ,[poly_coast3,res_coast],[poly_middle,res_middle],[poly_exmouth,res_exmouth] |
---|
211 | ,[poly_exmouth_south,res_exmouth],[poly_carpark1,res_exmouth],[poly_carpark2,res_exmouth] |
---|
212 | ,[poly_carpark3,res_exmouth],[poly_nth_defence,res_nth_defence],[poly_airport,res_airport]] |
---|
213 | |
---|
214 | trigs_min = number_mesh_triangles(interior_regions, poly_all, res_poly_all) |
---|
215 | |
---|
216 | print 'min number triangles', trigs_min |
---|
217 | |
---|
218 | poly_mainland = read_polygon(polygons_dir+'Initial_Condition.csv') |
---|
219 | |
---|
220 | ################################################################### |
---|
221 | # Clipping regions for export to asc and regions for clipping data |
---|
222 | ################################################################### |
---|
223 | |
---|
224 | # exporting asc grid - Exmouth town area |
---|
225 | eastingmin = 200663 |
---|
226 | eastingmax = 207500 |
---|
227 | northingmax = 7574000 |
---|
228 | northingmin = 7564500 |
---|
229 | |
---|
230 | # exporting asc grid - carparks etc on NW peninsula |
---|
231 | e_min_area = 192700 |
---|
232 | e_max_area = 203755 |
---|
233 | n_max_area = 7587330 |
---|
234 | n_min_area = 7579460 |
---|