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

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

update Dampier script to incorporate setting stage to 0 onshore and tide offshore

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