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 = 'pt_hedland' |
---|
24 | scenario = 'pt_hedland_tsunami_scenario_2006' |
---|
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 = -3.9 |
---|
32 | tide = 0.0 |
---|
33 | #tide = 3.6 |
---|
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 | finaltime=25000 |
---|
39 | starttime=3600 |
---|
40 | setup='final' |
---|
41 | |
---|
42 | #dir_comment='_trial_'+str(tide)+'_'+str(user) |
---|
43 | #dir_comment='_final_'+str(tide)+'_'+str(user) |
---|
44 | #time_thinning=4 |
---|
45 | #yieldstep=60 |
---|
46 | #res_factor = 1 |
---|
47 | |
---|
48 | if setup =='trial': |
---|
49 | print'trial' |
---|
50 | res_factor=10 |
---|
51 | time_thinning=48 |
---|
52 | yieldstep=240 |
---|
53 | if setup =='basic': |
---|
54 | print'basic' |
---|
55 | res_factor=4 |
---|
56 | time_thinning=12 |
---|
57 | yieldstep=120 |
---|
58 | if setup =='final': |
---|
59 | print'final' |
---|
60 | res_factor=1 |
---|
61 | time_thinning=4 |
---|
62 | yieldstep=60 |
---|
63 | |
---|
64 | |
---|
65 | dir_comment='_'+setup+'_'+str(tide)+'_'+str(user) |
---|
66 | |
---|
67 | # onshore data from 30m DTED level 2 |
---|
68 | onshore_name = 'dli_dem' # get from Neil/Ingo (DEM or topo data) |
---|
69 | offshore_name = 'pt_hedland_bathy_edit' |
---|
70 | offshore1_name = '1' |
---|
71 | offshore2_name = '2' |
---|
72 | coast_name = 'Coastline' |
---|
73 | |
---|
74 | #final topo name |
---|
75 | combined_name ='pt_hedland_combined_elevation' |
---|
76 | combined_small_name = 'pt_hedland_combined_elevation_small' |
---|
77 | combined_smallest_name = 'pt_hedland_export' |
---|
78 | |
---|
79 | anuga_dir = home+state+sep+scenario+sep+'anuga'+sep |
---|
80 | |
---|
81 | topographies_in_dir = home+state+sep+scenario+sep+'elevation_final'+sep+'20070416'+sep+'points'+sep |
---|
82 | topographies_dir = anuga_dir+'topographies'+sep |
---|
83 | |
---|
84 | # input topo file location |
---|
85 | onshore_in_dir_name = topographies_in_dir + onshore_name |
---|
86 | coast_in_dir_name = topographies_in_dir + coast_name |
---|
87 | offshore_in_dir_name = topographies_in_dir + offshore_name |
---|
88 | offshore1_in_dir_name = topographies_in_dir + offshore1_name |
---|
89 | offshore2_in_dir_name = topographies_in_dir + offshore2_name |
---|
90 | |
---|
91 | onshore_dir_name = topographies_dir + onshore_name |
---|
92 | coast_dir_name = topographies_dir + coast_name |
---|
93 | offshore_dir_name = topographies_dir + offshore_name |
---|
94 | offshore1_dir_name = topographies_dir + offshore1_name |
---|
95 | offshore2_dir_name = topographies_dir + offshore2_name |
---|
96 | |
---|
97 | #final topo files |
---|
98 | combined_dir_name = topographies_dir + combined_name |
---|
99 | #combined_time_dir_name = topographies_time_dir + combined_name |
---|
100 | combined_small_dir_name = topographies_dir + combined_small_name |
---|
101 | combined_smallest_dir_name = topographies_dir + combined_smallest_name |
---|
102 | |
---|
103 | meshes_dir = anuga_dir+'meshes'+sep |
---|
104 | meshes_dir_name = meshes_dir + scenario_name |
---|
105 | |
---|
106 | polygons_dir = anuga_dir+'polygons'+sep |
---|
107 | tide_dir = anuga_dir+'tide_data'+sep |
---|
108 | |
---|
109 | #boundaries locations |
---|
110 | boundaries_name = 'pt_hedland_3854_17042007' |
---|
111 | |
---|
112 | boundaries_in_dir = anuga_dir+'boundaries'+sep+'urs'+sep+'1_10000'+sep |
---|
113 | boundaries_in_dir_name = boundaries_in_dir + boundaries_name |
---|
114 | boundaries_dir = anuga_dir+'boundaries'+sep |
---|
115 | boundaries_dir_name = boundaries_dir + boundaries_name |
---|
116 | |
---|
117 | #output locations |
---|
118 | output_dir = anuga_dir+'outputs'+sep |
---|
119 | output_build_time_dir = output_dir+build_time+sep |
---|
120 | output_run_time_dir = output_dir +run_time+dir_comment+sep |
---|
121 | output_run_time_dir_name = output_run_time_dir + scenario_name #Used by post processing |
---|
122 | |
---|
123 | #gauges |
---|
124 | gauge_name = 'gauge_location_port_hedland.csv' |
---|
125 | gauge_name_test = 'gauge_checking_test.csv' |
---|
126 | gauges_dir = anuga_dir+'gauges'+sep |
---|
127 | gauges_dir_name = gauges_dir + gauge_name |
---|
128 | gauges_dir_name_test = gauges_dir + gauge_name_test |
---|
129 | |
---|
130 | tide_dir = anuga_dir+'tide_data'+sep |
---|
131 | |
---|
132 | buildings_filename = gauges_dir + 'pt_hedland_res.csv' |
---|
133 | buildings_filename_out = 'pt_hedland_res_modified.csv' |
---|
134 | buildings_filename_damage_out = 'pt_hedland_res_modified_damage.csv' |
---|
135 | tidal_filename = tide_dir + 'pt_hedland_tide.txt' |
---|
136 | community_filename = gauges_dir + 'CHINS_v2.csv' |
---|
137 | community_scenario = gauges_dir + 'community_pt_hedland.csv' |
---|
138 | |
---|
139 | # clipping region to make DEM (pts file) from onshore data |
---|
140 | eastingmin = 594000 |
---|
141 | eastingmax = 715000 |
---|
142 | northingmin = 7720000 |
---|
143 | northingmax = 7880000 |
---|
144 | |
---|
145 | # for ferret2sww |
---|
146 | south = degminsec2decimal_degrees(-20,30,0) |
---|
147 | north = degminsec2decimal_degrees(-17,10,0) |
---|
148 | west = degminsec2decimal_degrees(117,00,0) |
---|
149 | east = degminsec2decimal_degrees(120,00,0) |
---|
150 | |
---|
151 | # region to export (used from export_results.py) |
---|
152 | e_min_area = 648000 |
---|
153 | e_max_area = 675000 |
---|
154 | n_min_area = 7745000 |
---|
155 | n_max_area = 7761000 |
---|
156 | |
---|
157 | export_region = [[e_min_area,n_min_area],[e_min_area,n_max_area], |
---|
158 | [e_max_area,n_max_area],[e_max_area,n_min_area]] |
---|
159 | |
---|
160 | refzone = 50 |
---|
161 | |
---|
162 | from anuga.coordinate_transforms.redfearn import redfearn |
---|
163 | # boundary up to 50 m contour |
---|
164 | lat1_50 = degminsec2decimal_degrees(-19,20,0) |
---|
165 | lat2_50 = degminsec2decimal_degrees(-19,30,0) |
---|
166 | lat3_50 = degminsec2decimal_degrees(-19,45,0) |
---|
167 | lon1_50 = degminsec2decimal_degrees(119,05,0) |
---|
168 | lon2_50 = degminsec2decimal_degrees(118,20,0) |
---|
169 | lon3_50 = degminsec2decimal_degrees(117,45,0) |
---|
170 | z, easting, northing = redfearn(lat1_50, lon1_50) |
---|
171 | d0_50 = [easting, northing] |
---|
172 | z, easting, northing = redfearn(lat2_50, lon2_50) |
---|
173 | d1_50 = [easting, northing] |
---|
174 | z, easting, northing= redfearn(lat3_50, lon3_50) |
---|
175 | d2_50 = [easting, northing] |
---|
176 | |
---|
177 | d4_50 = [285000, 7585000] |
---|
178 | d6_50 = [330000, 7605000] |
---|
179 | #bounding_poly50 = [p0_50, p1_50, p2_50, d6_50, d5, d4_50] |
---|
180 | |
---|
181 | d0 = [763852.0, 7934358.0] |
---|
182 | d1 = [710987.0, 7925797.0] |
---|
183 | d2 = [658264.0, 7926314.0] |
---|
184 | d3 = [552686.0, 7871580.0] |
---|
185 | #d4 = [604415.81, 7733013.56] |
---|
186 | d4 = [638000.0, 7733013.56] |
---|
187 | #d5 = [656561.15, 7732615.11] |
---|
188 | d5 = [662000.0, 7732615.11] |
---|
189 | #d6 = [708940.32, 7750510.33] |
---|
190 | d6 = [690000.0, 7740510.33] |
---|
191 | #polyAll = [d0, d1, d2, d3, d4, d5, d6] |
---|
192 | #polyAll = [d0_50, d1_50, d2_50, d4, d5, d6] |
---|
193 | # from Hamish |
---|
194 | h0=[629262.17, 7747205.47] |
---|
195 | h1=[552686.00, 7871579.99] #d3 |
---|
196 | h2=[658264.00, 7926314.00] #d2 |
---|
197 | h3=[710986.99, 7925796.99] #d1 |
---|
198 | h4=[763851.99, 7934357.99] #d0 |
---|
199 | h5=[701485.21, 7770656.86] |
---|
200 | h6=[698273.75, 7762227.38] |
---|
201 | h7=[698194.23, 7762018.65] |
---|
202 | h8=[691627.41, 7744781.98] |
---|
203 | h9=[679220.75, 7743604.59] |
---|
204 | h10=[653512.59, 7740528.56] |
---|
205 | h11=[634777.71, 7738247.17] |
---|
206 | h12=[629443.86, 7746910.37] |
---|
207 | h13=[629396.84, 7746986.75] |
---|
208 | h14=[629352.32, 7747059.06] |
---|
209 | h15=[629276.24, 7747182.63] |
---|
210 | h16=[629262.17, 7747205.47] #repeat of h0 |
---|
211 | # using Hamish's new bounding polygon |
---|
212 | #polyAll = [d0_50, d1_50, d2_50, h16,h15,h14,h13,h12,h11,h10,h9,h8,h7,h6,h5] |
---|
213 | poly_all = [d0_50, d1_50, d2_50, h16,h11,h8,h6, h5] |
---|
214 | res_poly_all = 250000*res_factor |
---|
215 | |
---|
216 | #Interior region - Pt Hedland town |
---|
217 | i0 = [668000, 7757000] |
---|
218 | i1 = [659000, 7755000] |
---|
219 | i2 = [660000, 7749000] |
---|
220 | i3 = [667000, 7746000] |
---|
221 | i4 = [678000, 7751000] |
---|
222 | |
---|
223 | poly_pt_hedland = [i0, i1, i2, i3, i4] |
---|
224 | res_pt_hedland=500*res_factor |
---|
225 | |
---|
226 | #Are there other significant features? |
---|
227 | j0 = [670000, 7760000] |
---|
228 | j1 = [633000, 7745000] |
---|
229 | j2 = [665000, 7743000] |
---|
230 | j3 = [690000, 7755000] |
---|
231 | |
---|
232 | poly_region = [j0, j1, j2, j3] |
---|
233 | res_region = 60000*res_factor |
---|
234 | |
---|
235 | poly_mainland = read_polygon(polygons_dir+'Initial_Condition.csv') |
---|
236 | |
---|
237 | poly_topo_clip = [[664000,7752000],[664000,7754000], |
---|
238 | [666000,7754000],[666000,7752000]] |
---|
239 | |
---|
240 | interior_regions = [[poly_pt_hedland,res_pt_hedland],[poly_region,res_region] |
---|
241 | # ,[poly_region,res_region] |
---|
242 | ] |
---|
243 | |
---|
244 | trigs_min = number_mesh_triangles(interior_regions, poly_all, res_poly_all) |
---|
245 | |
---|
246 | print 'min number triangles', trigs_min |
---|
247 | |
---|
248 | |
---|