1 | """Common filenames and run parameters for truescale Okushiri Island |
---|
2 | convergence study. Formats are given as ANUGA native netCDF where applicable. |
---|
3 | |
---|
4 | """ |
---|
5 | from os import sep, environ, getenv, getcwd, umask |
---|
6 | from os.path import expanduser, basename, join |
---|
7 | from anuga.utilities.polygon import read_polygon, plot_polygons, polygon_area, is_inside_polygon, number_mesh_triangles |
---|
8 | import sys |
---|
9 | from anuga.coordinate_transforms.redfearn import degminsec2decimal_degrees |
---|
10 | from time import localtime, strftime, gmtime |
---|
11 | from anuga.utilities.system_tools import get_user_name, get_host_name |
---|
12 | |
---|
13 | home = join(getenv('INUNDATIONHOME'),'data', 'anuga_validation', |
---|
14 | 'convergence_okushiri_2008') # Location of Data |
---|
15 | user = get_user_name() |
---|
16 | host = get_host_name() |
---|
17 | #needed when running using mpirun, mpirun doesn't inherit umask from .bashrc |
---|
18 | umask(002) |
---|
19 | |
---|
20 | #------------------- |
---|
21 | # Input file names |
---|
22 | #------------------- |
---|
23 | |
---|
24 | # Given boundary wave |
---|
25 | boundary_filename = 'okushiri_truescale_input.tms' |
---|
26 | |
---|
27 | # Observed timeseries |
---|
28 | validation_filename = 'okushiri_output_truescale_ch5-7-9.txt' |
---|
29 | |
---|
30 | # Digital Elevation Model |
---|
31 | bathymetry_filename = 'okushiri_truescale_bathymetry.pts' |
---|
32 | |
---|
33 | |
---|
34 | #------------------------------------ |
---|
35 | # Output file names and directories |
---|
36 | #------------------------------------ |
---|
37 | |
---|
38 | # Model output |
---|
39 | output_filename = 'okushiri_truescale.sww' |
---|
40 | |
---|
41 | # Time stuff |
---|
42 | time = strftime('%Y%m%d_%H%M%S',gmtime()) #gets time for new dir |
---|
43 | run_time = time+'_run' |
---|
44 | |
---|
45 | # Set anuga input directory names |
---|
46 | |
---|
47 | anuga_dir = join(home,'anuga')+sep |
---|
48 | |
---|
49 | mesh_dir = join(anuga_dir, 'meshes')+sep |
---|
50 | mesh_name = join(mesh_dir, 'okushiri_truescale') |
---|
51 | |
---|
52 | polygons_dir = join(anuga_dir, 'polygons')+sep # Created with ArcGIS (csv files) |
---|
53 | |
---|
54 | #------------------------ |
---|
55 | # Run parameters |
---|
56 | #------------------------ |
---|
57 | |
---|
58 | finaltime=450 |
---|
59 | setup='sixteen' |
---|
60 | polygons = 'contour_polygons' |
---|
61 | |
---|
62 | if setup =='no polygons': |
---|
63 | print 'no interior polygons' |
---|
64 | base_resolution=1 |
---|
65 | yieldstep=1 |
---|
66 | if setup =='octuple': |
---|
67 | print '8 times original resolution' |
---|
68 | base_resolution=0.125 |
---|
69 | yieldstep=1 |
---|
70 | if setup =='sixteen': |
---|
71 | print '16 times original resolution' |
---|
72 | base_resolution=0.0625 |
---|
73 | yieldstep=1 |
---|
74 | if setup =='quadruple': |
---|
75 | print '4 times original resolution' |
---|
76 | base_resolution=0.25 |
---|
77 | yieldstep=1 |
---|
78 | if setup =='double': |
---|
79 | print 'double original resolution' |
---|
80 | base_resolution=0.5 |
---|
81 | yieldstep=1 |
---|
82 | if setup =='1.5': |
---|
83 | print '1.5 times original resolution' |
---|
84 | base_resolution=0.66 |
---|
85 | yieldstep=1 |
---|
86 | if setup =='original': |
---|
87 | print 'original resolution' |
---|
88 | base_resolution=1 |
---|
89 | yieldstep=1 |
---|
90 | if setup =='0.75': |
---|
91 | print '0.75 times original resolution' |
---|
92 | base_resolution=1.33 |
---|
93 | yieldstep=1 |
---|
94 | if setup =='half': |
---|
95 | print 'half original resolution' |
---|
96 | base_resolution=2 |
---|
97 | yieldstep=1 |
---|
98 | if setup =='quarter': |
---|
99 | print '1/4 original resolution' |
---|
100 | base_resolution=4 |
---|
101 | yieldstep=1 |
---|
102 | if setup =='eighth': |
---|
103 | print '1/8 original resolution' |
---|
104 | base_resolution=8 |
---|
105 | yieldstep=1 |
---|
106 | if setup =='sixteenth': |
---|
107 | print '1/16 original resolution' |
---|
108 | base_resolution=16 |
---|
109 | yieldstep = 1 |
---|
110 | if setup =='1-32': |
---|
111 | print '1/32 original resolution' |
---|
112 | base_resolution=32 |
---|
113 | yieldstep=1 |
---|
114 | if setup =='1-64': |
---|
115 | print '1/64 original resolution' |
---|
116 | base_resolution=64 |
---|
117 | yieldstep=1 |
---|
118 | |
---|
119 | |
---|
120 | #------------------------------ |
---|
121 | # Polygon definitions |
---|
122 | #------------------------------ |
---|
123 | |
---|
124 | poly_all = read_polygon(polygons_dir+'bounding_polygon.csv') |
---|
125 | res_poly_all = 16000*base_resolution |
---|
126 | |
---|
127 | # Original polygon definitions |
---|
128 | |
---|
129 | poly_gulleys = read_polygon(polygons_dir+'gulleys_polygon.csv') |
---|
130 | res_gulleys = 3.2*base_resolution |
---|
131 | |
---|
132 | poly_island = read_polygon(polygons_dir+'island_polygon.csv') |
---|
133 | res_island = 32*base_resolution |
---|
134 | |
---|
135 | poly_rhs = read_polygon(polygons_dir+'rhs_polygon.csv') |
---|
136 | res_rhs = 80*base_resolution |
---|
137 | |
---|
138 | |
---|
139 | # Contour-based polygon definitions |
---|
140 | |
---|
141 | poly_25 = read_polygon(polygons_dir+'polygon_25m.csv') |
---|
142 | res_poly_25 = 800*base_resolution |
---|
143 | |
---|
144 | poly_10 = read_polygon(polygons_dir+'polygon_10m.csv') |
---|
145 | res_poly_10 = 80*base_resolution |
---|
146 | |
---|
147 | poly_5 = read_polygon(polygons_dir+'polygon_5m.csv') |
---|
148 | res_poly_5 = 32*base_resolution |
---|
149 | |
---|
150 | poly_1 = read_polygon(polygons_dir+'polygon_1m.csv') |
---|
151 | res_poly_1 = 10*base_resolution |
---|
152 | |
---|
153 | |
---|
154 | if polygons =='original_polygons': |
---|
155 | print 'original polygon definition' |
---|
156 | interior_regions = [[poly_gulleys,res_gulleys],[poly_island,res_island], |
---|
157 | [poly_rhs,res_rhs]] |
---|
158 | |
---|
159 | if polygons =='contour_polygons': |
---|
160 | print 'contour-based polygon definition' |
---|
161 | interior_regions = [[poly_25,res_poly_25],[poly_10,res_poly_10], |
---|
162 | [poly_5,res_poly_5],[poly_1,res_poly_1] ] |
---|
163 | |
---|
164 | |
---|
165 | trigs_min = number_mesh_triangles(interior_regions, poly_all, res_poly_all) |
---|
166 | print 'min number triangles', trigs_min |
---|
167 | |
---|
168 | this_area = polygon_area(poly_all) |
---|
169 | print this_area |
---|
170 | |
---|
171 | |
---|
172 | # Polygon QC |
---|
173 | #polygon_plot='polygons.png' |
---|
174 | #plot_polygons([poly_all, poly_25, poly_10, poly_5, poly_1], style=None, figname=polygon_plot) |
---|
175 | |
---|
176 | |
---|
177 | #-------------------------------- |
---|
178 | # Set anuga output locations |
---|
179 | #-------------------------------- |
---|
180 | |
---|
181 | # Directory comment |
---|
182 | dir_comment='_'+setup+'_'+polygons+'_'+str(user) |
---|
183 | |
---|
184 | output_dir = join(anuga_dir, 'outputs')+sep |
---|
185 | output_run_time_dir = output_dir+run_time+dir_comment+sep |
---|
186 | output_run_time_dir_name = output_run_time_dir + output_filename #Used by post processing |
---|
187 | |
---|
188 | # Gauges |
---|
189 | gauges_dir = join(anuga_dir,'gauges')+sep |
---|
190 | gauge_name = 'gauge_location_okushiri.csv' |
---|
191 | gauges_dir_name = gauges_dir+gauge_name |
---|
192 | |
---|
193 | # Vertex coordinates |
---|
194 | vertex_filename = output_run_time_dir+'vertex_coordinates.txt' |
---|
195 | |
---|
196 | |
---|
197 | #-------------------------------- |
---|
198 | # Area definitions for sww2dem |
---|
199 | #-------------------------------- |
---|
200 | |
---|
201 | xminDeep = 0 |
---|
202 | xmaxDeep = 950 |
---|
203 | yminDeep = 0 |
---|
204 | ymaxDeep = 1400 |
---|
205 | |
---|
206 | xminMid = 1000 |
---|
207 | xmaxMid = 1700 |
---|
208 | yminMid = 0 |
---|
209 | ymaxMid = 1400 |
---|
210 | |
---|
211 | xminShallow = 1725 |
---|
212 | xmaxShallow = 2175 |
---|
213 | yminShallow = 0 |
---|
214 | ymaxShallow = 1400 |
---|
215 | |
---|
216 | |
---|
217 | |
---|
218 | |
---|
219 | |
---|