Ticket #141: project.py

File project.py, 10.1 KB (added by nick, 18 years ago)

cyclone project file

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
30#tide = -2.5
31#tide = 0.0
32tide = 2.4
33
34#Making assumptions about the location of scenario data
35state = 'western_australia'
36scenario_name = 'dampier'
37scenario = 'dampier_tsunami_scenario_2006'
38
39# onshore data provided by WA DLI
40onshore_name = 'DLI_DTED_raster_clipped' # original
41
42# AHO + DPI data + colin French coastline
43coast_name = 'coastline_edited_w_DEM'
44offshore_name = 'clipped_bathy'
45offshore1_name = 'elev_501'
46offshore2_name = 'inferrec_e'
47
48#final topo name
49combined_name ='dampier_combined_elevation'
50combined_smaller_name = 'dampier_combined_elevation_small'
51combined_smallest_name = 'dampier_combined_elevation_smallest'
52
53topographies_in_dir = home+sep+state+sep+scenario+sep+'elevation_final'+sep+'070112'+sep+'points'+sep
54topographies_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'topographies'+sep
55topographies_time_dir = topographies_dir+build_time+sep
56
57temp_dir = home+sep+state+sep+scenario+sep+'anuga'+sep
58temp_dir_name = temp_dir + temp_time+sep
59
60# input topo file location
61onshore_in_dir_name = topographies_in_dir + onshore_name
62coast_in_dir_name = topographies_in_dir + coast_name
63offshore_in_dir_name = topographies_in_dir + offshore_name
64offshore1_in_dir_name = topographies_in_dir + offshore1_name
65offshore2_in_dir_name = topographies_in_dir + offshore2_name
66
67onshore_dir_name = topographies_dir + onshore_name
68coast_dir_name = topographies_dir + coast_name
69offshore_dir_name = topographies_dir + offshore_name
70offshore1_dir_name = topographies_dir + offshore1_name
71offshore2_dir_name = topographies_dir + offshore2_name
72
73#final topo files
74combined_dir_name = topographies_dir + combined_name
75combined_time_dir_name = topographies_time_dir + combined_name
76combined_smaller_dir_name = topographies_dir + combined_smaller_name
77combined_smallest_dir_name = topographies_dir + combined_smallest_name
78#combined_time_dir_final_name = topographies_time_dir + combined_final_name
79
80meshes_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'meshes'+sep
81meshes_dir_name = meshes_dir + scenario_name
82
83polygons_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'polygons'+sep+'2007polys'+sep
84tide_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'tide_data'+sep
85
86boundaries_source = ''
87boundaries_name = 'o'
88boundaries_name1 = 'o_new1'
89boundaries_name2 = 'o_test'
90
91#boundaries locations
92#boundaries_in_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'boundaries'+sep
93boundaries_in_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'boundaries'+sep+'urs'+sep+'1_10000'+sep
94boundaries_in_dir_name = boundaries_in_dir + boundaries_name
95boundaries_in_dir2 = home+sep+state+sep+scenario+sep+'anuga'+sep+'boundaries'+sep+'urs'+sep+'ungridded'+sep
96boundaries_in_dir_name2 = boundaries_in_dir2 + boundaries_name
97boundaries_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'boundaries'+sep
98boundaries_dir_name = boundaries_dir + boundaries_name
99boundaries_dir_namea = boundaries_dir + boundaries_name+'_5000_35000'
100boundaries_dir_name1 = boundaries_dir + boundaries_name1
101boundaries_dir_name2 = boundaries_dir + boundaries_name2
102boundaries_dir_name3 = boundaries_dir + boundaries_name+'_test_8500_12000'
103boundaries_dir_name4 = boundaries_dir + boundaries_name+'_8500_12000_no_zone'
104boundaries_dir_name5 = boundaries_dir + '20061026_173920_build'+sep+'dampier'
105boundaries_dir_name6 = boundaries_dir + 'SU-AU'
106
107#boundaries_time_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'boundaries'+sep+build_time+sep
108#boundaries_time_dir_name = boundaries_time_dir + boundaries_name  #Used by post processing
109
110#output locations
111output_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'outputs'+sep
112output_build_time_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'outputs'+sep+build_time+sep
113output_run_time_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'outputs'+sep+run_time+sep
114output_run_time_dir_name = output_run_time_dir + scenario_name  #Used by post processing
115
116#gauges
117gauge_name = 'dampier_gauges_up2.csv' #'dampier.csv'
118gauge_name_simple = 'dampier_gauges_simple.csv' 
119gauge_name_test = 'dampier_gauges_up_test.csv' #'dampier.csv'
120gauges_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'gauges'+sep
121gauges_dir_name = gauges_dir + gauge_name
122gauges_dir_name_simple = gauges_dir + gauge_name_simple
123gauges_dir_name_test = gauges_dir + gauge_name_test
124
125
126#buildings_filename = gauges_dir + 'dampier_res_nexis.csv'
127buildings_filename_damage_out = 'dampier_res_nexis_modified.csv'
128###############################
129# Domain definitions
130###############################
131
132refzone = 50 
133south_boundary = degminsec2decimal_degrees(-20,58,0)
134#north_boundary = degminsec2decimal_degrees(-20,13,0)
135north_boundary = degminsec2decimal_degrees(-19,30,0)
136west_boundary = degminsec2decimal_degrees(116,15,0)
137east_boundary = degminsec2decimal_degrees(117,11,0)
138##
139##p0 = [south, degminsec2decimal_degrees(116,32,0)]
140##p1 = [south, west]
141##p2 = [degminsec2decimal_degrees(-20,23,0), west]
142##p3 = [north, degminsec2decimal_degrees(116,45,0)]
143##p4 = [north, degminsec2decimal_degrees(117,0,0)]
144##p5 = [p2[0], degminsec2decimal_degrees(117,8,0)]
145##p6 = [degminsec2decimal_degrees(-20,30,0), east]
146##p7 = [degminsec2decimal_degrees(-20,38,0), east]
147##p8 = [south, east]
148##
149##poly_all, zone = convert_from_latlon_to_utm([p0, p1, p2, p3, p4, p5, p6, p7, p8])
150##refzone = zone
151poly_all = read_polygon(polygons_dir+'extent.csv')
152print 'Area of bounding polygon', polygon_area(poly_all)/1000000.0
153
154res_factor = 1
155res_poly_all = 150000*res_factor
156
157###############################
158# Interior region definitions
159###############################
160
161poly_region = read_polygon(polygons_dir+'region.csv')
162res_region = 50000*res_factor
163
164poly_dampier = read_polygon(polygons_dir+'dampier_town.csv')
165res_dampier = 500*res_factor
166
167poly_karratha = read_polygon(polygons_dir+'karrathav2.csv')
168res_karratha = 15000*res_factor
169
170poly_karratha_town = read_polygon(polygons_dir+'karratha_townv2.csv')
171res_karratha_town = 500*res_factor
172
173poly_facility = read_polygon(polygons_dir+'facility.csv')
174res_facility = 1000*res_factor
175
176poly_delambre = read_polygon(polygons_dir+'delambre.csv')
177res_delambre = 1000*res_factor
178
179poly_coast = read_polygon(polygons_dir+'coastpoly.csv')
180res_coast = 5000*res_factor
181
182poly_NWislands = read_polygon(polygons_dir+'nw_islands_area.csv')
183res_NWislands = 50000*res_factor
184
185poly_island0 = read_polygon(polygons_dir+'island0.csv')
186res_island0 = res_poly_all
187
188poly_island1 = read_polygon(polygons_dir+'island1.csv')
189res_island0 = res_poly_all
190
191poly_island2 = read_polygon(polygons_dir+'island2.csv')
192res_island0 = res_poly_all
193
194poly_island3 = read_polygon(polygons_dir+'island3.csv')
195res_island0 = res_poly_all
196
197res_islands = 5000*res_factor
198
199poly_ref_nw4 = read_polygon(polygons_dir+'ref_nw4.csv')
200res_ref_nw4 = res_islands
201
202poly_island4 = read_polygon(polygons_dir+'island4.csv')
203res_island0 = res_poly_all
204
205poly_ref_nw5 = read_polygon(polygons_dir+'ref_nw5.csv')
206res_ref_nw5 = res_islands
207
208poly_island5 = read_polygon(polygons_dir+'island5.csv')
209res_island0 = res_poly_all
210
211poly_ref_nw6 = read_polygon(polygons_dir+'ref_nw6.csv')
212res_ref_nw6 = res_islands
213
214poly_island6 = read_polygon(polygons_dir+'island6.csv')
215res_island0 = res_poly_all
216
217poly_ref_nw7 = read_polygon(polygons_dir+'ref_nw7.csv')
218res_ref_nw7 = res_islands
219
220poly_island7 = read_polygon(polygons_dir+'island7.csv')
221res_island0 = res_poly_all
222
223poly_ref_nw8 = read_polygon(polygons_dir+'ref_nw8.csv')
224res_ref_nw8 = res_islands
225
226poly_island8 = read_polygon(polygons_dir+'island8.csv')
227res_island0 = res_poly_all
228
229
230#plot_polygons([poly_dampier,poly_karratha,poly_karratha_town,poly_delambre,
231#                poly_coast,poly_NWislands,poly_island0,poly_island1,poly_island2,
232#                poly_island3,poly_island4,poly_island5,poly_island6,
233#                poly_island7,poly_island8,poly_ref_nw4,poly_ref_nw5,
234#                poly_ref_nw6,poly_ref_nw7,poly_ref_nw8,poly_all],'poly_pic')
235
236interior_regions = [[poly_dampier,res_dampier], 
237                    [poly_karratha,res_karratha],[poly_karratha_town,res_karratha_town],
238                    [poly_delambre,res_delambre],[poly_coast,res_coast],
239                    [poly_facility,res_facility],
240                    #[poly_NWislands,res_NWislands],
241                    [poly_island0,res_island0],[poly_island1,res_island0],
242                    [poly_island2,res_island0],[poly_island3,res_island0],
243                    [poly_island4,res_island0],[poly_island5,res_island0],
244                    [poly_island6,res_island0],[poly_island7,res_island0],
245                    [poly_island8,res_island0],[poly_ref_nw4,res_ref_nw4],
246                    [poly_ref_nw5,res_ref_nw5],[poly_ref_nw6,res_ref_nw6],
247                    [poly_ref_nw7,res_ref_nw7],[poly_ref_nw8,res_ref_nw8]]
248
249interior_regions_test = [[poly_dampier,res_dampier], 
250                    [poly_karratha,res_karratha],[poly_karratha_town,res_karratha_town]]
251
252trigs_min = number_mesh_triangles(interior_regions, poly_all, res_poly_all)
253
254print 'min number triangles', trigs_min
255
256###################################################################
257# Clipping regions for export to asc and regions for clipping data
258###################################################################
259
260poly_mainland = read_polygon(polygons_dir+'mainland_only.csv')
261
262# exporting asc grid - Dampier
263e_min_area = 474000
264e_max_area = 480000
265n_min_area = 7719000
266n_max_area = 7725000
267