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='trial' |
---|
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 | |
---|
58 | dir_comment='_'+setup+'_'+str(tide)+'_'+str(user) |
---|
59 | |
---|
60 | onshore_name = 'DLI' |
---|
61 | onshore_name1 = 'DTED' |
---|
62 | # offshore |
---|
63 | offshore_name = 'Exmouth_bathymetry' |
---|
64 | #offshore_name1 = 'inferred_north' |
---|
65 | #offshore_name2 = 'inferred_south' |
---|
66 | coast_name = 'Exmouth_coastline' |
---|
67 | |
---|
68 | #final topo name |
---|
69 | combined_name ='exmouth_combined_elevation' |
---|
70 | #combined_name1 ='exmouth_combined_elevation1' |
---|
71 | #combined_name_unclipped1 ='exmouth_combined_elevation_unclipped1' |
---|
72 | combined_small_name = 'exmouth_combined_elevation_small' |
---|
73 | |
---|
74 | anuga_dir = home+state+sep+scenario+sep+'anuga'+sep |
---|
75 | |
---|
76 | topographies_in_dir = home+state+sep+scenario+sep+'elevation_final'+sep+'points'+sep |
---|
77 | topographies_dir = anuga_dir+'topographies'+sep |
---|
78 | |
---|
79 | # input topo file location |
---|
80 | onshore_in_dir_name = topographies_in_dir + onshore_name |
---|
81 | onshore1_in_dir_name = topographies_in_dir + onshore_name1 |
---|
82 | coast_in_dir_name = topographies_in_dir + coast_name |
---|
83 | offshore_in_dir_name = topographies_in_dir + offshore_name |
---|
84 | #offshore_in_dir_name1 = topographies_in_dir + offshore_name1 |
---|
85 | #offshore_in_dir_name2 = topographies_in_dir + offshore_name2 |
---|
86 | |
---|
87 | onshore_dir_name = topographies_dir + onshore_name |
---|
88 | onshore1_dir_name = topographies_dir + onshore_name1 |
---|
89 | coast_dir_name = topographies_dir + coast_name |
---|
90 | offshore_dir_name = topographies_dir + offshore_name |
---|
91 | #offshore_dir_name1 = topographies_dir + offshore_name1 |
---|
92 | #offshore_dir_name2 = topographies_dir + offshore_name2 |
---|
93 | |
---|
94 | #final topo files |
---|
95 | combined_dir_name = topographies_dir + combined_name |
---|
96 | #combined_dir_name_unclipped1 = topographies_dir + combined_name_unclipped1 |
---|
97 | #combined_dir_name1 = topographies_dir + combined_name1 |
---|
98 | combined_small_dir_name = topographies_dir + combined_small_name |
---|
99 | |
---|
100 | meshes_dir = anuga_dir+'meshes'+sep |
---|
101 | meshes_dir_name = meshes_dir + scenario_name |
---|
102 | |
---|
103 | polygons_dir = anuga_dir+'polygons'+sep |
---|
104 | tide_dir = anuga_dir+'tide_data'+sep |
---|
105 | |
---|
106 | #boundaries locations |
---|
107 | boundaries_name = 'exmouth_3854_17042007' |
---|
108 | |
---|
109 | boundaries_in_dir = anuga_dir+'boundaries'+sep+'urs'+sep+'dampier'+sep+'1_10000'+sep |
---|
110 | boundaries_in_dir_name = boundaries_in_dir + boundaries_name |
---|
111 | boundaries_dir = anuga_dir+'boundaries'+sep |
---|
112 | boundaries_dir_name = boundaries_dir + boundaries_name |
---|
113 | |
---|
114 | #output locations |
---|
115 | output_dir = anuga_dir+'outputs'+sep |
---|
116 | output_build_time_dir = output_dir+build_time+sep |
---|
117 | output_run_time_dir = output_dir +run_time+dir_comment+sep |
---|
118 | output_run_time_dir_name = output_run_time_dir + scenario_name #Used by post processing |
---|
119 | |
---|
120 | #gauges |
---|
121 | gauge_name = 'exmouth_gauges.csv' |
---|
122 | gauges_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'gauges'+sep |
---|
123 | gauges_dir_name = gauges_dir + gauge_name |
---|
124 | |
---|
125 | community_filename = gauges_dir + 'CHINS_v2.csv' |
---|
126 | community_exmouth = gauges_dir + 'community_exmouth.csv' |
---|
127 | |
---|
128 | buildings_filename = 'Exmouth_res_Project.csv' |
---|
129 | buildings_filename_out = 'Exmouth_res_Project_modified.csv' |
---|
130 | |
---|
131 | ############################### |
---|
132 | # Domain definitions |
---|
133 | ############################### |
---|
134 | from anuga.utilities.polygon import read_polygon, plot_polygons, polygon_area, is_inside_polygon |
---|
135 | |
---|
136 | poly_all = read_polygon(polygons_dir+'extent_more_points.csv') |
---|
137 | |
---|
138 | print 'Area of bounding polygon', polygon_area(poly_all)/1000000.0 |
---|
139 | |
---|
140 | res_poly_all = 150000*res_factor |
---|
141 | |
---|
142 | ############################### |
---|
143 | # Interior region definitions |
---|
144 | ############################### |
---|
145 | |
---|
146 | |
---|
147 | poly_coast = read_polygon(polygons_dir+'pts_coast.csv') |
---|
148 | res_coast = 10000*res_factor |
---|
149 | |
---|
150 | poly_coast1 = read_polygon(polygons_dir+'pts_coast1.csv') |
---|
151 | #res_0 = 20000*res_factor |
---|
152 | |
---|
153 | poly_coast2 = read_polygon(polygons_dir+'pts_coast2.csv') |
---|
154 | #res_0 = 20000*res_factor |
---|
155 | |
---|
156 | poly_coast3 = read_polygon(polygons_dir+'pts_coast3.csv') |
---|
157 | #res_0 = 20000*res_factor |
---|
158 | |
---|
159 | poly_exmouth = read_polygon(polygons_dir+'pts_exmouth.csv') |
---|
160 | res_exmouth = 500*res_factor |
---|
161 | |
---|
162 | poly_nth_defence = read_polygon(polygons_dir+'pts_nth_defence.csv') |
---|
163 | res_nth_defence = 5000*res_factor |
---|
164 | |
---|
165 | poly_middle = read_polygon(polygons_dir+'pts_middle.csv') |
---|
166 | res_middle = 30000*res_factor |
---|
167 | |
---|
168 | poly_airport = read_polygon(polygons_dir+'pts_airport.csv') |
---|
169 | res_airport = 5000*res_factor |
---|
170 | |
---|
171 | interior_regions = [[poly_coast,res_coast],[poly_coast1,res_coast],[poly_coast2,res_coast] |
---|
172 | ,[poly_coast3,res_coast],[poly_middle,res_middle],[poly_exmouth,res_exmouth] |
---|
173 | ,[poly_nth_defence,res_nth_defence],[poly_airport,res_airport]] |
---|
174 | |
---|
175 | trigs_min = number_mesh_triangles(interior_regions, poly_all, res_poly_all) |
---|
176 | |
---|
177 | print 'min number triangles', trigs_min |
---|
178 | |
---|
179 | poly_mainland = read_polygon(polygons_dir+'Initial_Condition.csv') |
---|
180 | |
---|
181 | ################################################################### |
---|
182 | # Clipping regions for export to asc and regions for clipping data |
---|
183 | ################################################################### |
---|
184 | |
---|
185 | # exporting asc grid |
---|
186 | eastingmin = 406215.87 |
---|
187 | eastingmax = 440208.78 |
---|
188 | northingmin = 7983427.73 |
---|
189 | northingmax = 8032834.52 |
---|