1 | """Common filenames and locations for topographic data, meshes and outputs. |
---|
2 | """ |
---|
3 | |
---|
4 | import sys |
---|
5 | from os import sep, environ, getenv, getcwd |
---|
6 | from os.path import expanduser, basename |
---|
7 | |
---|
8 | from anuga.coordinate_transforms.redfearn import\ |
---|
9 | degminsec2decimal_degrees,\ |
---|
10 | convert_from_latlon_to_utm |
---|
11 | |
---|
12 | from time import localtime, strftime |
---|
13 | from anuga.geospatial_data.geospatial_data import * |
---|
14 | |
---|
15 | # file and system info |
---|
16 | #--------------------------------- |
---|
17 | codename = 'project.py' |
---|
18 | |
---|
19 | home = getenv('INUNDATIONHOME') #Sandpit's parent dir |
---|
20 | |
---|
21 | if sys.platform == 'win32': |
---|
22 | user = getenv('USERPROFILE') |
---|
23 | else: |
---|
24 | user = getenv('LOGNAME') |
---|
25 | |
---|
26 | # INUNDATIONHOME is the inundation directory, not the data directory. |
---|
27 | home += sep +'data' |
---|
28 | #---------------------------------- |
---|
29 | # Location and naming of scenario data |
---|
30 | #---------------------------------- |
---|
31 | state = 'western_australia' |
---|
32 | scenario_name = 'dampier_tsunami' |
---|
33 | scenario_datas_name = 'dampier_tsunami_scenario_2006' #name of the directory where the data is stored |
---|
34 | #scenario_datas_name = 'karratha_tsunami_scenario_2005' # Tmp location |
---|
35 | |
---|
36 | #mesh_name = 'elevation50m' |
---|
37 | boundary_name = 'dampier9_1' |
---|
38 | boundary_source = 'mag_9a' |
---|
39 | |
---|
40 | # topography file names |
---|
41 | onshore_name = 'dli_no_islands' |
---|
42 | coast_name = 'DTED_05_Contour' |
---|
43 | islands_name = 'dted_islands' |
---|
44 | offshore_name = 'XY100003902' |
---|
45 | offshore_name1 = 'XY100003903' |
---|
46 | offshore_name2 = 'XY100003951' |
---|
47 | offshore_name3 = 'XY100006321' |
---|
48 | offshore_name4 = 'XY100011756' |
---|
49 | offshore_name5 = 'XY100014243' |
---|
50 | offshore_name6 = 'XY100014244' |
---|
51 | offshore_name7 = 'XY100021081' |
---|
52 | offshore_name8 = 'XY100021082' |
---|
53 | offshore_name9 = 'XY100021083' |
---|
54 | offshore_name10 = 'XY100021085' |
---|
55 | offshore_name11 = 'XY100021086' |
---|
56 | offshore_name12 = 'XY100026309' |
---|
57 | offshore_name13 = 'XY100026338' |
---|
58 | offshore_name14 = 'XYDM83' |
---|
59 | |
---|
60 | combined_name ='dampier_combined_elevation' |
---|
61 | |
---|
62 | |
---|
63 | |
---|
64 | #Derive subdirectories and filenames |
---|
65 | |
---|
66 | meshes_dir = home+sep+state+sep+scenario_datas_name+sep+'anuga'+sep+'meshes'+sep |
---|
67 | topographies_dir = home+sep+state+sep+scenario_datas_name+sep+'anuga'+sep+'topographies'+sep |
---|
68 | gauges_dir = home+sep+state+sep+scenario_datas_name+sep+'anuga'+sep+'gauges'+sep |
---|
69 | polygons_dir = home+sep+state+sep+scenario_datas_name+sep+'anuga'+sep+'polygons'+sep |
---|
70 | boundaries_dir = home+sep+state+sep+scenario_datas_name+sep+'anuga'+sep+'boundaries'+sep+'urs'+sep+boundary_source+sep |
---|
71 | #outputdir = home+sep+state+sep+scenario_datas_name+sep+'anuga'+sep+'output'+sep |
---|
72 | tide_dir = home+sep+state+sep+scenario_datas_name+sep+'anuga'+sep+'tide_data'+sep |
---|
73 | |
---|
74 | time = strftime('%Y%m%d_%H%M%S',localtime()) #gets time for new dir |
---|
75 | |
---|
76 | output_time_dir = home+sep+state+sep+scenario_datas_name+sep+'anuga'+sep+'outputs'+sep+time+sep |
---|
77 | topographies_time_dir = home+sep+state+sep+scenario_datas_name+sep+'anuga'+sep+'topographies'+sep+time+sep |
---|
78 | boundaries_time_dir = home+sep+state+sep+scenario_datas_name+sep+'anuga'+sep+'boundaries'+sep+time+sep |
---|
79 | |
---|
80 | |
---|
81 | |
---|
82 | #gauge_filename = gaugedir + 'gauge_location_broome.csv' |
---|
83 | |
---|
84 | onshore_dir_name = topographies_dir + onshore_name |
---|
85 | coast_dir_name = topographies_dir + coast_name |
---|
86 | islands_dir_name = topographies_dir + islands_name |
---|
87 | offshore_dir_name = topographies_dir + offshore_name |
---|
88 | offshore_dir_name1 = topographies_dir + offshore_name1 |
---|
89 | offshore_dir_name2 = topographies_dir + offshore_name2 |
---|
90 | offshore_dir_name3 = topographies_dir + offshore_name3 |
---|
91 | offshore_dir_name4 = topographies_dir + offshore_name4 |
---|
92 | offshore_dir_name5 = topographies_dir + offshore_name5 |
---|
93 | offshore_dir_name6 = topographies_dir + offshore_name6 |
---|
94 | offshore_dir_name7 = topographies_dir + offshore_name7 |
---|
95 | offshore_dir_name8 = topographies_dir + offshore_name8 |
---|
96 | offshore_dir_name9 = topographies_dir + offshore_name9 |
---|
97 | offshore_dir_name10 = topographies_dir + offshore_name10 |
---|
98 | offshore_dir_name11 = topographies_dir + offshore_name11 |
---|
99 | offshore_dir_name12 = topographies_dir + offshore_name12 |
---|
100 | offshore_dir_name13 = topographies_dir + offshore_name13 |
---|
101 | offshore_dir_name14 = topographies_dir + offshore_name14 |
---|
102 | |
---|
103 | combined_dir_name = topographies_dir + combined_name |
---|
104 | |
---|
105 | mesh_dir_name = meshes_dir + scenario_name |
---|
106 | output_dir_name = output_time_dir + scenario_name #Used by post processing |
---|
107 | boundary_dir_name = boundaries_dir + boundary_name #Used by post processing |
---|
108 | |
---|
109 | |
---|
110 | # Regions |
---|
111 | |
---|
112 | refzone = 50 |
---|
113 | south = degminsec2decimal_degrees(-20,55,0) |
---|
114 | north = degminsec2decimal_degrees(-20,15,0) |
---|
115 | west = degminsec2decimal_degrees(116,17,0) |
---|
116 | east = degminsec2decimal_degrees(117,10,0) |
---|
117 | |
---|
118 | #only used to clip boundary condition |
---|
119 | north_boundary = north + 0.05 |
---|
120 | south_boundary = south - 0.05 |
---|
121 | west_boundary = west - 0.05 |
---|
122 | east_boundary = east + 0.05 |
---|
123 | |
---|
124 | |
---|
125 | p0 = [south, degminsec2decimal_degrees(116,32,0)] |
---|
126 | p1 = [south, west] |
---|
127 | p2 = [degminsec2decimal_degrees(-20,23,0), west] |
---|
128 | p3 = [north, degminsec2decimal_degrees(116,45,0)] |
---|
129 | p4 = [north, degminsec2decimal_degrees(117,0,0)] |
---|
130 | p5 = [p2[0], degminsec2decimal_degrees(117,8,0)] |
---|
131 | p6 = [degminsec2decimal_degrees(-20,30,0), east] |
---|
132 | p7 = [degminsec2decimal_degrees(-20,38,0), east] |
---|
133 | p8 = [south, east] |
---|
134 | |
---|
135 | bounding_polygon, zone =\ |
---|
136 | convert_from_latlon_to_utm([p0, p1, p2, p3, p4, |
---|
137 | p5, p6, p7, p8]) |
---|
138 | refzone = zone |
---|
139 | |
---|
140 | |
---|
141 | #Interior regions |
---|
142 | |
---|
143 | # CIPMA point of interest |
---|
144 | cipma_latitude = -20.588456 |
---|
145 | cipma_longitude = 116.771527 |
---|
146 | |
---|
147 | |
---|
148 | k0 = [cipma_latitude-0.02, cipma_longitude-0.02] |
---|
149 | k1 = [cipma_latitude-0.02, cipma_longitude+0.02] |
---|
150 | k2 = [cipma_latitude+0.02, cipma_longitude+0.02] |
---|
151 | k3 = [cipma_latitude+0.02, cipma_longitude-0.02] |
---|
152 | |
---|
153 | cipma_polygon, zone = convert_from_latlon_to_utm([k0, k1, k2, k3]) |
---|
154 | assert zone == refzone |
---|
155 | |
---|
156 | e_min_area = 474000 |
---|
157 | e_max_area = 480000 |
---|
158 | n_min_area = 7719000 |
---|
159 | n_max_area = 7725000 |
---|
160 | |
---|
161 | #Interior regions |
---|
162 | karratha_south = degminsec2decimal_degrees(-20,44,0) |
---|
163 | karratha_north = degminsec2decimal_degrees(-20,42,0) |
---|
164 | karratha_west = degminsec2decimal_degrees(116,48,0) |
---|
165 | karratha_east = degminsec2decimal_degrees(116,53,30) |
---|
166 | |
---|
167 | k0 = [karratha_south, karratha_west] |
---|
168 | k1 = [karratha_south, karratha_east] |
---|
169 | k2 = [karratha_north, karratha_east] |
---|
170 | k3 = [karratha_north, karratha_west] |
---|
171 | |
---|
172 | karratha_polygon, zone = convert_from_latlon_to_utm([k0, k1, k2, k3]) |
---|
173 | assert zone == refzone |
---|
174 | |
---|
175 | |
---|
176 | #Interior regions |
---|
177 | dampier_south = degminsec2decimal_degrees(-20,40,0) |
---|
178 | dampier_north = degminsec2decimal_degrees(-20,38,10) |
---|
179 | dampier_west = degminsec2decimal_degrees(116,43,0) |
---|
180 | dampier_east = degminsec2decimal_degrees(116,45,0) |
---|
181 | |
---|
182 | d0 = [dampier_south, dampier_west] |
---|
183 | d1 = [dampier_south, dampier_east] |
---|
184 | d2 = [dampier_north, dampier_east] |
---|
185 | d3 = [dampier_north, dampier_west] |
---|
186 | |
---|
187 | dampier_polygon, zone = convert_from_latlon_to_utm([d0, d1, d2, d3]) |
---|
188 | assert zone == refzone |
---|
189 | |
---|
190 | |
---|
191 | #Interior regions |
---|
192 | refinery_south = degminsec2decimal_degrees(-20,37,50) |
---|
193 | refinery_north = degminsec2decimal_degrees(-20,36,0) |
---|
194 | refinery_west = degminsec2decimal_degrees(116,44,0) |
---|
195 | refinery_east = degminsec2decimal_degrees(116,46,10) |
---|
196 | |
---|
197 | d0 = [refinery_south, refinery_west] |
---|
198 | d1 = [refinery_south, refinery_east] |
---|
199 | d2 = [refinery_north, refinery_east] |
---|
200 | d3 = [refinery_north, refinery_west] |
---|
201 | |
---|
202 | refinery_polygon, zone = convert_from_latlon_to_utm([d0, d1, d2, d3]) |
---|
203 | assert zone == refzone |
---|
204 | |
---|
205 | |
---|
206 | #Interior region around 468899, 7715177: |
---|
207 | #lat (-20, 39, 44.93753), lon (116, 42, 5.09106) |
---|
208 | |
---|
209 | point_south = degminsec2decimal_degrees(-20,39,46) |
---|
210 | point_north = degminsec2decimal_degrees(-20,39,42) |
---|
211 | point_west = degminsec2decimal_degrees(116,42,0) |
---|
212 | point_east = degminsec2decimal_degrees(116,42,10) |
---|
213 | |
---|
214 | d0 = [point_south, point_west] |
---|
215 | d1 = [point_south, point_east] |
---|
216 | d2 = [point_north, point_east] |
---|
217 | d3 = [point_north, point_west] |
---|
218 | |
---|
219 | point_polygon, zone = convert_from_latlon_to_utm([d0, d1, d2, d3]) |
---|
220 | assert zone == refzone |
---|
221 | |
---|
222 | |
---|
223 | #Neils areas around interesting points |
---|
224 | neil1_point1 = [degminsec2decimal_degrees(-20,35,34), |
---|
225 | degminsec2decimal_degrees(116,45,18)] |
---|
226 | neil1_point2 = [degminsec2decimal_degrees(-20,36,15), |
---|
227 | degminsec2decimal_degrees(116,46,18)] |
---|
228 | neil1_point3 = [degminsec2decimal_degrees(-20,35,9), |
---|
229 | degminsec2decimal_degrees(116,47,17)] |
---|
230 | neil1_point4 = [degminsec2decimal_degrees(-20,34,26), |
---|
231 | degminsec2decimal_degrees(116,46,17)] |
---|
232 | |
---|
233 | neil1_polygon, zone = convert_from_latlon_to_utm([neil1_point1, |
---|
234 | neil1_point2, |
---|
235 | neil1_point3, |
---|
236 | neil1_point4]) |
---|
237 | assert zone == refzone |
---|
238 | |
---|
239 | |
---|
240 | |
---|
241 | |
---|
242 | neil2_point1 = [degminsec2decimal_degrees(-20,39,36), |
---|
243 | degminsec2decimal_degrees(116,41,33)] |
---|
244 | neil2_point2 = [degminsec2decimal_degrees(-20,40,10), |
---|
245 | degminsec2decimal_degrees(116,42,13)] |
---|
246 | neil2_point3 = [degminsec2decimal_degrees(-20,38,39), |
---|
247 | degminsec2decimal_degrees(116,43,49)] |
---|
248 | neil2_point4 = [degminsec2decimal_degrees(-20,38,5), |
---|
249 | degminsec2decimal_degrees(116,43,9)] |
---|
250 | |
---|
251 | neil2_polygon, zone = convert_from_latlon_to_utm([neil2_point1, |
---|
252 | neil2_point2, |
---|
253 | neil2_point3, |
---|
254 | neil2_point4]) |
---|
255 | assert zone == refzone |
---|
256 | |
---|
257 | |
---|
258 | |
---|
259 | |
---|
260 | |
---|
261 | #Withnell bay |
---|
262 | wb_point1 = [degminsec2decimal_degrees(-20,35,34), |
---|
263 | degminsec2decimal_degrees(116,45,18)] |
---|
264 | wb_point2 = [degminsec2decimal_degrees(-20,36,15), |
---|
265 | degminsec2decimal_degrees(116,46,18)] |
---|
266 | wb_point3 = [degminsec2decimal_degrees(-20,35,9), |
---|
267 | degminsec2decimal_degrees(116,47,17)] |
---|
268 | wb_point4 = [degminsec2decimal_degrees(-20,34,26), |
---|
269 | degminsec2decimal_degrees(116,46,17)] |
---|
270 | |
---|
271 | wb_polygon, zone = convert_from_latlon_to_utm([wb_point1, wb_point2, |
---|
272 | wb_point3, wb_point4]) |
---|
273 | assert zone == refzone |
---|
274 | |
---|
275 | |
---|
276 | |
---|
277 | |
---|
278 | |
---|
279 | #Larger Withnell bay |
---|
280 | lwb_point1 = [degminsec2decimal_degrees(-20,35,59), |
---|
281 | degminsec2decimal_degrees(116,42,00)] |
---|
282 | lwb_point2 = [degminsec2decimal_degrees(-20,36,50), |
---|
283 | degminsec2decimal_degrees(116,46,50)] |
---|
284 | lwb_point3 = [degminsec2decimal_degrees(-20,34,00), |
---|
285 | degminsec2decimal_degrees(116,47,39)] |
---|
286 | lwb_point4 = [degminsec2decimal_degrees(-20,33,00), |
---|
287 | degminsec2decimal_degrees(116,42,50)] |
---|
288 | |
---|
289 | lwb_polygon, zone = convert_from_latlon_to_utm([lwb_point1, lwb_point2, |
---|
290 | lwb_point3, lwb_point4]) |
---|
291 | |
---|
292 | assert zone == refzone |
---|
293 | |
---|
294 | |
---|
295 | |
---|
296 | |
---|