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

Last change on this file since 4246 was 4246, checked in by nick, 18 years ago

updates to dampier

File size: 14.5 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_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 = 2.4
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 = 'DLI_DTED_raster_clipped' # original
38
39# AHO + DPI data + colin French coastline
40coast_name = 'coastline_edited_w_DEM'
41offshore_name = 'clipped_bathy'
42offshore1_name = 'elev_501'
43offshore2_name = 'inferrec_e'
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+'070112'+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+'2007polys'+sep
76tide_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'tide_data'+sep
77
78boundaries_source = ''
79boundaries_name = 'o'
80boundaries_name1 = 'o_new'
81
82#boundaries locations
83boundaries_in_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'boundaries'
84#boundaries_in_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'boundaries'+sep+'urs'+sep+'1_10000'+sep
85boundaries_in_dir_name = boundaries_in_dir + boundaries_name
86boundaries_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'boundaries'+sep
87boundaries_dir_name = boundaries_dir + boundaries_name
88boundaries_dir_name1 = boundaries_dir + boundaries_name1
89#boundaries_time_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'boundaries'+sep+build_time+sep
90#boundaries_time_dir_name = boundaries_time_dir + boundaries_name  #Used by post processing
91
92#output locations
93output_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'outputs'+sep
94output_build_time_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'outputs'+sep+build_time+sep
95output_run_time_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'outputs'+sep+run_time+sep
96output_run_time_dir_name = output_run_time_dir + scenario_name  #Used by post processing
97
98#gauges
99gauge_name = 'dampier_gauges_up2.csv' #'dampier.csv'
100gauges_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'gauges'+sep
101gauges_dir_name = gauges_dir + gauge_name
102
103#buildings_filename = gauges_dir + 'dampier_res_nexis.csv'
104buildings_filename_damage_out = 'dampier_res_nexis_modified.csv'
105###############################
106# Domain definitions
107###############################
108
109refzone = 50 
110south_boundary = degminsec2decimal_degrees(-20,58,0)
111north_boundary = degminsec2decimal_degrees(-20,13,0)
112west_boundary = degminsec2decimal_degrees(116,15,0)
113east_boundary = degminsec2decimal_degrees(117,11,0)
114##
115##p0 = [south, degminsec2decimal_degrees(116,32,0)]
116##p1 = [south, west]
117##p2 = [degminsec2decimal_degrees(-20,23,0), west]
118##p3 = [north, degminsec2decimal_degrees(116,45,0)]
119##p4 = [north, degminsec2decimal_degrees(117,0,0)]
120##p5 = [p2[0], degminsec2decimal_degrees(117,8,0)]
121##p6 = [degminsec2decimal_degrees(-20,30,0), east]
122##p7 = [degminsec2decimal_degrees(-20,38,0), east]
123##p8 = [south, east]
124##
125##poly_all, zone = convert_from_latlon_to_utm([p0, p1, p2, p3, p4, p5, p6, p7, p8])
126##refzone = zone
127poly_all = read_polygon(polygons_dir+'extent.csv')
128print 'Area of bounding polygon', polygon_area(poly_all)/1000000.0
129
130res_poly_all = 100000
131#res_poly_all = 500000
132
133###############################
134# Interior region definitions
135###############################
136
137poly_region = read_polygon(polygons_dir+'region.csv')
138res_region = 50000
139
140poly_dampier = read_polygon(polygons_dir+'dampier_town.csv')
141res_dampier = 500
142#res_dampier = 5000
143
144poly_karratha = read_polygon(polygons_dir+'karrathav2.csv')
145res_karratha = 15000
146
147poly_karratha_town = read_polygon(polygons_dir+'karratha_townv2.csv')
148res_karratha_town = 500
149#res_karratha_town = 5000
150
151poly_facility = read_polygon(polygons_dir+'facility.csv')
152res_facility = 1000
153
154poly_delambre = read_polygon(polygons_dir+'delambre.csv')
155res_delambre = 5000
156
157poly_coast = read_polygon(polygons_dir+'coastpoly.csv')
158res_coast = 1000
159#res_coast = 10000
160
161poly_NWislands = read_polygon(polygons_dir+'nw_islands_area.csv')
162res_NWislands = 50000
163
164poly_island0 = read_polygon(polygons_dir+'island0.csv')
165res_island0 = res_poly_all
166
167poly_island1 = read_polygon(polygons_dir+'island1.csv')
168res_island0 = res_poly_all
169
170poly_island2 = read_polygon(polygons_dir+'island2.csv')
171res_island0 = res_poly_all
172
173poly_island3 = read_polygon(polygons_dir+'island3.csv')
174res_island0 = res_poly_all
175
176res_islands = 5000
177#res_islands = 15000
178
179poly_ref_nw4 = read_polygon(polygons_dir+'ref_nw4.csv')
180res_ref_nw4 = res_islands
181
182poly_island4 = read_polygon(polygons_dir+'island4.csv')
183res_island0 = res_poly_all
184
185poly_ref_nw5 = read_polygon(polygons_dir+'ref_nw5.csv')
186res_ref_nw5 = res_islands
187
188poly_island5 = read_polygon(polygons_dir+'island5.csv')
189res_island0 = res_poly_all
190
191poly_ref_nw6 = read_polygon(polygons_dir+'ref_nw6.csv')
192res_ref_nw6 = res_islands
193
194poly_island6 = read_polygon(polygons_dir+'island6.csv')
195res_island0 = res_poly_all
196
197poly_ref_nw7 = read_polygon(polygons_dir+'ref_nw7.csv')
198res_ref_nw7 = res_islands
199
200poly_island7 = read_polygon(polygons_dir+'island7.csv')
201res_island0 = res_poly_all
202
203poly_ref_nw8 = read_polygon(polygons_dir+'ref_nw8.csv')
204res_ref_nw8 = res_islands
205
206poly_island8 = read_polygon(polygons_dir+'island8.csv')
207res_island0 = res_poly_all
208
209
210##plot_polygons([poly_dampier,poly_karratha,poly_karratha_town,poly_delambre,
211##                poly_coast,poly_NWislands,poly_island0,poly_island1,poly_island2,
212##                poly_island3,poly_island4,poly_island5,poly_island6,
213##                poly_island7,poly_island8,poly_ref_nw4,poly_ref_nw5,
214##                poly_ref_nw6,poly_ref_nw7,poly_ref_nw8,poly_all],'poly_pic')
215
216interior_regions = [[poly_dampier,res_dampier], 
217                    [poly_karratha,res_karratha],[poly_karratha_town,res_karratha_town],
218                    [poly_delambre,res_delambre],[poly_coast,res_coast],
219                    [poly_facility,res_facility],
220                    #[poly_NWislands,res_NWislands],
221                    [poly_island0,res_island0],[poly_island1,res_island0],
222                    [poly_island2,res_island0],[poly_island3,res_island0],
223                    [poly_island4,res_island0],[poly_island5,res_island0],
224                    [poly_island6,res_island0],[poly_island7,res_island0],
225                    [poly_island8,res_island0],[poly_ref_nw4,res_ref_nw4],
226                    [poly_ref_nw5,res_ref_nw5],[poly_ref_nw6,res_ref_nw6],
227                    [poly_ref_nw7,res_ref_nw7],[poly_ref_nw8,res_ref_nw8]]
228                   
229#trigs_min = number_mesh_triangles(interior_regions, poly_all, res_poly_all)
230#
231#print 'min number triangles', trigs_min
232
233###################################################################
234# Clipping regions for export to asc and regions for clipping data
235###################################################################
236
237poly_bathy = read_polygon(polygons_dir+'mainland_only.csv')
238
239# exporting asc grid - Dampier
240e_min_area = 474000
241e_max_area = 480000
242n_min_area = 7719000
243n_max_area = 7725000
244
245# exporting asc grid - Karratha
246##e_min_area =
247##e_max_area =
248##n_min_area =
249##n_max_area =
250
251"""
252# used in the CIPMA 2006 scenario
253# CIPMA point of interest
254cipma_latitude = -20.588456
255cipma_longitude = 116.771527
256
257k0 = [cipma_latitude-0.02, cipma_longitude-0.02]
258k1 = [cipma_latitude-0.02, cipma_longitude+0.02]
259k2 = [cipma_latitude+0.02, cipma_longitude+0.02]
260k3 = [cipma_latitude+0.02, cipma_longitude-0.02]
261
262cipma_polygon, zone = convert_from_latlon_to_utm([k0, k1, k2, k3])
263assert zone == refzone
264
265poly_facility = read_polygon(polygons_dir+'facility.csv')
266poly_pipeline = read_polygon(polygons_dir+'pipeline2.csv')
267poly_interior = read_polygon(polygons_dir+'interior.csv')
268poly_coast = read_polygon(polygons_dir+'coast_final.csv')
269clip_poly_e = read_polygon(polygons_dir+'gap_e.csv')
270clip_poly_nw = read_polygon(polygons_dir+'gap_nw.csv')
271clip_poly_mid_w = read_polygon(polygons_dir+'gap_mid_w.cvs')
272clip_poly_mid_e = read_polygon(polygons_dir+'gap_mid_e.cvs')
273
274# exporting asc grid
275e_min_area = 474000
276e_max_area = 480000
277n_min_area = 7719000
278n_max_area = 7725000
279
280# used in the original 2005 scenario
281#Interior regions
282karratha_south = degminsec2decimal_degrees(-20,44,0)
283karratha_north = degminsec2decimal_degrees(-20,42,0)
284karratha_west = degminsec2decimal_degrees(116,48,0)
285karratha_east = degminsec2decimal_degrees(116,53,30)
286
287k0 = [karratha_south, karratha_west]
288k1 = [karratha_south, karratha_east]
289k2 = [karratha_north, karratha_east]
290k3 = [karratha_north, karratha_west]   
291
292karratha_polygon, zone = convert_from_latlon_to_utm([k0, k1, k2, k3])
293assert zone == refzone
294
295#Interior regions
296dampier_south = degminsec2decimal_degrees(-20,40,0)
297dampier_north = degminsec2decimal_degrees(-20,38,10)
298dampier_west = degminsec2decimal_degrees(116,43,0)
299dampier_east = degminsec2decimal_degrees(116,45,0)
300
301d0 = [dampier_south, dampier_west]
302d1 = [dampier_south, dampier_east]
303d2 = [dampier_north, dampier_east]
304d3 = [dampier_north, dampier_west]   
305
306dampier_polygon, zone = convert_from_latlon_to_utm([d0, d1, d2, d3])
307assert zone == refzone
308
309#Interior regions
310refinery_south = degminsec2decimal_degrees(-20,37,50)
311refinery_north = degminsec2decimal_degrees(-20,36,0)
312refinery_west = degminsec2decimal_degrees(116,44,0)
313refinery_east = degminsec2decimal_degrees(116,46,10)
314
315d0 = [refinery_south, refinery_west]
316d1 = [refinery_south, refinery_east]
317d2 = [refinery_north, refinery_east]
318d3 = [refinery_north, refinery_west]   
319
320refinery_polygon, zone = convert_from_latlon_to_utm([d0, d1, d2, d3])
321assert zone == refzone
322
323#Interior region around 468899, 7715177:
324#lat (-20, 39, 44.93753), lon (116, 42, 5.09106)
325
326point_south = degminsec2decimal_degrees(-20,39,46)
327point_north = degminsec2decimal_degrees(-20,39,42)
328point_west = degminsec2decimal_degrees(116,42,0)
329point_east = degminsec2decimal_degrees(116,42,10)
330
331d0 = [point_south, point_west]
332d1 = [point_south, point_east]
333d2 = [point_north, point_east]
334d3 = [point_north, point_west]   
335
336point_polygon, zone = convert_from_latlon_to_utm([d0, d1, d2, d3])
337assert zone == refzone
338
339#Neils areas around interesting points
340neil1_point1 = [degminsec2decimal_degrees(-20,35,34),
341                degminsec2decimal_degrees(116,45,18)]
342neil1_point2 = [degminsec2decimal_degrees(-20,36,15),
343                degminsec2decimal_degrees(116,46,18)]
344neil1_point3 = [degminsec2decimal_degrees(-20,35,9),
345                degminsec2decimal_degrees(116,47,17)]
346neil1_point4 = [degminsec2decimal_degrees(-20,34,26),
347                degminsec2decimal_degrees(116,46,17)]
348
349neil1_polygon, zone = convert_from_latlon_to_utm([neil1_point1,
350                                                  neil1_point2,
351                                                  neil1_point3,
352                                                  neil1_point4])
353assert zone == refzone
354
355neil2_point1 = [degminsec2decimal_degrees(-20,39,36),
356                degminsec2decimal_degrees(116,41,33)]
357neil2_point2 = [degminsec2decimal_degrees(-20,40,10),
358                degminsec2decimal_degrees(116,42,13)]
359neil2_point3 = [degminsec2decimal_degrees(-20,38,39),
360                degminsec2decimal_degrees(116,43,49)]
361neil2_point4 = [degminsec2decimal_degrees(-20,38,5),
362                degminsec2decimal_degrees(116,43,9)]
363
364neil2_polygon, zone = convert_from_latlon_to_utm([neil2_point1,
365                                                  neil2_point2,
366                                                  neil2_point3,
367                                                  neil2_point4])
368assert zone == refzone
369
370#Withnell bay
371wb_point1 = [degminsec2decimal_degrees(-20,35,34),
372                degminsec2decimal_degrees(116,45,18)]
373wb_point2 = [degminsec2decimal_degrees(-20,36,15),
374                degminsec2decimal_degrees(116,46,18)]
375wb_point3 = [degminsec2decimal_degrees(-20,35,9),
376                degminsec2decimal_degrees(116,47,17)]
377wb_point4 = [degminsec2decimal_degrees(-20,34,26),
378                degminsec2decimal_degrees(116,46,17)]
379
380wb_polygon, zone = convert_from_latlon_to_utm([wb_point1, wb_point2,
381                                               wb_point3, wb_point4])
382assert zone == refzone
383
384#Larger Withnell bay
385lwb_point1 = [degminsec2decimal_degrees(-20,35,59),
386                degminsec2decimal_degrees(116,42,00)]
387lwb_point2 = [degminsec2decimal_degrees(-20,36,50),
388                degminsec2decimal_degrees(116,46,50)]
389lwb_point3 = [degminsec2decimal_degrees(-20,34,00),
390                degminsec2decimal_degrees(116,47,39)]
391lwb_point4 = [degminsec2decimal_degrees(-20,33,00),
392                degminsec2decimal_degrees(116,42,50)]
393
394lwb_polygon, zone = convert_from_latlon_to_utm([lwb_point1, lwb_point2,
395                                                lwb_point3, lwb_point4])
396                                                     
397assert zone == refzone
398"""
Note: See TracBrowser for help on using the repository browser.