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 + 'Port_Hedland_res_Project.csv' |
---|
133 | buildings_filename_out = 'Port_Hedland_res_Project_modified.csv' |
---|
134 | tidal_filename = tide_dir + 'pt_hedland_tide.txt' |
---|
135 | community_filename = gauges_dir + 'CHINS_v2.csv' |
---|
136 | community_scenario = gauges_dir + 'community_pt_hedland.csv' |
---|
137 | |
---|
138 | # clipping region to make DEM (pts file) from onshore data |
---|
139 | eastingmin = 594000 |
---|
140 | eastingmax = 715000 |
---|
141 | northingmin = 7720000 |
---|
142 | northingmax = 7880000 |
---|
143 | |
---|
144 | # for ferret2sww |
---|
145 | south = degminsec2decimal_degrees(-20,30,0) |
---|
146 | north = degminsec2decimal_degrees(-17,10,0) |
---|
147 | west = degminsec2decimal_degrees(117,00,0) |
---|
148 | east = degminsec2decimal_degrees(120,00,0) |
---|
149 | |
---|
150 | # region to export (used from export_results.py) |
---|
151 | e_min_area = 648000 |
---|
152 | e_max_area = 675000 |
---|
153 | n_min_area = 7745000 |
---|
154 | n_max_area = 7761000 |
---|
155 | |
---|
156 | export_region = [[e_min_area,n_min_area],[e_min_area,n_max_area], |
---|
157 | [e_max_area,n_max_area],[e_max_area,n_min_area]] |
---|
158 | |
---|
159 | refzone = 50 |
---|
160 | |
---|
161 | from anuga.coordinate_transforms.redfearn import redfearn |
---|
162 | # boundary up to 50 m contour |
---|
163 | lat1_50 = degminsec2decimal_degrees(-19,20,0) |
---|
164 | lat2_50 = degminsec2decimal_degrees(-19,30,0) |
---|
165 | lat3_50 = degminsec2decimal_degrees(-19,45,0) |
---|
166 | lon1_50 = degminsec2decimal_degrees(119,05,0) |
---|
167 | lon2_50 = degminsec2decimal_degrees(118,20,0) |
---|
168 | lon3_50 = degminsec2decimal_degrees(117,45,0) |
---|
169 | z, easting, northing = redfearn(lat1_50, lon1_50) |
---|
170 | d0_50 = [easting, northing] |
---|
171 | z, easting, northing = redfearn(lat2_50, lon2_50) |
---|
172 | d1_50 = [easting, northing] |
---|
173 | z, easting, northing= redfearn(lat3_50, lon3_50) |
---|
174 | d2_50 = [easting, northing] |
---|
175 | |
---|
176 | d4_50 = [285000, 7585000] |
---|
177 | d6_50 = [330000, 7605000] |
---|
178 | #bounding_poly50 = [p0_50, p1_50, p2_50, d6_50, d5, d4_50] |
---|
179 | |
---|
180 | d0 = [763852.0, 7934358.0] |
---|
181 | d1 = [710987.0, 7925797.0] |
---|
182 | d2 = [658264.0, 7926314.0] |
---|
183 | d3 = [552686.0, 7871580.0] |
---|
184 | #d4 = [604415.81, 7733013.56] |
---|
185 | d4 = [638000.0, 7733013.56] |
---|
186 | #d5 = [656561.15, 7732615.11] |
---|
187 | d5 = [662000.0, 7732615.11] |
---|
188 | #d6 = [708940.32, 7750510.33] |
---|
189 | d6 = [690000.0, 7740510.33] |
---|
190 | #polyAll = [d0, d1, d2, d3, d4, d5, d6] |
---|
191 | #polyAll = [d0_50, d1_50, d2_50, d4, d5, d6] |
---|
192 | # from Hamish |
---|
193 | h0=[629262.17, 7747205.47] |
---|
194 | h1=[552686.00, 7871579.99] #d3 |
---|
195 | h2=[658264.00, 7926314.00] #d2 |
---|
196 | h3=[710986.99, 7925796.99] #d1 |
---|
197 | h4=[763851.99, 7934357.99] #d0 |
---|
198 | h5=[701485.21, 7770656.86] |
---|
199 | h6=[698273.75, 7762227.38] |
---|
200 | h7=[698194.23, 7762018.65] |
---|
201 | h8=[691627.41, 7744781.98] |
---|
202 | h9=[679220.75, 7743604.59] |
---|
203 | h10=[653512.59, 7740528.56] |
---|
204 | h11=[634777.71, 7738247.17] |
---|
205 | h12=[629443.86, 7746910.37] |
---|
206 | h13=[629396.84, 7746986.75] |
---|
207 | h14=[629352.32, 7747059.06] |
---|
208 | h15=[629276.24, 7747182.63] |
---|
209 | h16=[629262.17, 7747205.47] #repeat of h0 |
---|
210 | # using Hamish's new bounding polygon |
---|
211 | #polyAll = [d0_50, d1_50, d2_50, h16,h15,h14,h13,h12,h11,h10,h9,h8,h7,h6,h5] |
---|
212 | poly_all = [d0_50, d1_50, d2_50, h16,h11,h8,h6, h5] |
---|
213 | res_poly_all = 250000*res_factor |
---|
214 | |
---|
215 | #Interior region - Pt Hedland town |
---|
216 | i0 = [668000, 7757000] |
---|
217 | i1 = [659000, 7755000] |
---|
218 | i2 = [660000, 7749000] |
---|
219 | i3 = [667000, 7746000] |
---|
220 | i4 = [678000, 7751000] |
---|
221 | |
---|
222 | poly_pt_hedland = [i0, i1, i2, i3, i4] |
---|
223 | res_pt_hedland=500*res_factor |
---|
224 | |
---|
225 | #Are there other significant features? |
---|
226 | j0 = [670000, 7760000] |
---|
227 | j1 = [633000, 7745000] |
---|
228 | j2 = [665000, 7743000] |
---|
229 | j3 = [690000, 7755000] |
---|
230 | |
---|
231 | poly_region = [j0, j1, j2, j3] |
---|
232 | res_region = 60000*res_factor |
---|
233 | |
---|
234 | poly_mainland = read_polygon(polygons_dir+'Initial_Condition.csv') |
---|
235 | |
---|
236 | poly_topo_clip = [[664000,7752000],[664000,7754000], |
---|
237 | [666000,7754000],[666000,7752000]] |
---|
238 | |
---|
239 | interior_regions = [[poly_pt_hedland,res_pt_hedland],[poly_region,res_region] |
---|
240 | # ,[poly_region,res_region] |
---|
241 | ] |
---|
242 | |
---|
243 | trigs_min = number_mesh_triangles(interior_regions, poly_all, res_poly_all) |
---|
244 | |
---|
245 | print 'min number triangles', trigs_min |
---|
246 | |
---|
247 | |
---|