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

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

update to dampier

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