1 | """Common filenames and locations for topographic data, meshes and outputs. |
---|
2 | Also includes origin for slump scenario. |
---|
3 | """ |
---|
4 | |
---|
5 | from os import sep, environ, getenv, getcwd,umask |
---|
6 | from os.path import expanduser, basename |
---|
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 | #codename = 'project.py' |
---|
14 | |
---|
15 | home = getenv('INUNDATIONHOME') + sep +'data'+sep #Sandpit's parent dir |
---|
16 | user = get_user_name() |
---|
17 | host = get_host_name() |
---|
18 | #needed when running using mpirun, mpirun doesn't inherit umask from .bashrc |
---|
19 | #umask(002) |
---|
20 | |
---|
21 | #Making assumptions about the location of scenario data |
---|
22 | state = 'western_australia' |
---|
23 | scenario_name = 'exmouth' |
---|
24 | scenario = 'exmouth_tsunami_scenario' |
---|
25 | |
---|
26 | #time stuff |
---|
27 | time = strftime('%Y%m%d_%H%M%S',gmtime()) #gets time for new dir |
---|
28 | build_time = time+'_build' |
---|
29 | run_time = time+'_run' |
---|
30 | |
---|
31 | #tide = -1.4 |
---|
32 | #tide = 0 |
---|
33 | tide = 1.4 |
---|
34 | |
---|
35 | #Maybe will try to make project a class to allow these parameters to be passed in. |
---|
36 | alpha = 0.1 |
---|
37 | friction=0.01 |
---|
38 | starttime=3600 |
---|
39 | finaltime=25000 |
---|
40 | setup='store' |
---|
41 | |
---|
42 | if setup =='trial': |
---|
43 | print'trial' |
---|
44 | res_factor=10 |
---|
45 | time_thinning=48 |
---|
46 | yieldstep=240 |
---|
47 | if setup =='basic': |
---|
48 | print'basic' |
---|
49 | res_factor=4 |
---|
50 | time_thinning=12 |
---|
51 | yieldstep=120 |
---|
52 | if setup =='final': |
---|
53 | print'final' |
---|
54 | res_factor=1 |
---|
55 | time_thinning=1 |
---|
56 | yieldstep=60 |
---|
57 | if setup =='store': |
---|
58 | print'store' |
---|
59 | res_factor=10 |
---|
60 | time_thinning=48 |
---|
61 | yieldstep=240 |
---|
62 | |
---|
63 | |
---|
64 | dir_comment='_'+setup+'_'+str(tide)+'_'+str(user) |
---|
65 | |
---|
66 | onshore_name = 'DLI' |
---|
67 | onshore_name1 = 'DTED' |
---|
68 | # offshore |
---|
69 | offshore_name = 'Exmouth_bathymetry' |
---|
70 | #offshore_name1 = 'inferred_north' |
---|
71 | #offshore_name2 = 'inferred_south' |
---|
72 | coast_name = 'Exmouth_coastline' |
---|
73 | |
---|
74 | #final topo name |
---|
75 | combined_name ='exmouth_combined_elevation' |
---|
76 | #combined_name1 ='exmouth_combined_elevation1' |
---|
77 | #combined_name_unclipped1 ='exmouth_combined_elevation_unclipped1' |
---|
78 | combined_small_name = 'exmouth_combined_elevation_small' |
---|
79 | |
---|
80 | anuga_dir = home+state+sep+scenario+sep+'anuga'+sep |
---|
81 | |
---|
82 | topographies_in_dir = home+state+sep+scenario+sep+'elevation_final'+sep+'points'+sep |
---|
83 | topographies_dir = anuga_dir+'topographies'+sep |
---|
84 | |
---|
85 | # input topo file location |
---|
86 | onshore_in_dir_name = topographies_in_dir + onshore_name |
---|
87 | onshore1_in_dir_name = topographies_in_dir + onshore_name1 |
---|
88 | coast_in_dir_name = topographies_in_dir + coast_name |
---|
89 | offshore_in_dir_name = topographies_in_dir + offshore_name |
---|
90 | #offshore_in_dir_name1 = topographies_in_dir + offshore_name1 |
---|
91 | #offshore_in_dir_name2 = topographies_in_dir + offshore_name2 |
---|
92 | |
---|
93 | onshore_dir_name = topographies_dir + onshore_name |
---|
94 | onshore1_dir_name = topographies_dir + onshore_name1 |
---|
95 | coast_dir_name = topographies_dir + coast_name |
---|
96 | offshore_dir_name = topographies_dir + offshore_name |
---|
97 | #offshore_dir_name1 = topographies_dir + offshore_name1 |
---|
98 | #offshore_dir_name2 = topographies_dir + offshore_name2 |
---|
99 | |
---|
100 | #final topo files |
---|
101 | combined_dir_name = topographies_dir + combined_name |
---|
102 | #combined_dir_name_unclipped1 = topographies_dir + combined_name_unclipped1 |
---|
103 | #combined_dir_name1 = topographies_dir + combined_name1 |
---|
104 | combined_small_dir_name = topographies_dir + combined_small_name |
---|
105 | |
---|
106 | meshes_dir = anuga_dir+'meshes'+sep |
---|
107 | meshes_dir_name = meshes_dir + scenario_name |
---|
108 | |
---|
109 | polygons_dir = anuga_dir+'polygons'+sep |
---|
110 | tide_dir = anuga_dir+'tide_data'+sep |
---|
111 | |
---|
112 | #boundaries locations |
---|
113 | boundaries_name = 'exmouth_3854_17042007' |
---|
114 | |
---|
115 | boundaries_in_dir = anuga_dir+'boundaries'+sep+'urs'+sep+'dampier'+sep+'1_10000'+sep |
---|
116 | boundaries_in_dir_name = boundaries_in_dir + boundaries_name |
---|
117 | boundaries_dir = anuga_dir+'boundaries'+sep |
---|
118 | boundaries_dir_name = boundaries_dir + boundaries_name |
---|
119 | |
---|
120 | #output locations |
---|
121 | output_dir = anuga_dir+'outputs'+sep |
---|
122 | output_build_time_dir = output_dir+build_time+sep |
---|
123 | output_run_time_dir = output_dir +run_time+dir_comment+sep |
---|
124 | output_run_time_dir_name = output_run_time_dir + scenario_name #Used by post processing |
---|
125 | |
---|
126 | #gauges |
---|
127 | gauge_name = 'exmouth_gauges.csv' |
---|
128 | gauges_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'gauges'+sep |
---|
129 | gauges_dir_name = gauges_dir + gauge_name |
---|
130 | |
---|
131 | community_filename = gauges_dir + 'CHINS_v2.csv' |
---|
132 | community_exmouth = gauges_dir + 'community_exmouth.csv' |
---|
133 | |
---|
134 | buildings_filename = 'Exmouth_res_Project.csv' |
---|
135 | buildings_filename_out = 'Exmouth_res_Project_modified.csv' |
---|
136 | |
---|
137 | ############################### |
---|
138 | # Domain definitions |
---|
139 | ############################### |
---|
140 | from anuga.utilities.polygon import read_polygon, plot_polygons, polygon_area, is_inside_polygon |
---|
141 | |
---|
142 | poly_all = read_polygon(polygons_dir+'extent_more_points.csv') |
---|
143 | |
---|
144 | print 'Area of bounding polygon', polygon_area(poly_all)/1000000.0 |
---|
145 | |
---|
146 | res_poly_all = 150000*res_factor |
---|
147 | |
---|
148 | ############################### |
---|
149 | # Interior region definitions |
---|
150 | ############################### |
---|
151 | |
---|
152 | |
---|
153 | poly_coast = read_polygon(polygons_dir+'pts_coast.csv') |
---|
154 | res_coast = 10000*res_factor |
---|
155 | |
---|
156 | poly_coast1 = read_polygon(polygons_dir+'pts_coast1.csv') |
---|
157 | #res_0 = 20000*res_factor |
---|
158 | |
---|
159 | poly_coast2 = read_polygon(polygons_dir+'pts_coast2.csv') |
---|
160 | #res_0 = 20000*res_factor |
---|
161 | |
---|
162 | poly_coast3 = read_polygon(polygons_dir+'pts_coast3.csv') |
---|
163 | #res_0 = 20000*res_factor |
---|
164 | |
---|
165 | poly_exmouth = read_polygon(polygons_dir+'pts_exmouth.csv') |
---|
166 | res_exmouth = 500*res_factor |
---|
167 | |
---|
168 | poly_nth_defence = read_polygon(polygons_dir+'pts_nth_defence.csv') |
---|
169 | res_nth_defence = 5000*res_factor |
---|
170 | |
---|
171 | poly_middle = read_polygon(polygons_dir+'pts_middle.csv') |
---|
172 | res_middle = 30000*res_factor |
---|
173 | |
---|
174 | poly_airport = read_polygon(polygons_dir+'pts_airport.csv') |
---|
175 | res_airport = 5000*res_factor |
---|
176 | |
---|
177 | interior_regions = [[poly_coast,res_coast],[poly_coast1,res_coast],[poly_coast2,res_coast] |
---|
178 | ,[poly_coast3,res_coast],[poly_middle,res_middle],[poly_exmouth,res_exmouth] |
---|
179 | ,[poly_nth_defence,res_nth_defence],[poly_airport,res_airport]] |
---|
180 | |
---|
181 | trigs_min = number_mesh_triangles(interior_regions, poly_all, res_poly_all) |
---|
182 | |
---|
183 | print 'min number triangles', trigs_min |
---|
184 | |
---|
185 | poly_mainland = read_polygon(polygons_dir+'Initial_Condition.csv') |
---|
186 | |
---|
187 | ################################################################### |
---|
188 | # Clipping regions for export to asc and regions for clipping data |
---|
189 | ################################################################### |
---|
190 | |
---|
191 | # exporting asc grid |
---|
192 | eastingmin = 406215.87 |
---|
193 | eastingmax = 440208.78 |
---|
194 | northingmin = 7983427.73 |
---|
195 | northingmax = 8032834.52 |
---|