1 | # -*- coding: cp1252 -*- |
---|
2 | """Common filenames and locations for topographic data, meshes and outputs. |
---|
3 | Also includes origin for slump scenario. |
---|
4 | """ |
---|
5 | |
---|
6 | from os import sep, environ, getenv, getcwd,umask |
---|
7 | from os.path import expanduser, basename |
---|
8 | from anuga.utilities.polygon import read_polygon, plot_polygons, polygon_area, is_inside_polygon, number_mesh_triangles |
---|
9 | import sys |
---|
10 | from anuga.coordinate_transforms.redfearn import degminsec2decimal_degrees |
---|
11 | from time import localtime, strftime, gmtime |
---|
12 | from anuga.utilities.system_tools import get_user_name, get_host_name |
---|
13 | |
---|
14 | codename = 'project.py' |
---|
15 | |
---|
16 | home = getenv('INUNDATIONHOME') + sep +'data'+sep #Sandpit's parent dir |
---|
17 | user = get_user_name() |
---|
18 | host = get_host_name() |
---|
19 | #needed when running using mpirun, mpirun doesn't inherit umask from .bashrc |
---|
20 | umask(002) |
---|
21 | |
---|
22 | |
---|
23 | #Making assumptions about the location of scenario data |
---|
24 | state = 'western_australia' |
---|
25 | scenario_name = 'broome' |
---|
26 | scenario = 'broome_tsunami_scenario_2006' |
---|
27 | |
---|
28 | #time stuff |
---|
29 | time = strftime('%Y%m%d_%H%M%S',gmtime()) #gets time for new dir |
---|
30 | build_time = time+'_build' |
---|
31 | run_time = time+'_run' |
---|
32 | |
---|
33 | #tide = -5.3 |
---|
34 | tide = 0 |
---|
35 | #tide = 4.9 |
---|
36 | |
---|
37 | #Maybe will try to make project a class to allow these parameters to be passed in. |
---|
38 | alpha = 0.1 |
---|
39 | friction=0.01 |
---|
40 | starttime=3600 |
---|
41 | finaltime=25000 |
---|
42 | setup='final' |
---|
43 | |
---|
44 | if setup =='trial': |
---|
45 | print'trial' |
---|
46 | res_factor=10 |
---|
47 | time_thinning=48 |
---|
48 | yieldstep=240 |
---|
49 | if setup =='basic': |
---|
50 | print'basic' |
---|
51 | res_factor=4 |
---|
52 | time_thinning=12 |
---|
53 | yieldstep=120 |
---|
54 | if setup =='final': |
---|
55 | print'final' |
---|
56 | res_factor=1 |
---|
57 | time_thinning=4 |
---|
58 | yieldstep=60 |
---|
59 | |
---|
60 | dir_comment='_'+setup+'_'+str(tide)+'_'+str(user) |
---|
61 | |
---|
62 | # onshore data from 30m DTED level 2 |
---|
63 | onshore_name = 'Broome_topography_DLI' # original |
---|
64 | # offshore |
---|
65 | offshore_name = 'Broome_Bathymetry' |
---|
66 | offshore_name1 = 'inferred_north' |
---|
67 | offshore_name2 = 'inferred_south' |
---|
68 | coast_name = 'Broome_coastline' |
---|
69 | |
---|
70 | #final topo name |
---|
71 | combined_name ='broome_combined_elevation' |
---|
72 | combined_name1 ='broome_combined_elevation1' |
---|
73 | combined_name_unclipped1 ='broome_combined_elevation_unclipped1' |
---|
74 | combined_small_name = 'broome_combined_elevation_small' |
---|
75 | |
---|
76 | anuga_dir = home+state+sep+scenario+sep+'anuga'+sep |
---|
77 | |
---|
78 | topographies_in_dir = home+state+sep+scenario+sep+'elevation_final'+sep+'points'+sep+'Feb07'+sep |
---|
79 | topographies_dir = anuga_dir+'topographies'+sep |
---|
80 | |
---|
81 | # input topo file location |
---|
82 | onshore_in_dir_name = topographies_in_dir + onshore_name |
---|
83 | coast_in_dir_name = topographies_in_dir + coast_name |
---|
84 | offshore_in_dir_name = topographies_in_dir + offshore_name |
---|
85 | offshore_in_dir_name1 = topographies_in_dir + offshore_name1 |
---|
86 | offshore_in_dir_name2 = topographies_in_dir + offshore_name2 |
---|
87 | |
---|
88 | onshore_dir_name = topographies_dir + onshore_name |
---|
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_name_dir = 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 = 'broome_3854_17042007' |
---|
108 | |
---|
109 | boundaries_in_dir = anuga_dir+'boundaries'+sep+'urs'+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 = 'broome_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_broome = gauges_dir + 'community_broome.csv' |
---|
127 | |
---|
128 | buildings_filename = gauges_dir + 'Broome_res_Project.csv' |
---|
129 | buildings_filename_out = 'Broome_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_small.csv') |
---|
137 | #poly_all = read_polygon(polygons_dir+'extent.csv') |
---|
138 | res_poly_all = 150000*res_factor |
---|
139 | |
---|
140 | ############################### |
---|
141 | # Interior region definitions |
---|
142 | ############################### |
---|
143 | |
---|
144 | poly_0 = read_polygon(polygons_dir+'neg20_coast_contour_pts.csv') |
---|
145 | res_0 = 20000*res_factor |
---|
146 | |
---|
147 | poly_1 = read_polygon(polygons_dir+'broome_north_coast_inside_extent.csv') |
---|
148 | res_1 = 5000*res_factor |
---|
149 | |
---|
150 | poly_2 = read_polygon(polygons_dir+'broome_south_coast_inside_extent.csv') |
---|
151 | res_2 = 5000*res_factor |
---|
152 | |
---|
153 | poly_3 = read_polygon(polygons_dir+'Broome_town_pts.csv') |
---|
154 | res_3 = 2000*res_factor |
---|
155 | |
---|
156 | poly_4 = read_polygon(polygons_dir+'Broome_inner_town_pts.csv') |
---|
157 | res_4 = 500*res_factor |
---|
158 | |
---|
159 | interior_regions = [[poly_0,res_0],[poly_1,res_1],[poly_2,res_2] |
---|
160 | ,[poly_3,res_3],[poly_4,res_4]] |
---|
161 | |
---|
162 | trigs_min = number_mesh_triangles(interior_regions, poly_all, res_poly_all) |
---|
163 | |
---|
164 | print 'min number triangles', trigs_min |
---|
165 | |
---|
166 | poly_mainland = read_polygon(polygons_dir+'Initial_Condition.csv') |
---|
167 | |
---|
168 | ################################################################### |
---|
169 | # Clipping regions for export to asc and regions for clipping data |
---|
170 | ################################################################### |
---|
171 | |
---|
172 | # exporting asc grid |
---|
173 | e_min_area = 412000.0 |
---|
174 | e_max_area = 423000.0 |
---|
175 | n_min_area = 8007000.0 |
---|
176 | n_max_area = 8022000.0 |
---|