1 | # -*- coding: cp1252 -*- |
---|
2 | """Common filenames and locations for topographic data, meshes and outputs. |
---|
3 | """ |
---|
4 | |
---|
5 | from os import sep, environ, getenv, getcwd |
---|
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 diruser = get_user_name() |
---|
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 = 'sw_pacific' |
---|
32 | scenario_name = 'Tonga_slide' |
---|
33 | scenario = 'tonga' |
---|
34 | |
---|
35 | tide = 0 |
---|
36 | |
---|
37 | alpha = 0.1 |
---|
38 | friction=0.01 |
---|
39 | starttime=10000 |
---|
40 | midtime=21600 |
---|
41 | finaltime=10000 |
---|
42 | export_cellsize=50 |
---|
43 | setup='trial' |
---|
44 | source='test' |
---|
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 | dir_comment='_'+setup+'_'+str(tide)+'_'+str(scenario_name)+'_'+str(user) |
---|
63 | |
---|
64 | # onshore data 5m countour |
---|
65 | onshore_name = 'topography_tongatapu' # original' |
---|
66 | |
---|
67 | # AHO + DPI data + colin French coastline |
---|
68 | #coast_name = 'waterline' |
---|
69 | Singlebeam_name = 'Tongatapu_SB_5m grid' |
---|
70 | Multibeam_name = 'Tongatapu_MB_30m grid' |
---|
71 | Chart_name= 'Tongatapu_Chart' |
---|
72 | Derived_bath_name= 'Derived_Bathy' |
---|
73 | added_data_name='joining_eastIsland_toreef' |
---|
74 | |
---|
75 | |
---|
76 | #final topo name |
---|
77 | combined_name ='Tongatapu_combined_elevation' |
---|
78 | combined_smaller_name = 'Tongatapu_combined_elevation_smaller' |
---|
79 | |
---|
80 | anuga_dir = home+state+sep+scenario+sep+'anuga'+sep |
---|
81 | |
---|
82 | topographies_in_dir = home+sep+state+sep+scenario+sep+'elevation_final'+sep+'points'+sep |
---|
83 | topographies_dir = anuga_dir+'topographies'+sep |
---|
84 | #topographies_time_dir = topographies_dir+build_time+sep |
---|
85 | |
---|
86 | # input topo file location |
---|
87 | onshore_in_dir_name = topographies_in_dir + onshore_name |
---|
88 | |
---|
89 | Singlebeam_in_dir_name = topographies_in_dir + Singlebeam_name |
---|
90 | Multibeam_in_dir_name = topographies_in_dir + Multibeam_name |
---|
91 | Chart_in_dir_name = topographies_in_dir + Chart_name |
---|
92 | Derived_bath_in_dir_name = topographies_in_dir + Derived_bath_name |
---|
93 | added_data_in_dir_name = topographies_in_dir + added_data_name |
---|
94 | |
---|
95 | onshore_dir_name = topographies_dir + onshore_name |
---|
96 | |
---|
97 | Singlebeam_dir_name = topographies_dir + Singlebeam_name |
---|
98 | Multibeam_dir_name = topographies_dir + Multibeam_name |
---|
99 | Chart_dir_name = topographies_dir + Chart_name |
---|
100 | Derived_bath_dir_name = topographies_dir + Derived_bath_name |
---|
101 | added_data_dir_name = topographies_dir + added_data_name |
---|
102 | |
---|
103 | #final topo files |
---|
104 | combined_dir_name = topographies_dir + combined_name |
---|
105 | #combined_time_dir_name = topographies_time_dir + combined_name |
---|
106 | combined_smaller_name_dir = topographies_dir + combined_smaller_name |
---|
107 | #combined_time_dir_final_name = topographies_time_dir + combined_final_name |
---|
108 | |
---|
109 | meshes_dir = anuga_dir+'meshes'+sep |
---|
110 | meshes_dir_name = meshes_dir + scenario_name |
---|
111 | |
---|
112 | polygons_dir = anuga_dir+'polygons'+sep |
---|
113 | tide_dir = anuga_dir+'tide_data'+sep |
---|
114 | |
---|
115 | |
---|
116 | #boundaries_source = '1' |
---|
117 | |
---|
118 | if source =='dampier': |
---|
119 | boundaries_name = 'broome_3854_17042007' #Dampier gun |
---|
120 | boundaries_in_dir = anuga_dir+'boundaries'+sep+sep+'dampier'+sep+'1_10000'+sep |
---|
121 | |
---|
122 | if source=='onslow': |
---|
123 | boundaries_name = 'broome_3859_16052007' #onslow_hedland_broome gun |
---|
124 | boundaries_in_dir = anuga_dir+'boundaries'+sep+sep+'onslow_hedland_broome'+sep+'1_10000'+sep |
---|
125 | |
---|
126 | if source=='exmouth': |
---|
127 | boundaries_name = 'broome_3103_18052007' #exmouth gun |
---|
128 | boundaries_in_dir = anuga_dir+'boundaries'+sep+sep+'exmouth'+sep+'1_10000'+sep |
---|
129 | |
---|
130 | if source=='test': |
---|
131 | boundaries_name = 'other' #exmouth gun |
---|
132 | boundaries_in_dir = anuga_dir+'boundaries'+sep |
---|
133 | |
---|
134 | |
---|
135 | #boundaries locations |
---|
136 | boundaries_in_dir_name = boundaries_in_dir + scenario_name |
---|
137 | boundaries_dir = anuga_dir+'boundaries'+sep |
---|
138 | boundaries_dir_name = boundaries_dir + scenario_name |
---|
139 | #boundaries_time_dir = anuga_dir+'boundaries'+sep+build_time+sep |
---|
140 | #boundaries_time_dir_name = boundaries_time_dir + boundaries_name #Used by post processing |
---|
141 | |
---|
142 | #output locations |
---|
143 | output_dir = anuga_dir+'outputs'+sep |
---|
144 | output_build_time_dir = anuga_dir+'outputs'+sep+build_time+dir_comment+sep |
---|
145 | output_run_time_dir = anuga_dir+'outputs'+sep+run_time+dir_comment+sep |
---|
146 | output_run_time_dir_name = output_run_time_dir + scenario_name #Used by post processing |
---|
147 | |
---|
148 | #gauges |
---|
149 | #gauge_name = 'perth.csv' |
---|
150 | #gauges_dir = anuga_dir+'gauges'+sep |
---|
151 | #gauges_dir_name = gauges_dir + gauge_name |
---|
152 | |
---|
153 | #buildings_filename = gauges_dir + 'Perth_res_Project.csv' |
---|
154 | #buildings_filename_out = 'Perth_res_Project_modified.csv' |
---|
155 | |
---|
156 | ############################### |
---|
157 | # Domain definitions |
---|
158 | ############################### |
---|
159 | from anuga.utilities.polygon import read_polygon, plot_polygons, polygon_area, is_inside_polygon |
---|
160 | |
---|
161 | poly_all = read_polygon(polygons_dir+'extent.txt') |
---|
162 | res_poly_all = 40000*res_factor |
---|
163 | |
---|
164 | #refzone = 50 |
---|
165 | |
---|
166 | ############################### |
---|
167 | # Interior region definitions |
---|
168 | ############################### |
---|
169 | |
---|
170 | poly_tongatapu = read_polygon(polygons_dir+'finres.txt') |
---|
171 | poly_island1 = read_polygon(polygons_dir+'island1.txt') |
---|
172 | poly_island2 = read_polygon(polygons_dir+'island2.txt') |
---|
173 | poly_island3 = read_polygon(polygons_dir+'island3.txt') |
---|
174 | poly_island4 = read_polygon(polygons_dir+'island4.txt') |
---|
175 | poly_island5= read_polygon(polygons_dir+'island5.txt') |
---|
176 | poly_island6= read_polygon(polygons_dir+'island6.txt') |
---|
177 | poly_island7= read_polygon(polygons_dir+'island7.txt') |
---|
178 | poly_island8= read_polygon(polygons_dir+'island8.txt') |
---|
179 | poly_island9= read_polygon(polygons_dir+'island9.txt') |
---|
180 | poly_island10= read_polygon(polygons_dir+'island10.txt') |
---|
181 | poly_island11= read_polygon(polygons_dir+'island11.txt') |
---|
182 | poly_island12= read_polygon(polygons_dir+'island12.txt') |
---|
183 | poly_island13= read_polygon(polygons_dir+'island13.txt') |
---|
184 | |
---|
185 | |
---|
186 | islands_res = 5000 |
---|
187 | tongatapu_res = 5000 |
---|
188 | interior_regions = [[poly_tongatapu, tongatapu_res], |
---|
189 | [poly_island1, islands_res], |
---|
190 | [poly_island2, islands_res], |
---|
191 | [poly_island3, islands_res], |
---|
192 | [poly_island4, islands_res], |
---|
193 | [poly_island5, islands_res], |
---|
194 | [poly_island6, islands_res], |
---|
195 | [poly_island7, islands_res], |
---|
196 | [poly_island8, islands_res], |
---|
197 | [poly_island9, islands_res], |
---|
198 | [poly_island10, islands_res], |
---|
199 | [poly_island11, islands_res], |
---|
200 | [poly_island12, islands_res], |
---|
201 | [poly_island13, islands_res]] |
---|
202 | |
---|
203 | boundary_tags={'ocean_east':[0], |
---|
204 | 'ocean_north':[1], |
---|
205 | 'ocean_west':[2,3], |
---|
206 | 'land':[4,5,6,7,8,9,10,11,12,13,14], |
---|
207 | 'ocean_southeast':[15,16]} |
---|
208 | |
---|
209 | trigs_min = number_mesh_triangles(interior_regions, poly_all, res_poly_all) |
---|
210 | |
---|
211 | print 'min number triangles', trigs_min |
---|
212 | ################################################################### |
---|
213 | # Clipping regions for export to asc and regions for clipping data |
---|
214 | ################################################################### |
---|
215 | |
---|
216 | # exporting asc grid |
---|
217 | eastingmin = 670500 |
---|
218 | eastingmax = 712750 |
---|
219 | northingmin = 7646000 |
---|
220 | northingmax = 7677000 |
---|
221 | |
---|
222 | |
---|
223 | slide_origin = [701290, 7665750] # move onto the continental shelf, depth = 500 |
---|
224 | slide_depth = 207. |
---|
225 | |
---|
226 | |
---|
227 | |
---|
228 | |
---|