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 | from anuga.utilities.polygon import polygon_area |
---|
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 = 'Fangauta_resonance' |
---|
33 | scenario = 'tonga' |
---|
34 | |
---|
35 | tide = 0 |
---|
36 | |
---|
37 | alpha = 0.1 |
---|
38 | friction=0.01 |
---|
39 | starttime=10000 |
---|
40 | midtime=21600 |
---|
41 | finaltime=432000 |
---|
42 | export_cellsize=50 |
---|
43 | setup='final' |
---|
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=5 |
---|
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 | onshore_name1 ='topo_island_infangauta' |
---|
67 | |
---|
68 | # AHO + DPI data + colin French coastline |
---|
69 | #coast_name = 'waterline' |
---|
70 | Singlebeam_name = 'Tongatapu_SB_5m grid' |
---|
71 | addedpoint_name = 'addedpoints_nukualofabranch022' |
---|
72 | #Multibeam_name = 'Tongatapu_MB_30m grid' |
---|
73 | #Chart_name= 'Tongatapu_Chart' |
---|
74 | #Derived_bath_name= 'Derived_Bathy' |
---|
75 | #added_data_name='joining_eastIsland_toreef' |
---|
76 | |
---|
77 | |
---|
78 | #final topo name |
---|
79 | combined_name ='fangauta_combined_elevation' |
---|
80 | combined_smaller_name = 'fangauta_combined_elevation_smaller' |
---|
81 | |
---|
82 | anuga_dir = home+state+sep+scenario+sep+'anuga'+sep |
---|
83 | |
---|
84 | topographies_in_dir = home+sep+state+sep+scenario+sep+'elevation_final'+sep+'points'+sep |
---|
85 | topographies_dir = anuga_dir+'topographies'+sep |
---|
86 | #topographies_time_dir = topographies_dir+build_time+sep |
---|
87 | |
---|
88 | # input topo file location |
---|
89 | onshore_in_dir_name = topographies_in_dir + onshore_name |
---|
90 | onshore_in_dir_name1 = topographies_in_dir + onshore_name1 |
---|
91 | Singlebeam_in_dir_name = topographies_in_dir + Singlebeam_name |
---|
92 | addedpoint_in_dir_name = topographies_in_dir + addedpoint_name |
---|
93 | #Multibeam_in_dir_name = topographies_in_dir + Multibeam_name |
---|
94 | #Chart_in_dir_name = topographies_in_dir + Chart_name |
---|
95 | #Derived_bath_in_dir_name = topographies_in_dir + Derived_bath_name |
---|
96 | #added_data_in_dir_name = topographies_in_dir + added_data_name |
---|
97 | |
---|
98 | onshore_dir_name = topographies_dir + onshore_name |
---|
99 | onshore_dir_name1 = topographies_dir + onshore_name1 |
---|
100 | Singlebeam_dir_name = topographies_dir + Singlebeam_name |
---|
101 | addedpoint_dir_name = topographies_dir + addedpoint_name |
---|
102 | #Multibeam_dir_name = topographies_dir + Multibeam_name |
---|
103 | #Chart_dir_name = topographies_dir + Chart_name |
---|
104 | #Derived_bath_dir_name = topographies_dir + Derived_bath_name |
---|
105 | #added_data_dir_name = topographies_dir + added_data_name |
---|
106 | |
---|
107 | #final topo files |
---|
108 | combined_dir_name = topographies_dir + combined_name |
---|
109 | #combined_time_dir_name = topographies_time_dir + combined_name |
---|
110 | combined_smaller_name_dir = topographies_dir + combined_smaller_name |
---|
111 | #combined_time_dir_final_name = topographies_time_dir + combined_final_name |
---|
112 | |
---|
113 | meshes_dir = anuga_dir+'meshes'+sep |
---|
114 | meshes_dir_name = meshes_dir + scenario_name |
---|
115 | |
---|
116 | polygons_dir = anuga_dir+'polygons'+sep |
---|
117 | tide_dir = anuga_dir+'tide_data'+sep |
---|
118 | |
---|
119 | |
---|
120 | #boundaries_source = '1' |
---|
121 | |
---|
122 | if source =='dampier': |
---|
123 | boundaries_name = 'broome_3854_17042007' #Dampier gun |
---|
124 | boundaries_in_dir = anuga_dir+'boundaries'+sep+sep+'dampier'+sep+'1_10000'+sep |
---|
125 | |
---|
126 | if source=='onslow': |
---|
127 | boundaries_name = 'broome_3859_16052007' #onslow_hedland_broome gun |
---|
128 | boundaries_in_dir = anuga_dir+'boundaries'+sep+sep+'onslow_hedland_broome'+sep+'1_10000'+sep |
---|
129 | |
---|
130 | if source=='exmouth': |
---|
131 | boundaries_name = 'broome_3103_18052007' #exmouth gun |
---|
132 | boundaries_in_dir = anuga_dir+'boundaries'+sep+sep+'exmouth'+sep+'1_10000'+sep |
---|
133 | |
---|
134 | if source=='test': |
---|
135 | boundaries_name = 'other' #exmouth gun |
---|
136 | boundaries_in_dir = anuga_dir+'boundaries'+sep |
---|
137 | |
---|
138 | |
---|
139 | #boundaries locations |
---|
140 | boundaries_in_dir_name = boundaries_in_dir + scenario_name |
---|
141 | boundaries_dir = anuga_dir+'boundaries'+sep |
---|
142 | boundaries_dir_name = boundaries_dir + scenario_name |
---|
143 | #boundaries_time_dir = anuga_dir+'boundaries'+sep+build_time+sep |
---|
144 | #boundaries_time_dir_name = boundaries_time_dir + boundaries_name #Used by post processing |
---|
145 | |
---|
146 | #output locations |
---|
147 | output_dir = anuga_dir+'outputs'+sep |
---|
148 | output_build_time_dir = anuga_dir+'outputs'+sep+build_time+dir_comment+sep |
---|
149 | output_run_time_dir = anuga_dir+'outputs'+sep+run_time+dir_comment+sep |
---|
150 | output_run_time_dir_name = output_run_time_dir + scenario_name #Used by post processing |
---|
151 | |
---|
152 | #gauges |
---|
153 | gauge_name = 'fangauta_gauge1.csv' |
---|
154 | gauges_dir = anuga_dir+'gauges'+sep |
---|
155 | gauges_dir_name = gauges_dir + gauge_name |
---|
156 | |
---|
157 | #buildings_filename = gauges_dir + 'Perth_res_Project.csv' |
---|
158 | #buildings_filename_out = 'Perth_res_Project_modified.csv' |
---|
159 | |
---|
160 | ############################### |
---|
161 | # Domain definitions |
---|
162 | ############################### |
---|
163 | from anuga.utilities.polygon import read_polygon, plot_polygons, polygon_area, is_inside_polygon |
---|
164 | |
---|
165 | poly_all = read_polygon(polygons_dir+'extent_fangauta.txt') |
---|
166 | res_poly_all = 5000*res_factor |
---|
167 | |
---|
168 | poly_island_Pea= read_polygon(polygons_dir+'poly_fangauta_island1.txt') |
---|
169 | poly_island_Mua= read_polygon(polygons_dir+'poly_fangauta_island2.txt') |
---|
170 | |
---|
171 | boundary_tags={'mouth':[13], |
---|
172 | 'land':[0,1,2,3,4,5,6,7,8,9,10,11,12,14,15]} |
---|
173 | |
---|
174 | area= polygon_area(poly_all) |
---|
175 | trigs_min = area/res_poly_all |
---|
176 | |
---|
177 | print 'min number triangles', trigs_min |
---|
178 | ################################################################### |
---|
179 | # Clipping regions for export to asc and regions for clipping data |
---|
180 | ################################################################### |
---|
181 | |
---|
182 | # exporting asc grid |
---|
183 | eastingmin = 670500 |
---|
184 | eastingmax = 712750 |
---|
185 | northingmin = 7646000 |
---|
186 | northingmax = 7677000 |
---|
187 | |
---|
188 | |
---|
189 | slide_origin = [701290, 7665750] # move onto the continental shelf, depth = 500 |
---|
190 | slide_depth = 207. |
---|
191 | |
---|
192 | |
---|
193 | |
---|
194 | |
---|