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

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

minor updates to Dampier

File size: 11.8 KB
Line 
1"""Common filenames and locations for topographic data, meshes and outputs.
2"""
3
4from os import sep, environ, getenv, getcwd
5from os.path import expanduser
6import sys
7from time import localtime, strftime, gmtime
8from anuga.utilities.polygon import read_polygon, plot_polygons, polygon_area, is_inside_polygon, number_mesh_triangles
9from anuga.coordinate_transforms.redfearn import degminsec2decimal_degrees, convert_points_from_latlon_to_utm
10from anuga.utilities.system_tools import get_user_name
11
12# file and system info
13#---------------------------------
14codename = 'project.py'
15
16home = getenv('INUNDATIONHOME') #Sandpit's parent dir   
17user = get_user_name()
18
19# INUNDATIONHOME is the inundation directory, not the data directory.
20home += sep +'data'
21
22#time stuff
23time = strftime('%Y%m%d_%H%M%S',localtime()) #gets time for new dir
24gtime = strftime('%Y%m%d_%H%M%S',gmtime()) #gets time for new dir
25build_time = time+'_build'
26run_time = time+'_run'
27print 'gtime: ', gtime
28
29tide = 0.6
30
31#Making assumptions about the location of scenario data
32state = 'western_australia'
33scenario_name = 'dampier'
34scenario = 'dampier_tsunami_scenario_2006'
35
36# onshore data provided by WA DLI
37onshore_name = 'dampier_dli_ext' # original
38
39# AHO + DPI data + colin French coastline
40coast_name = 'waterline'
41offshore_name = 'dampier_bathymetry'
42offshore1_name = 'nickelbay'
43offshore2_name = 'tinclip'
44
45#final topo name
46combined_name ='dampier_combined_elevation'
47combined_smaller_name = 'dampier_combined_elevation_smaller'
48
49topographies_in_dir = home+sep+state+sep+scenario+sep+'elevation_final'+sep+'points'+sep
50topographies_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'topographies'+sep
51topographies_time_dir = topographies_dir+build_time+sep
52
53# input topo file location
54onshore_in_dir_name = topographies_in_dir + onshore_name
55coast_in_dir_name = topographies_in_dir + coast_name
56offshore_in_dir_name = topographies_in_dir + offshore_name
57offshore1_in_dir_name = topographies_in_dir + offshore1_name
58offshore2_in_dir_name = topographies_in_dir + offshore2_name
59
60onshore_dir_name = topographies_dir + onshore_name
61coast_dir_name = topographies_dir + coast_name
62offshore_dir_name = topographies_dir + offshore_name
63offshore1_dir_name = topographies_dir + offshore1_name
64offshore2_dir_name = topographies_dir + offshore2_name
65
66#final topo files
67combined_dir_name = topographies_dir + combined_name
68combined_time_dir_name = topographies_time_dir + combined_name
69combined_smaller_name_dir = topographies_dir + combined_smaller_name
70#combined_time_dir_final_name = topographies_time_dir + combined_final_name
71
72meshes_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'meshes'+sep
73meshes_dir_name = meshes_dir + scenario_name
74
75polygons_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'polygons'+sep
76tide_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'tide_data'+sep
77
78boundaries_source = '????'
79#boundaries locations
80boundaries_in_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'boundaries'+sep+'urs'+sep+boundaries_source+sep
81boundaries_in_dir_name = boundaries_in_dir + scenario_name
82boundaries_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'boundaries'+sep
83boundaries_dir_name = boundaries_dir + scenario_name
84#boundaries_time_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'boundaries'+sep+build_time+sep
85#boundaries_time_dir_name = boundaries_time_dir + boundaries_name  #Used by post processing
86
87#output locations
88output_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'outputs'+sep
89output_build_time_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'outputs'+sep+build_time+sep
90output_run_time_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'outputs'+sep+run_time+sep
91output_run_time_dir_name = output_run_time_dir + scenario_name  #Used by post processing
92
93#gauges
94gauge_name = 'dampier.csv'
95gauges_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'gauges'+sep
96gauges_dir_name = gauges_dir + gauge_name
97
98
99###############################
100# Domain definitions
101###############################
102
103refzone = 50 
104south = degminsec2decimal_degrees(-20,55,0)
105north = degminsec2decimal_degrees(-20,15,0)
106west = degminsec2decimal_degrees(116,17,0)
107east = degminsec2decimal_degrees(117,10,0)
108
109p0 = [south, degminsec2decimal_degrees(116,32,0)]
110p1 = [south, west]
111p2 = [degminsec2decimal_degrees(-20,23,0), west]
112p3 = [north, degminsec2decimal_degrees(116,45,0)]
113p4 = [north, degminsec2decimal_degrees(117,0,0)]
114p5 = [p2[0], degminsec2decimal_degrees(117,8,0)]
115p6 = [degminsec2decimal_degrees(-20,30,0), east]
116p7 = [degminsec2decimal_degrees(-20,38,0), east]
117p8 = [south, east]
118
119poly_all, zone = convert_from_latlon_to_utm([p0, p1, p2, p3, p4, p5, p6, p7, p8])
120refzone = zone
121print 'Area of bounding polygon', polygon_area(poly_all)/1000000.0
122
123res_poly_all = 100000
124
125###############################
126# Interior region definitions
127###############################
128
129poly_pos20_neg20 = read_polygon(polygons_dir+'pos20_neg20_pts.csv')
130res_pos20_neg20 = 20000
131
132poly_dampier = read_polygon(polygons_dir+'dampier_pts.csv')
133res_dampier = 500
134
135poly_karratha = read_polygon(polygons_dir+'karratha_pts.csv')
136res_karratha = 500
137
138poly_delambre = read_polygon(polygons_dir+'delambre_pts.csv')
139res_delambre = 1000
140
141poly_mainisland = read_polygon(polygons_dir+'mainisland_pts.csv')
142res_mainisland = 1000
143
144poly_NWislands = read_polygon(polygons_dir+'NWislands_pts.csv')
145res_NWislands = 1000
146
147plot_polygons([poly_pos20_neg20,poly_dampier,poly_karratha,poly_delambre,polylmainisland,
148               polyNWislands,poly_all],output_run_time_dir + 'poly_pic')
149
150interior_regions = [[poly_pos20_neg20,res_pos20_neg20],[poly_dampier,res_dampier],
151                    [poly_karratha,res_karratha],[poly_delambre,res_delambre],
152                    [poly_mainisland,res_mainisland],[poly_NWislands,res_NWislands]]
153                   
154trigs_min = number_mesh_triangles(interior_regions, poly_all, res_poly_all)
155
156print 'min number triangles', trigs_min
157
158###################################################################
159# Clipping regions for export to asc and regions for clipping data
160###################################################################
161
162poly_bathy = read_polygon(polygons_dir+'polybathy.csv')
163
164# exporting asc grid - Dampier
165e_min_area = 474000
166e_max_area = 480000
167n_min_area = 7719000
168n_max_area = 7725000
169
170# exporting asc grid - Karratha
171e_min_area = 
172e_max_area = 
173n_min_area = 
174n_max_area = 
175
176"""
177# used in the CIPMA 2006 scenario
178# CIPMA point of interest
179cipma_latitude = -20.588456
180cipma_longitude = 116.771527
181
182k0 = [cipma_latitude-0.02, cipma_longitude-0.02]
183k1 = [cipma_latitude-0.02, cipma_longitude+0.02]
184k2 = [cipma_latitude+0.02, cipma_longitude+0.02]
185k3 = [cipma_latitude+0.02, cipma_longitude-0.02]
186
187cipma_polygon, zone = convert_from_latlon_to_utm([k0, k1, k2, k3])
188assert zone == refzone
189
190poly_facility = read_polygon(polygons_dir+'facility.csv')
191poly_pipeline = read_polygon(polygons_dir+'pipeline2.csv')
192poly_interior = read_polygon(polygons_dir+'interior.csv')
193poly_coast = read_polygon(polygons_dir+'coast_final.csv')
194clip_poly_e = read_polygon(polygons_dir+'gap_e.csv')
195clip_poly_nw = read_polygon(polygons_dir+'gap_nw.csv')
196clip_poly_mid_w = read_polygon(polygons_dir+'gap_mid_w.cvs')
197clip_poly_mid_e = read_polygon(polygons_dir+'gap_mid_e.cvs')
198
199# exporting asc grid
200e_min_area = 474000
201e_max_area = 480000
202n_min_area = 7719000
203n_max_area = 7725000
204
205# used in the original 2005 scenario
206#Interior regions
207karratha_south = degminsec2decimal_degrees(-20,44,0)
208karratha_north = degminsec2decimal_degrees(-20,42,0)
209karratha_west = degminsec2decimal_degrees(116,48,0)
210karratha_east = degminsec2decimal_degrees(116,53,30)
211
212k0 = [karratha_south, karratha_west]
213k1 = [karratha_south, karratha_east]
214k2 = [karratha_north, karratha_east]
215k3 = [karratha_north, karratha_west]   
216
217karratha_polygon, zone = convert_from_latlon_to_utm([k0, k1, k2, k3])
218assert zone == refzone
219
220#Interior regions
221dampier_south = degminsec2decimal_degrees(-20,40,0)
222dampier_north = degminsec2decimal_degrees(-20,38,10)
223dampier_west = degminsec2decimal_degrees(116,43,0)
224dampier_east = degminsec2decimal_degrees(116,45,0)
225
226d0 = [dampier_south, dampier_west]
227d1 = [dampier_south, dampier_east]
228d2 = [dampier_north, dampier_east]
229d3 = [dampier_north, dampier_west]   
230
231dampier_polygon, zone = convert_from_latlon_to_utm([d0, d1, d2, d3])
232assert zone == refzone
233
234#Interior regions
235refinery_south = degminsec2decimal_degrees(-20,37,50)
236refinery_north = degminsec2decimal_degrees(-20,36,0)
237refinery_west = degminsec2decimal_degrees(116,44,0)
238refinery_east = degminsec2decimal_degrees(116,46,10)
239
240d0 = [refinery_south, refinery_west]
241d1 = [refinery_south, refinery_east]
242d2 = [refinery_north, refinery_east]
243d3 = [refinery_north, refinery_west]   
244
245refinery_polygon, zone = convert_from_latlon_to_utm([d0, d1, d2, d3])
246assert zone == refzone
247
248#Interior region around 468899, 7715177:
249#lat (-20, 39, 44.93753), lon (116, 42, 5.09106)
250
251point_south = degminsec2decimal_degrees(-20,39,46)
252point_north = degminsec2decimal_degrees(-20,39,42)
253point_west = degminsec2decimal_degrees(116,42,0)
254point_east = degminsec2decimal_degrees(116,42,10)
255
256d0 = [point_south, point_west]
257d1 = [point_south, point_east]
258d2 = [point_north, point_east]
259d3 = [point_north, point_west]   
260
261point_polygon, zone = convert_from_latlon_to_utm([d0, d1, d2, d3])
262assert zone == refzone
263
264#Neils areas around interesting points
265neil1_point1 = [degminsec2decimal_degrees(-20,35,34),
266                degminsec2decimal_degrees(116,45,18)]
267neil1_point2 = [degminsec2decimal_degrees(-20,36,15),
268                degminsec2decimal_degrees(116,46,18)]
269neil1_point3 = [degminsec2decimal_degrees(-20,35,9),
270                degminsec2decimal_degrees(116,47,17)]
271neil1_point4 = [degminsec2decimal_degrees(-20,34,26),
272                degminsec2decimal_degrees(116,46,17)]
273
274neil1_polygon, zone = convert_from_latlon_to_utm([neil1_point1,
275                                                  neil1_point2,
276                                                  neil1_point3,
277                                                  neil1_point4])
278assert zone == refzone
279
280neil2_point1 = [degminsec2decimal_degrees(-20,39,36),
281                degminsec2decimal_degrees(116,41,33)]
282neil2_point2 = [degminsec2decimal_degrees(-20,40,10),
283                degminsec2decimal_degrees(116,42,13)]
284neil2_point3 = [degminsec2decimal_degrees(-20,38,39),
285                degminsec2decimal_degrees(116,43,49)]
286neil2_point4 = [degminsec2decimal_degrees(-20,38,5),
287                degminsec2decimal_degrees(116,43,9)]
288
289neil2_polygon, zone = convert_from_latlon_to_utm([neil2_point1,
290                                                  neil2_point2,
291                                                  neil2_point3,
292                                                  neil2_point4])
293assert zone == refzone
294
295#Withnell bay
296wb_point1 = [degminsec2decimal_degrees(-20,35,34),
297                degminsec2decimal_degrees(116,45,18)]
298wb_point2 = [degminsec2decimal_degrees(-20,36,15),
299                degminsec2decimal_degrees(116,46,18)]
300wb_point3 = [degminsec2decimal_degrees(-20,35,9),
301                degminsec2decimal_degrees(116,47,17)]
302wb_point4 = [degminsec2decimal_degrees(-20,34,26),
303                degminsec2decimal_degrees(116,46,17)]
304
305wb_polygon, zone = convert_from_latlon_to_utm([wb_point1, wb_point2,
306                                               wb_point3, wb_point4])
307assert zone == refzone
308
309#Larger Withnell bay
310lwb_point1 = [degminsec2decimal_degrees(-20,35,59),
311                degminsec2decimal_degrees(116,42,00)]
312lwb_point2 = [degminsec2decimal_degrees(-20,36,50),
313                degminsec2decimal_degrees(116,46,50)]
314lwb_point3 = [degminsec2decimal_degrees(-20,34,00),
315                degminsec2decimal_degrees(116,47,39)]
316lwb_point4 = [degminsec2decimal_degrees(-20,33,00),
317                degminsec2decimal_degrees(116,42,50)]
318
319lwb_polygon, zone = convert_from_latlon_to_utm([lwb_point1, lwb_point2,
320                                                lwb_point3, lwb_point4])
321                                                     
322assert zone == refzone
323"""
Note: See TracBrowser for help on using the repository browser.