source: anuga_work/production/dampier_2006/project.py @ 4063

Last change on this file since 4063 was 4063, checked in by sexton, 18 years ago

updates for nsw slide modelling and cairns demo

File size: 12.7 KB
Line 
1"""Common filenames and locations for topographic data, meshes and outputs.
2"""
3
4import sys
5from os import sep, environ, getenv, getcwd
6from os.path import expanduser, basename
7
8from anuga.coordinate_transforms.redfearn import\
9     degminsec2decimal_degrees,\
10     convert_from_latlon_to_utm
11
12from time import localtime, strftime, gmtime, ctime
13from anuga.geospatial_data.geospatial_data import *
14from anuga.utilities.polygon import read_polygon, plot_polygons, polygon_area
15from anuga.utilities.system_tools import get_user_name
16
17# file and system info
18#---------------------------------
19codename = 'project.py'
20
21home = getenv('INUNDATIONHOME') #Sandpit's parent dir   
22user = get_user_name()
23
24# INUNDATIONHOME is the inundation directory, not the data directory.
25home += sep +'data'
26#----------------------------------
27# Location and naming of scenario data
28#----------------------------------
29state = 'western_australia'
30scenario_name = 'dampier_tsunami'
31scenario_datas_name = 'dampier_tsunami_scenario_2006'  #name of the directory where the data is stored
32#scenario_datas_name = 'karratha_tsunami_scenario_2005' # Tmp location
33
34#mesh_name = 'elevation50m'
35boundaries_name = 'dampier'
36boundaries_source = 'mag_9_corrected'
37#boundaries_source = 'test'
38
39tide = 2.4
40#tide = 0.0
41
42# topography file names
43onshore_name = 'dli_no_islands'
44coast_name = 'DTED_05_Contour'
45islands_name = 'dted_islands'
46offshore_name = 'XY100003902'
47offshore_name1 = 'XY100003903'
48offshore_name2 = 'XY100003951'
49offshore_name3 = 'XY100006321'
50offshore_name4 = 'XY100011756'
51offshore_name5 = 'XY100014243'
52offshore_name6 = 'XY100014244'
53offshore_name7 = 'XY100021081'
54offshore_name8 = 'XY100021082'
55offshore_name9 = 'XY100021083'
56offshore_name10 = 'XY100021085'
57offshore_name11 = 'XY100021086'
58offshore_name12 = 'XY100026309'
59offshore_name13 = 'XY100026338'
60offshore_name14 = 'XYDM83'
61
62offshore_old = 'elevation50m'
63
64combined_name ='dampier_combined_elevation'
65combined_final_name ='dampier_combined_elevation_final'
66
67gauge_name = 'dampier_gauges_up2.csv'
68
69#Derive subdirectories and filenames
70
71meshes_dir = home+sep+state+sep+scenario_datas_name+sep+'anuga'+sep+'meshes'+sep
72topographies_dir = home+sep+state+sep+scenario_datas_name+sep+'anuga'+sep+'topographies'+sep
73gauges_dir = home+sep+state+sep+scenario_datas_name+sep+'anuga'+sep+'gauges'+sep
74polygons_dir = home+sep+state+sep+scenario_datas_name+sep+'anuga'+sep+'polygons'+sep
75boundaries_in_dir = home+sep+state+sep+scenario_datas_name+sep+'anuga'+sep+'boundaries'+sep+'urs'+sep+boundaries_source+sep
76#outputdir = home+sep+state+sep+scenario_datas_name+sep+'anuga'+sep+'output'+sep
77tide_dir = home+sep+state+sep+scenario_datas_name+sep+'anuga'+sep+'tide_data'+sep
78
79time = strftime('%Y%m%d_%H%M%S',localtime()) #gets time for new dir
80gtime = strftime('%Y%m%d_%H%M%S',gmtime()) #gets time for new dir
81#cctime = strftime('%Y%m%d_%H%M%S',ctime()) #gets time for new dir
82build_time = time+'_build'
83run_time = time+'_run'
84
85print 'gtime: ', gtime
86output_dir = home+sep+state+sep+scenario_datas_name+sep+'anuga'+sep+'outputs'+sep
87output_dir = home+sep+state+sep+scenario_datas_name+sep+'anuga'+sep+'outputs'+sep
88output_build_time_dir = home+sep+state+sep+scenario_datas_name+sep+'anuga'+sep+'outputs'+sep+build_time+sep
89output_run_time_dir = home+sep+state+sep+scenario_datas_name+sep+'anuga'+sep+'outputs'+sep+run_time+sep
90topographies_time_dir = topographies_dir+build_time+sep
91boundaries_dir = home+sep+state+sep+scenario_datas_name+sep+'anuga'+sep+'boundaries'+sep
92boundaries_time_dir = home+sep+state+sep+scenario_datas_name+sep+'anuga'+sep+'boundaries'+sep+build_time+sep
93meshes_time_dir = meshes_dir+build_time+sep
94
95#ideas
96#boundaries_time_dir = boundaries_in_dir+'urs'+sep+boundaries_source+sep
97
98gauge_dir = home+sep+state+sep+scenario_datas_name+sep+'anuga'+sep+'gauges'+sep
99gauge_filename = gauge_dir + 'dampier_gauges_up2.csv'
100
101gauges_dir_name = gauges_dir + gauge_name
102
103onshore_dir_name = topographies_dir + onshore_name
104coast_dir_name = topographies_dir + coast_name
105islands_dir_name = topographies_dir + islands_name
106offshore_dir_name = topographies_dir + offshore_name
107offshore_dir_name1 = topographies_dir + offshore_name1
108offshore_dir_name2 = topographies_dir + offshore_name2
109offshore_dir_name3 = topographies_dir + offshore_name3
110offshore_dir_name4 = topographies_dir + offshore_name4
111offshore_dir_name5 = topographies_dir + offshore_name5
112offshore_dir_name6 = topographies_dir + offshore_name6
113offshore_dir_name7 = topographies_dir + offshore_name7
114offshore_dir_name8 = topographies_dir + offshore_name8
115offshore_dir_name9 = topographies_dir + offshore_name9
116offshore_dir_name10 = topographies_dir + offshore_name10
117offshore_dir_name11 = topographies_dir + offshore_name11
118offshore_dir_name12 = topographies_dir + offshore_name12
119offshore_dir_name13 = topographies_dir + offshore_name13
120offshore_dir_name14 = topographies_dir + offshore_name14
121
122offshore_dir_name_old = topographies_dir + offshore_old
123
124
125
126#output dir
127combined_dir_name = topographies_dir + combined_name
128combined_time_dir_name = topographies_time_dir + combined_name
129combined_time_dir_final_name = topographies_time_dir + combined_final_name
130
131
132meshes_dir_name = meshes_dir + scenario_name
133meshes_time_dir_name = meshes_time_dir + scenario_name
134#output_build_time_dir_name = output_build_time_dir + scenario_name  #Used by post processing
135output_run_time_dir_name = output_run_time_dir + scenario_name  #Used by post processing
136boundaries_in_dir_name = boundaries_in_dir + boundaries_name
137boundaries_time_dir_name = boundaries_time_dir + boundaries_name  #Used by post processing
138boundaries_dir_name = boundaries_dir + boundaries_name
139
140
141
142# Regions
143
144refzone = 50 
145south = degminsec2decimal_degrees(-20,55,0)
146north = degminsec2decimal_degrees(-20,15,0)
147#north = degminsec2decimal_degrees(-19,15,0)
148west = degminsec2decimal_degrees(116,17,0)
149east = degminsec2decimal_degrees(117,10,0)
150
151#only used to clip boundary condition
152#north_boundary = north + 0.02
153#south_boundary = south - 0.02
154#west_boundary = west - 0.02
155#east_boundary = east + 0.02
156
157south_boundary = degminsec2decimal_degrees(-21,0,0)
158#north_boundary = degminsec2decimal_degrees(-19,00,0)
159north_boundary = degminsec2decimal_degrees(-20,10,0)
160#west_boundary = degminsec2decimal_degrees(116,0,0)
161#east_boundary = degminsec2decimal_degrees(118,00,0)
162west_boundary = degminsec2decimal_degrees(116,10,0)
163east_boundary = degminsec2decimal_degrees(117,15,0)
164
165
166p0 = [south, degminsec2decimal_degrees(116,32,0)]
167p1 = [south, west]
168p2 = [degminsec2decimal_degrees(-20,23,0), west]
169p3 = [north, degminsec2decimal_degrees(116,45,0)]
170p4 = [north, degminsec2decimal_degrees(117,0,0)]
171p5 = [p2[0], degminsec2decimal_degrees(117,8,0)]
172p6 = [degminsec2decimal_degrees(-20,30,0), east]
173p7 = [degminsec2decimal_degrees(-20,38,0), east]
174p8 = [south, east]
175
176bounding_polygon, zone =\
177                  convert_from_latlon_to_utm([p0, p1, p2, p3, p4, p5, p6, p7, p8])
178#bounding_polygon, zone =\
179#                  convert_from_latlon_to_utm([p1, p2, p3, p4, p5, p6, p7])
180refzone = zone
181from anuga.utilities.polygon import read_polygon, plot_polygons, polygon_area, is_inside_polygon
182print 'poly area', polygon_area(bounding_polygon)/1000000.0
183
184#Interior regions
185
186# CIPMA point of interest
187cipma_latitude = -20.588456
188cipma_longitude = 116.771527
189
190
191k0 = [cipma_latitude-0.02, cipma_longitude-0.02]
192k1 = [cipma_latitude-0.02, cipma_longitude+0.02]
193k2 = [cipma_latitude+0.02, cipma_longitude+0.02]
194k3 = [cipma_latitude+0.02, cipma_longitude-0.02]
195
196cipma_polygon, zone = convert_from_latlon_to_utm([k0, k1, k2, k3])
197assert zone == refzone
198
199e_min_area = 474000
200e_max_area = 480000
201n_min_area = 7719000
202n_max_area = 7725000
203
204e_min_area_mom = 442200
205e_max_area_mom = 497028
206n_min_area_mom = 7720095
207n_max_area_mom = 7750500
208
209poly_facility = read_polygon(polygons_dir+'facility.csv')
210
211poly_pipeline = read_polygon(polygons_dir+'pipeline2.csv')
212
213poly_interior = read_polygon(polygons_dir+'interior.csv')
214
215poly_coast = read_polygon(polygons_dir+'coast_final.csv')
216
217clip_poly_e = read_polygon(polygons_dir+'gap_e.csv')
218
219clip_poly_nw = read_polygon(polygons_dir+'gap_nw.csv')
220
221clip_poly_mid_w = read_polygon(polygons_dir+'gap_mid_w.cvs')
222
223clip_poly_mid_e = read_polygon(polygons_dir+'gap_mid_e.cvs')
224
225plot_polygons([bounding_polygon,poly_facility,poly_pipeline,poly_interior,poly_coast],'polys',verbose=True)
226#Interior regions
227karratha_south = degminsec2decimal_degrees(-20,44,0)
228karratha_north = degminsec2decimal_degrees(-20,42,0)
229karratha_west = degminsec2decimal_degrees(116,48,0)
230karratha_east = degminsec2decimal_degrees(116,53,30)
231
232k0 = [karratha_south, karratha_west]
233k1 = [karratha_south, karratha_east]
234k2 = [karratha_north, karratha_east]
235k3 = [karratha_north, karratha_west]   
236
237karratha_polygon, zone = convert_from_latlon_to_utm([k0, k1, k2, k3])
238assert zone == refzone
239
240
241#Interior regions
242dampier_south = degminsec2decimal_degrees(-20,40,0)
243dampier_north = degminsec2decimal_degrees(-20,38,10)
244dampier_west = degminsec2decimal_degrees(116,43,0)
245dampier_east = degminsec2decimal_degrees(116,45,0)
246
247d0 = [dampier_south, dampier_west]
248d1 = [dampier_south, dampier_east]
249d2 = [dampier_north, dampier_east]
250d3 = [dampier_north, dampier_west]   
251
252dampier_polygon, zone = convert_from_latlon_to_utm([d0, d1, d2, d3])
253assert zone == refzone
254
255
256#Interior regions
257refinery_south = degminsec2decimal_degrees(-20,37,50)
258refinery_north = degminsec2decimal_degrees(-20,36,0)
259refinery_west = degminsec2decimal_degrees(116,44,0)
260refinery_east = degminsec2decimal_degrees(116,46,10)
261
262d0 = [refinery_south, refinery_west]
263d1 = [refinery_south, refinery_east]
264d2 = [refinery_north, refinery_east]
265d3 = [refinery_north, refinery_west]   
266
267refinery_polygon, zone = convert_from_latlon_to_utm([d0, d1, d2, d3])
268assert zone == refzone
269
270
271#Interior region around 468899, 7715177:
272#lat (-20, 39, 44.93753), lon (116, 42, 5.09106)
273
274point_south = degminsec2decimal_degrees(-20,39,46)
275point_north = degminsec2decimal_degrees(-20,39,42)
276point_west = degminsec2decimal_degrees(116,42,0)
277point_east = degminsec2decimal_degrees(116,42,10)
278
279d0 = [point_south, point_west]
280d1 = [point_south, point_east]
281d2 = [point_north, point_east]
282d3 = [point_north, point_west]   
283
284point_polygon, zone = convert_from_latlon_to_utm([d0, d1, d2, d3])
285assert zone == refzone
286
287
288#Neils areas around interesting points
289neil1_point1 = [degminsec2decimal_degrees(-20,35,34),
290                degminsec2decimal_degrees(116,45,18)]
291neil1_point2 = [degminsec2decimal_degrees(-20,36,15),
292                degminsec2decimal_degrees(116,46,18)]
293neil1_point3 = [degminsec2decimal_degrees(-20,35,9),
294                degminsec2decimal_degrees(116,47,17)]
295neil1_point4 = [degminsec2decimal_degrees(-20,34,26),
296                degminsec2decimal_degrees(116,46,17)]
297
298neil1_polygon, zone = convert_from_latlon_to_utm([neil1_point1,
299                                                  neil1_point2,
300                                                  neil1_point3,
301                                                  neil1_point4])
302assert zone == refzone
303
304
305
306
307neil2_point1 = [degminsec2decimal_degrees(-20,39,36),
308                degminsec2decimal_degrees(116,41,33)]
309neil2_point2 = [degminsec2decimal_degrees(-20,40,10),
310                degminsec2decimal_degrees(116,42,13)]
311neil2_point3 = [degminsec2decimal_degrees(-20,38,39),
312                degminsec2decimal_degrees(116,43,49)]
313neil2_point4 = [degminsec2decimal_degrees(-20,38,5),
314                degminsec2decimal_degrees(116,43,9)]
315
316neil2_polygon, zone = convert_from_latlon_to_utm([neil2_point1,
317                                                  neil2_point2,
318                                                  neil2_point3,
319                                                  neil2_point4])
320assert zone == refzone
321
322
323
324
325
326#Withnell bay
327wb_point1 = [degminsec2decimal_degrees(-20,35,34),
328                degminsec2decimal_degrees(116,45,18)]
329wb_point2 = [degminsec2decimal_degrees(-20,36,15),
330                degminsec2decimal_degrees(116,46,18)]
331wb_point3 = [degminsec2decimal_degrees(-20,35,9),
332                degminsec2decimal_degrees(116,47,17)]
333wb_point4 = [degminsec2decimal_degrees(-20,34,26),
334                degminsec2decimal_degrees(116,46,17)]
335
336wb_polygon, zone = convert_from_latlon_to_utm([wb_point1, wb_point2,
337                                               wb_point3, wb_point4])
338assert zone == refzone
339
340
341
342
343
344#Larger Withnell bay
345lwb_point1 = [degminsec2decimal_degrees(-20,35,59),
346                degminsec2decimal_degrees(116,42,00)]
347lwb_point2 = [degminsec2decimal_degrees(-20,36,50),
348                degminsec2decimal_degrees(116,46,50)]
349lwb_point3 = [degminsec2decimal_degrees(-20,34,00),
350                degminsec2decimal_degrees(116,47,39)]
351lwb_point4 = [degminsec2decimal_degrees(-20,33,00),
352                degminsec2decimal_degrees(116,42,50)]
353
354lwb_polygon, zone = convert_from_latlon_to_utm([lwb_point1, lwb_point2,
355                                                lwb_point3, lwb_point4])
356                                                     
357assert zone == refzone
358
359
360
361
Note: See TracBrowser for help on using the repository browser.