1 | """Common filenames and locations for topographic data, meshes and outputs. |
---|
2 | """ |
---|
3 | |
---|
4 | from os import sep, environ, getenv, getcwd,umask |
---|
5 | from os.path import expanduser, basename |
---|
6 | from anuga.utilities.polygon import read_polygon, plot_polygons, polygon_area, is_inside_polygon, number_mesh_triangles |
---|
7 | import sys |
---|
8 | from anuga.coordinate_transforms.redfearn import degminsec2decimal_degrees |
---|
9 | from time import localtime, strftime, gmtime |
---|
10 | from anuga.utilities.system_tools import get_user_name, get_host_name |
---|
11 | |
---|
12 | # file and system info |
---|
13 | #--------------------------------- |
---|
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 | #time stuff |
---|
22 | time = strftime('%Y%m%d_%H%M%S',gmtime()) #gets time for new dir |
---|
23 | build_time = time+'_build' |
---|
24 | run_time = time+'_run' |
---|
25 | |
---|
26 | #tide = -2.5 |
---|
27 | #tide = 0.0 |
---|
28 | tide = 2.4 |
---|
29 | |
---|
30 | #Maybe will try to make project a class to allow these parameters to be passed in. |
---|
31 | alpha = 0.1 |
---|
32 | friction=0.01 |
---|
33 | starttime=3600 |
---|
34 | finaltime=25000 |
---|
35 | setup='final' |
---|
36 | source='exmouth' |
---|
37 | |
---|
38 | if setup =='trial': |
---|
39 | print'trial' |
---|
40 | res_factor=10 |
---|
41 | time_thinning=48 |
---|
42 | yieldstep=240 |
---|
43 | if setup =='basic': |
---|
44 | print'basic' |
---|
45 | res_factor=4 |
---|
46 | time_thinning=12 |
---|
47 | yieldstep=120 |
---|
48 | if setup =='final': |
---|
49 | print'final' |
---|
50 | res_factor=1 |
---|
51 | time_thinning=1 |
---|
52 | yieldstep=60 |
---|
53 | if setup =='store': |
---|
54 | print'store' |
---|
55 | res_factor=10 |
---|
56 | time_thinning=48 |
---|
57 | yieldstep=240 |
---|
58 | |
---|
59 | dir_comment='_'+setup+'_'+str(tide)+'_'+str(source)+'_'+str(user) |
---|
60 | |
---|
61 | |
---|
62 | #Making assumptions about the location of scenario data |
---|
63 | state = 'western_australia' |
---|
64 | scenario_name = 'dampier' |
---|
65 | scenario = 'dampier_tsunami_scenario_2006' |
---|
66 | |
---|
67 | # onshore data provided by WA DLI |
---|
68 | onshore_name = 'DLI_DTED_raster_clipped' # original |
---|
69 | |
---|
70 | # AHO + DPI data + colin French coastline |
---|
71 | coast_name = 'coastline_edited_w_DEM' |
---|
72 | offshore_name = 'clipped_bathy' |
---|
73 | offshore1_name = 'elev_501' |
---|
74 | offshore2_name = 'inferrec_e' |
---|
75 | |
---|
76 | #final topo name |
---|
77 | combined_name ='dampier_combined_elevation' |
---|
78 | combined_smaller_name = 'dampier_combined_elevation_small' |
---|
79 | combined_smallest_name = 'dampier_combined_elevation_smallest' |
---|
80 | |
---|
81 | anuga_dir = home+state+sep+scenario+sep+'anuga'+sep |
---|
82 | |
---|
83 | topographies_in_dir = home+sep+state+sep+scenario+sep+'elevation_final'+sep+'070112'+sep+'points'+sep |
---|
84 | topographies_dir = anuga_dir+'topographies'+sep |
---|
85 | topographies_time_dir = topographies_dir+build_time+sep |
---|
86 | |
---|
87 | |
---|
88 | # input topo file location |
---|
89 | onshore_in_dir_name = topographies_in_dir + onshore_name |
---|
90 | coast_in_dir_name = topographies_in_dir + coast_name |
---|
91 | offshore_in_dir_name = topographies_in_dir + offshore_name |
---|
92 | offshore1_in_dir_name = topographies_in_dir + offshore1_name |
---|
93 | offshore2_in_dir_name = topographies_in_dir + offshore2_name |
---|
94 | |
---|
95 | onshore_dir_name = topographies_dir + onshore_name |
---|
96 | coast_dir_name = topographies_dir + coast_name |
---|
97 | offshore_dir_name = topographies_dir + offshore_name |
---|
98 | offshore1_dir_name = topographies_dir + offshore1_name |
---|
99 | offshore2_dir_name = topographies_dir + offshore2_name |
---|
100 | |
---|
101 | #final topo files |
---|
102 | combined_dir_name = topographies_dir + combined_name |
---|
103 | combined_time_dir_name = topographies_time_dir + combined_name |
---|
104 | combined_smaller_dir_name = topographies_dir + combined_smaller_name |
---|
105 | combined_smallest_dir_name = topographies_dir + combined_smallest_name |
---|
106 | #combined_time_dir_final_name = topographies_time_dir + combined_final_name |
---|
107 | |
---|
108 | meshes_dir = anuga_dir+'meshes'+sep |
---|
109 | meshes_dir_name = meshes_dir + scenario_name |
---|
110 | |
---|
111 | polygons_dir = anuga_dir+'polygons'+sep+'2007polys'+sep |
---|
112 | tide_dir = anuga_dir+'tide_data'+sep |
---|
113 | |
---|
114 | if source =='dampier': |
---|
115 | boundaries_name = 'dampier' #Dampier gun |
---|
116 | boundaries_in_dir = anuga_dir+'boundaries'+sep+'urs'+sep+'dampier'+sep+'1_10000'+sep |
---|
117 | |
---|
118 | if source=='onslow': |
---|
119 | boundaries_name = 'dampier_3859_16052007' #onslow_hedland_broome gun |
---|
120 | boundaries_in_dir = anuga_dir+'boundaries'+sep+'urs'+sep+'onslow_hedland_broome'+sep+'1_10000'+sep |
---|
121 | |
---|
122 | if source=='exmouth': |
---|
123 | boundaries_name = 'dampier_3103_18052007' #exmouth gun |
---|
124 | boundaries_in_dir = anuga_dir+'boundaries'+sep+'urs'+sep+'exmouth'+sep+'1_10000'+sep |
---|
125 | |
---|
126 | #boundaries_in_dir = anuga_dir+'boundaries'+sep+'urs'+sep+'1_10000'+sep |
---|
127 | boundaries_in_dir_name = boundaries_in_dir + boundaries_name |
---|
128 | boundaries_dir = anuga_dir+'boundaries'+sep |
---|
129 | boundaries_dir_name = boundaries_dir + boundaries_name |
---|
130 | |
---|
131 | #output locations |
---|
132 | output_dir = anuga_dir+'outputs'+sep |
---|
133 | output_build_time_dir = output_dir+build_time+'_'+source+sep |
---|
134 | output_run_time_dir = output_dir +run_time+dir_comment+sep |
---|
135 | #output_run_time_dir = output_dir +'20070618_050232_run_final_0.0_onslow_nbartzis'+sep |
---|
136 | output_run_time_dir_name = output_run_time_dir + scenario_name #Used by post processing |
---|
137 | |
---|
138 | #gauges |
---|
139 | gauge_name = 'dampier_gauges_up2.csv' #'dampier.csv' |
---|
140 | gauge_name_simple = 'dampier_gauges_simple.csv' |
---|
141 | gauge_name_test = 'dampier_gauges_up_test.csv' #'dampier.csv' |
---|
142 | gauges_dir = anuga_dir+'gauges'+sep |
---|
143 | gauges_dir_name = gauges_dir + gauge_name |
---|
144 | gauges_dir_name_simple = gauges_dir + gauge_name_simple |
---|
145 | gauges_dir_name_test = gauges_dir + gauge_name_test |
---|
146 | |
---|
147 | community_filename = gauges_dir + 'CHINS_v2.csv' |
---|
148 | community_KD = gauges_dir + 'community_KD.csv' |
---|
149 | |
---|
150 | buildings_filename = gauges_dir + 'Dampier_res_Project.csv' |
---|
151 | buildings_filename_out = 'Dampier_res_Project_modified.csv' |
---|
152 | ############################### |
---|
153 | # Domain definitions |
---|
154 | ############################### |
---|
155 | |
---|
156 | #refzone = 50 |
---|
157 | south_boundary = degminsec2decimal_degrees(-20,58,0) |
---|
158 | #north_boundary = degminsec2decimal_degrees(-20,13,0) |
---|
159 | north_boundary = degminsec2decimal_degrees(-19,30,0) |
---|
160 | west_boundary = degminsec2decimal_degrees(116,15,0) |
---|
161 | east_boundary = degminsec2decimal_degrees(117,11,0) |
---|
162 | |
---|
163 | poly_all = read_polygon(polygons_dir+'extent.csv') |
---|
164 | print 'Area of bounding polygon', polygon_area(poly_all)/1000000.0 |
---|
165 | |
---|
166 | res_poly_all = 150000*res_factor |
---|
167 | #res_poly_all = 150000 |
---|
168 | |
---|
169 | poly_pipeline = read_polygon(polygons_dir+'pipeline2.csv') |
---|
170 | res_pipeline = 2000 |
---|
171 | |
---|
172 | ############################### |
---|
173 | # Interior region definitions |
---|
174 | ############################### |
---|
175 | |
---|
176 | poly_region = read_polygon(polygons_dir+'region.csv') |
---|
177 | res_region = 50000*res_factor |
---|
178 | |
---|
179 | poly_dampier = read_polygon(polygons_dir+'dampier_town.csv') |
---|
180 | res_dampier = 500*res_factor |
---|
181 | |
---|
182 | poly_karratha = read_polygon(polygons_dir+'karrathav2.csv') |
---|
183 | res_karratha = 15000*res_factor |
---|
184 | |
---|
185 | poly_karratha_town = read_polygon(polygons_dir+'karratha_townv2.csv') |
---|
186 | res_karratha_town = 500*res_factor |
---|
187 | |
---|
188 | poly_facility = read_polygon(polygons_dir+'facility.csv') |
---|
189 | res_facility = 1000*res_factor |
---|
190 | |
---|
191 | poly_delambre = read_polygon(polygons_dir+'delambre.csv') |
---|
192 | res_delambre = 1000*res_factor |
---|
193 | |
---|
194 | poly_coast = read_polygon(polygons_dir+'coastpoly.csv') |
---|
195 | res_coast = 5000*res_factor |
---|
196 | |
---|
197 | poly_NWislands = read_polygon(polygons_dir+'nw_islands_area.csv') |
---|
198 | res_NWislands = 50000*res_factor |
---|
199 | |
---|
200 | poly_island0 = read_polygon(polygons_dir+'island0.csv') |
---|
201 | res_island0 = res_poly_all |
---|
202 | |
---|
203 | poly_island1 = read_polygon(polygons_dir+'island1.csv') |
---|
204 | res_island0 = res_poly_all |
---|
205 | |
---|
206 | poly_island2 = read_polygon(polygons_dir+'island2.csv') |
---|
207 | res_island0 = res_poly_all |
---|
208 | |
---|
209 | poly_island3 = read_polygon(polygons_dir+'island3.csv') |
---|
210 | res_island0 = res_poly_all |
---|
211 | |
---|
212 | res_islands = 5000*res_factor |
---|
213 | |
---|
214 | poly_ref_nw4 = read_polygon(polygons_dir+'ref_nw4.csv') |
---|
215 | res_ref_nw4 = res_islands |
---|
216 | |
---|
217 | poly_island4 = read_polygon(polygons_dir+'island4.csv') |
---|
218 | res_island0 = res_poly_all |
---|
219 | |
---|
220 | poly_ref_nw5 = read_polygon(polygons_dir+'ref_nw5.csv') |
---|
221 | res_ref_nw5 = res_islands |
---|
222 | |
---|
223 | poly_island5 = read_polygon(polygons_dir+'island5.csv') |
---|
224 | res_island0 = res_poly_all |
---|
225 | |
---|
226 | poly_ref_nw6 = read_polygon(polygons_dir+'ref_nw6.csv') |
---|
227 | res_ref_nw6 = res_islands |
---|
228 | |
---|
229 | poly_island6 = read_polygon(polygons_dir+'island6.csv') |
---|
230 | res_island0 = res_poly_all |
---|
231 | |
---|
232 | poly_ref_nw7 = read_polygon(polygons_dir+'ref_nw7.csv') |
---|
233 | res_ref_nw7 = res_islands |
---|
234 | |
---|
235 | poly_island7 = read_polygon(polygons_dir+'island7.csv') |
---|
236 | res_island0 = res_poly_all |
---|
237 | |
---|
238 | poly_ref_nw8 = read_polygon(polygons_dir+'ref_nw8.csv') |
---|
239 | res_ref_nw8 = res_islands |
---|
240 | |
---|
241 | poly_island8 = read_polygon(polygons_dir+'island8.csv') |
---|
242 | res_island0 = res_poly_all |
---|
243 | |
---|
244 | |
---|
245 | #plot_polygons([poly_dampier,poly_karratha,poly_karratha_town,poly_delambre, |
---|
246 | # poly_coast,poly_NWislands,poly_island0,poly_island1,poly_island2, |
---|
247 | # poly_island3,poly_island4,poly_island5,poly_island6, |
---|
248 | # poly_island7,poly_island8,poly_ref_nw4,poly_ref_nw5, |
---|
249 | # poly_ref_nw6,poly_ref_nw7,poly_ref_nw8,poly_all],figname='poly_pic') |
---|
250 | |
---|
251 | interior_regions = [[poly_dampier,res_dampier], |
---|
252 | [poly_karratha,res_karratha],[poly_karratha_town,res_karratha_town], |
---|
253 | [poly_delambre,res_delambre],[poly_coast,res_coast], |
---|
254 | [poly_facility,res_facility], |
---|
255 | #[poly_NWislands,res_NWislands], |
---|
256 | [poly_island0,res_island0],[poly_island1,res_island0], |
---|
257 | [poly_island2,res_island0],[poly_island3,res_island0], |
---|
258 | [poly_island4,res_island0],[poly_island5,res_island0], |
---|
259 | [poly_island6,res_island0],[poly_island7,res_island0], |
---|
260 | [poly_island8,res_island0],[poly_ref_nw4,res_ref_nw4], |
---|
261 | [poly_ref_nw5,res_ref_nw5],[poly_ref_nw6,res_ref_nw6], |
---|
262 | [poly_ref_nw7,res_ref_nw7],[poly_ref_nw8,res_ref_nw8] |
---|
263 | # ,[poly_pipeline,res_pipeline] |
---|
264 | ] |
---|
265 | |
---|
266 | interior_regions_test = [[poly_dampier,res_dampier], |
---|
267 | [poly_karratha,res_karratha],[poly_karratha_town,res_karratha_town]] |
---|
268 | |
---|
269 | trigs_min = number_mesh_triangles(interior_regions, poly_all, res_poly_all) |
---|
270 | |
---|
271 | print 'min number triangles', trigs_min |
---|
272 | |
---|
273 | ################################################################### |
---|
274 | # Clipping regions for export to asc and regions for clipping data |
---|
275 | ################################################################### |
---|
276 | |
---|
277 | poly_mainland = read_polygon(polygons_dir+'mainland_only.csv') |
---|
278 | # |
---|
279 | ## exporting asc grid - Dampier gas facility |
---|
280 | #e_min_area = 474000 |
---|
281 | #e_max_area = 480000 |
---|
282 | #n_min_area = 7719000 |
---|
283 | #n_max_area = 7725000 |
---|
284 | # |
---|
285 | ## residential Dampier |
---|
286 | #e_min_area_d = 468450 |
---|
287 | #e_max_area_d = 470820 |
---|
288 | #n_min_area_d = 7714050 |
---|
289 | #n_max_area_d = 7716625 |
---|
290 | |
---|
291 | # residential Karratha |
---|
292 | eastingmin = 474690 |
---|
293 | eastingmax = 489900 |
---|
294 | northingmin = 7704760 |
---|
295 | northingmax = 7712600 |
---|