1 | # -*- coding: cp1252 -*- |
---|
2 | """Common filenames and locations for topographic data, meshes and outputs. |
---|
3 | """ |
---|
4 | |
---|
5 | from os import sep, environ, getenv, getcwd ,umask |
---|
6 | from os.path import expanduser |
---|
7 | import sys |
---|
8 | from time import localtime, strftime, gmtime |
---|
9 | from anuga.utilities.polygon import read_polygon, plot_polygons, is_inside_polygon, number_mesh_triangles |
---|
10 | #from anuga.coordinate_transforms.redfearn import degminsec2decimal_degrees, convert_points_from_latlon_to_utm |
---|
11 | from anuga.utilities.system_tools import get_user_name, get_host_name |
---|
12 | |
---|
13 | # file and system info |
---|
14 | #--------------------------------- |
---|
15 | #codename = 'project.py' |
---|
16 | |
---|
17 | home = getenv('INUNDATIONHOME') + sep +'data'+sep #Sandpit's parent dir |
---|
18 | user = get_user_name() |
---|
19 | host = get_host_name() |
---|
20 | |
---|
21 | # INUNDATIONHOME is the inundation directory, not the data directory. |
---|
22 | |
---|
23 | #time stuff |
---|
24 | time = strftime('%Y%m%d_%H%M%S',localtime()) #gets time for new dir |
---|
25 | gtime = strftime('%Y%m%d_%H%M%S',gmtime()) #gets time for new dir |
---|
26 | build_time = time+'_build' |
---|
27 | run_time = time+'_run' |
---|
28 | print 'gtime: ', gtime |
---|
29 | |
---|
30 | #Making assumptions about the location of scenario data |
---|
31 | state = 'western_australia' |
---|
32 | scenario_name = 'busselton' |
---|
33 | scenario = 'busselton_tsunami_scenario' |
---|
34 | |
---|
35 | tide = 0.6 |
---|
36 | |
---|
37 | alpha = 0.1 #changed for testing purposes |
---|
38 | friction=0.01 |
---|
39 | starttime=0 |
---|
40 | finaltime=50000 # changed for rev_number trial |
---|
41 | export_cellsize=25 |
---|
42 | setup='trial' |
---|
43 | source='exmouth' |
---|
44 | |
---|
45 | |
---|
46 | if setup =='trial': |
---|
47 | print'trial' |
---|
48 | res_factor=10 |
---|
49 | time_thinning=48 |
---|
50 | yieldstep=240 |
---|
51 | if setup =='basic': |
---|
52 | print'basic' |
---|
53 | res_factor=4 |
---|
54 | time_thinning=12 |
---|
55 | yieldstep=120 |
---|
56 | if setup =='final': |
---|
57 | print'final' |
---|
58 | res_factor=1 |
---|
59 | time_thinning=4 |
---|
60 | yieldstep=60 |
---|
61 | |
---|
62 | #rev_num = '5449' |
---|
63 | #rev_num = '4695' # 2nd Sept 2007 |
---|
64 | #rev_num = '4743' # 3nd Oct 2007 |
---|
65 | #rev_num = '4777' # 1st Nov 2007 |
---|
66 | #rev_num = '4874' # 3rd Dec 2007 |
---|
67 | #rev_num = '4901' # 3rd Jan 2007 |
---|
68 | #rev_num = '4990' # 5th Feb 2007 |
---|
69 | #rev_num = '5103' # 3rd March 2007 |
---|
70 | #rev_num = '5185' # 1st April 2007 |
---|
71 | rev_num = '5273' # 2nd May 2007 |
---|
72 | |
---|
73 | |
---|
74 | dir_comment='_'+setup+'_'+str(tide)+'_'+str(source)+'_'+str(rev_num)+'_'+str(user) |
---|
75 | |
---|
76 | |
---|
77 | # onshore data provided by WA DLI - provided by Hamish on the 17th June 2008 |
---|
78 | |
---|
79 | onshore_name = 'busselton_v2_gda94_mga50' # original |
---|
80 | |
---|
81 | # AHO + DPI data |
---|
82 | coast_name = 'Contour_0' # provided by hamish, represent better coastline than the 100km as compared to charts |
---|
83 | coast_name1 = 'beach_survey_final' |
---|
84 | offshore_name = 'Bathymetry_final' |
---|
85 | offshore_name1 = 'Busselton_Chart' |
---|
86 | offshore_name2 = 'Busselton_Digitised' |
---|
87 | |
---|
88 | #final topo name |
---|
89 | combined_name ='busselton_combined_elevation' |
---|
90 | combined_name_small = 'busselton_combined_elevation_smaller' |
---|
91 | |
---|
92 | anuga_dir = home+state+sep+scenario+sep+'anuga'+sep |
---|
93 | |
---|
94 | topographies_in_dir = home+state+sep+scenario+sep+'elevation_final'+sep+'points'+sep |
---|
95 | topographies_dir = anuga_dir+'topographies'+sep |
---|
96 | |
---|
97 | # input topo file location |
---|
98 | onshore_in_dir_name = topographies_in_dir + onshore_name #topo |
---|
99 | |
---|
100 | coast_in_dir_name = topographies_in_dir + coast_name #coastline |
---|
101 | coast_in_dir_name1 = topographies_in_dir + coast_name1 #beach survey |
---|
102 | |
---|
103 | offshore_in_dir_name = topographies_in_dir + offshore_name #bathymetry |
---|
104 | offshore_in_dir_name1 = topographies_in_dir + offshore_name1 #bathymetry Charts |
---|
105 | offshore_in_dir_name2 = topographies_in_dir + offshore_name2 #Digitised Fairsheet |
---|
106 | |
---|
107 | #output to anuga from build file |
---|
108 | onshore_dir_name = topographies_dir + onshore_name |
---|
109 | |
---|
110 | coast_dir_name = topographies_dir + coast_name |
---|
111 | coast_dir_name1 = topographies_dir + coast_name1 |
---|
112 | |
---|
113 | offshore_dir_name = topographies_dir + offshore_name |
---|
114 | offshore_dir_name1 = topographies_dir + offshore_name1 |
---|
115 | offshore_dir_name2 = topographies_dir + offshore_name2 |
---|
116 | |
---|
117 | #final topo files |
---|
118 | combined_dir_name = topographies_dir + combined_name |
---|
119 | combined_dir_name_small = topographies_dir + combined_name_small |
---|
120 | |
---|
121 | meshes_dir = anuga_dir+'meshes'+sep |
---|
122 | meshes_dir_name = meshes_dir + scenario_name |
---|
123 | |
---|
124 | polygons_dir = anuga_dir+'polygons'+sep |
---|
125 | tide_dir = anuga_dir+'tide_data'+sep |
---|
126 | |
---|
127 | #boundaries_source = '1' |
---|
128 | |
---|
129 | if source=='exmouth': |
---|
130 | boundaries_name = 'busselton_3103_30052008' #exmouth gun |
---|
131 | boundaries_in_dir = anuga_dir+'boundaries'+sep+'urs'+sep+'exmouth'+sep+'1_10000'+sep |
---|
132 | |
---|
133 | if source=='test': |
---|
134 | boundaries_name = 'other' #exmouth gun |
---|
135 | boundaries_in_dir = anuga_dir+'boundaries'+sep |
---|
136 | |
---|
137 | |
---|
138 | #boundaries locations |
---|
139 | boundaries_in_dir_name = boundaries_in_dir + boundaries_name |
---|
140 | boundaries_dir = anuga_dir+'boundaries'+sep |
---|
141 | boundaries_dir_name = boundaries_dir + scenario_name |
---|
142 | |
---|
143 | #output locations |
---|
144 | output_dir = anuga_dir+'outputs'+sep |
---|
145 | output_build_time_dir = output_dir +'test'+sep + build_time + dir_comment + sep |
---|
146 | #output_run_time_dir = output_dir +run_time+dir_comment+sep |
---|
147 | output_run_time_dir = output_dir +'test'+sep + run_time + dir_comment +sep # take test out |
---|
148 | output_run_time_dir_name = output_run_time_dir + scenario_name #Used by post processing |
---|
149 | |
---|
150 | #gauges |
---|
151 | gauge_name = 'busselton.csv' |
---|
152 | gauges_dir = home+state+sep+scenario+sep+'anuga'+sep+'gauges'+sep |
---|
153 | gauges_dir_name = gauges_dir + gauge_name |
---|
154 | |
---|
155 | buildings_filename = gauges_dir + 'Busselton_res_Project.csv' |
---|
156 | buildings_filename_out = 'Busselton_res_Project_modified.csv' |
---|
157 | |
---|
158 | community_filename = gauges_dir +'' |
---|
159 | community_broome = gauges_dir + '' |
---|
160 | |
---|
161 | |
---|
162 | ############################### |
---|
163 | # Domain definitions |
---|
164 | ############################### |
---|
165 | |
---|
166 | from anuga.utilities.polygon import read_polygon, plot_polygons, polygon_area, is_inside_polygon |
---|
167 | |
---|
168 | # bounding polygon for study area |
---|
169 | poly_all = read_polygon(polygons_dir+'poly_all.csv') |
---|
170 | res_poly_all = 100000*res_factor |
---|
171 | |
---|
172 | |
---|
173 | ############################### |
---|
174 | # Interior region definitions |
---|
175 | ############################### |
---|
176 | |
---|
177 | #digitized polygons |
---|
178 | poly_large = read_polygon(polygons_dir+'coast_5km_d20m.csv') |
---|
179 | res_large = 40000*res_factor |
---|
180 | |
---|
181 | poly_busselton = read_polygon(polygons_dir+'busselton_1km.csv') |
---|
182 | res_busselton = 500*res_factor |
---|
183 | |
---|
184 | poly_bunbury = read_polygon(polygons_dir+'bunbury_1km.csv') |
---|
185 | res_bunbury = 500*res_factor |
---|
186 | |
---|
187 | poly_dunsborough = read_polygon(polygons_dir+'dunsborough_1km.csv') |
---|
188 | res_dunsborough = 500*res_factor |
---|
189 | |
---|
190 | poly_busselton2 = read_polygon(polygons_dir+'busselton_2km.csv') |
---|
191 | res_busselton2 = 10000*res_factor |
---|
192 | |
---|
193 | poly_bunbury2 = read_polygon(polygons_dir+'bunbury_2km.csv') |
---|
194 | res_bunbury2 = 10000*res_factor |
---|
195 | |
---|
196 | |
---|
197 | interior_regions = [[poly_large,res_large],[poly_busselton,res_busselton],[poly_bunbury,res_bunbury] |
---|
198 | ,[poly_dunsborough,res_dunsborough],[poly_busselton2,res_busselton2] |
---|
199 | ,[poly_bunbury2,res_bunbury2]] |
---|
200 | |
---|
201 | |
---|
202 | boundary_tags={'back': [0, 1, 2, 3, 4, 9], |
---|
203 | 'side': [5], 'ocean': [6, 7, 8]} |
---|
204 | |
---|
205 | trigs_min = number_mesh_triangles(interior_regions, poly_all, res_poly_all) |
---|
206 | |
---|
207 | poly_mainland=read_polygon(polygons_dir+'initial_condition.csv') |
---|
208 | |
---|
209 | print 'min number triangles', trigs_min |
---|
210 | |
---|
211 | |
---|
212 | ################################################################### |
---|
213 | # Clipping regions for export to asc and regions for clipping data |
---|
214 | ################################################################### |
---|
215 | |
---|
216 | # exporting asc grid for Busselton |
---|
217 | xminBusselton = 340000 |
---|
218 | xmaxBusselton = 352000 |
---|
219 | yminBusselton = 6271500 |
---|
220 | ymaxBusselton = 6280000 |
---|
221 | |
---|
222 | # exporting asc grid for Bunbury |
---|
223 | xminBunbury = 369000 |
---|
224 | xmaxBunbury = 381000 |
---|
225 | yminBunbury = 6308000 |
---|
226 | ymaxBunbury = 6308000 |
---|
227 | |
---|
228 | # exporting asc grid for Dunsborough |
---|
229 | xminDunsborough = 321000 |
---|
230 | xmaxDunsborough = 327500 |
---|
231 | yminDunsborough = 6277000 |
---|
232 | ymaxDunsborough = 6282000 |
---|
233 | |
---|