1 | """Common filenames for truescale Okushiri Island convergence study |
---|
2 | 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 | # Run parameters |
---|
46 | finaltime=450 |
---|
47 | setup='original' |
---|
48 | |
---|
49 | if setup =='original': |
---|
50 | print 'original resolution' |
---|
51 | base_resolution=1 |
---|
52 | yieldstep=1 |
---|
53 | if setup =='double': |
---|
54 | print 'double original resolution' |
---|
55 | base_resolution=0.5 |
---|
56 | yieldstep=1 |
---|
57 | if setup =='half': |
---|
58 | print 'half original resolution' |
---|
59 | base_resolution=2 |
---|
60 | yieldstep=1 |
---|
61 | if setup =='no polygons': |
---|
62 | print 'half original resolution' |
---|
63 | base_resolution=2 |
---|
64 | yieldstep=1 |
---|
65 | |
---|
66 | |
---|
67 | # Set anuga directories |
---|
68 | anuga_dir = join(home,'anuga')+sep |
---|
69 | |
---|
70 | dir_comment='_'+setup+'_'+str(user) |
---|
71 | |
---|
72 | mesh_dir = join(anuga_dir, 'meshes')+sep |
---|
73 | mesh_name = join(mesh_dir, 'okushiri_truescale') |
---|
74 | |
---|
75 | polygons_dir = join(anuga_dir, 'polygons')+sep # Created with ArcGIS (csv files) |
---|
76 | |
---|
77 | # Output locations |
---|
78 | output_dir = join(anuga_dir, 'outputs')+sep |
---|
79 | output_run_time_dir = output_dir+run_time+dir_comment+sep |
---|
80 | output_run_time_dir_name = output_run_time_dir + output_filename #Used by post processing |
---|
81 | |
---|
82 | # Gauges |
---|
83 | gauges_dir = join(anuga_dir,'gauges')+sep |
---|
84 | gauge_name = 'gauge_location_okushiri.csv' |
---|
85 | gauges_dir_name = gauges_dir+gauge_name |
---|
86 | |
---|
87 | # Vertex coordinates |
---|
88 | vertex_filename = output_run_time_dir+setup+'vertex_coordinates.txt' |
---|
89 | |
---|
90 | #------------------------------ |
---|
91 | # Polygon definitions |
---|
92 | #------------------------------ |
---|
93 | |
---|
94 | poly_all = read_polygon(polygons_dir+'bounding_polygon.csv') |
---|
95 | res_poly_all = 16000*base_resolution |
---|
96 | |
---|
97 | #print 'Area of bounding polygon', polygon_area(poly_all)/1000000.0 |
---|
98 | |
---|
99 | poly_gulleys = read_polygon(polygons_dir+'gulleys_polygon.csv') |
---|
100 | res_gulleys = 3.2*base_resolution |
---|
101 | |
---|
102 | poly_island = read_polygon(polygons_dir+'island_polygon.csv') |
---|
103 | res_island = 32*base_resolution |
---|
104 | |
---|
105 | poly_rhs = read_polygon(polygons_dir+'rhs_polygon.csv') |
---|
106 | res_rhs = 80*base_resolution |
---|
107 | |
---|
108 | interior_regions = [[poly_gulleys,res_gulleys],[poly_island,res_island], |
---|
109 | [poly_rhs,res_rhs]] |
---|
110 | |
---|
111 | trigs_min = number_mesh_triangles(interior_regions, poly_all, res_poly_all) |
---|
112 | |
---|
113 | print 'min number triangles', trigs_min |
---|
114 | |
---|
115 | |
---|
116 | |
---|
117 | |
---|
118 | |
---|
119 | |
---|