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