1 | # -*- coding: cp1252 -*- |
---|
2 | """Common filenames and locations for topographic data, meshes and outputs. |
---|
3 | """ |
---|
4 | |
---|
5 | from os import sep, environ, getenv, getcwd ,umask |
---|
6 | from os.path import expanduser |
---|
7 | import sys |
---|
8 | from time import localtime, strftime, gmtime |
---|
9 | from anuga.utilities.polygon import read_polygon, plot_polygons, is_inside_polygon, number_mesh_triangles |
---|
10 | #from anuga.coordinate_transforms.redfearn import degminsec2decimal_degrees, convert_points_from_latlon_to_utm |
---|
11 | from anuga.utilities.system_tools import get_user_name, get_host_name |
---|
12 | |
---|
13 | # file and system info |
---|
14 | #--------------------------------- |
---|
15 | |
---|
16 | home = getenv('INUNDATIONHOME') + sep +'data'+sep #Sandpit's parent dir |
---|
17 | user = get_user_name() |
---|
18 | host = get_host_name() |
---|
19 | # INUNDATIONHOME is the inundation directory, not the data directory. |
---|
20 | |
---|
21 | #needed when running using mpirun, mpirun doesn't inherit umask from .bashrc |
---|
22 | umask(002) |
---|
23 | |
---|
24 | #time stuff |
---|
25 | time = strftime('%Y%m%d_%H%M%S',localtime()) #gets time for new dir |
---|
26 | build_time = time+'_build' |
---|
27 | run_time = time+'_run' |
---|
28 | |
---|
29 | tide = 0.6 |
---|
30 | |
---|
31 | #Making assumptions about the location of scenario data |
---|
32 | state = 'western_australia' |
---|
33 | scenario_name = 'carnarvon' |
---|
34 | scenario = 'carnarvon_tsunami_scenario' |
---|
35 | |
---|
36 | #Maybe will try to make project a class to allow these parameters to be passed in. |
---|
37 | alpha = 0.1 |
---|
38 | friction=0.01 |
---|
39 | starttime=10000 |
---|
40 | midtime=21600 |
---|
41 | finaltime=25000 |
---|
42 | export_cellsize=50 |
---|
43 | setup='final' |
---|
44 | source='other' |
---|
45 | |
---|
46 | |
---|
47 | if setup =='trial': |
---|
48 | print'trial' |
---|
49 | res_factor=10 |
---|
50 | time_thinning=48 |
---|
51 | yieldstep=240 |
---|
52 | if setup =='basic': |
---|
53 | print'basic' |
---|
54 | res_factor=4 |
---|
55 | time_thinning=12 |
---|
56 | yieldstep=120 |
---|
57 | if setup =='final': |
---|
58 | print'final' |
---|
59 | res_factor=1 |
---|
60 | time_thinning=4 |
---|
61 | yieldstep=60 |
---|
62 | |
---|
63 | dir_comment='_'+setup+'_'+str(tide)+'_'+str(source)+'_'+str(user) |
---|
64 | |
---|
65 | |
---|
66 | # onshore data provided by WA DLI |
---|
67 | onshore_name = 'DLI_orthophoto_DEM' # original |
---|
68 | #islands |
---|
69 | |
---|
70 | # AHO + DPI data |
---|
71 | coast_name = '100k_coastline' |
---|
72 | offshore_name = 'Bathymetry' |
---|
73 | |
---|
74 | #final topo name |
---|
75 | combined_name ='carnarvon_combined_elevation.pts' |
---|
76 | combined_smaller_name = 'carnarvon_combined_elevation_smaller' |
---|
77 | |
---|
78 | anuga_dir = home+state+sep+scenario+sep+'anuga'+sep |
---|
79 | |
---|
80 | topographies_in_dir = home+sep+state+sep+scenario+sep+'elevation_final'+sep+'points'+sep |
---|
81 | topographies_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'topographies'+sep |
---|
82 | |
---|
83 | #input topo file location |
---|
84 | onshore_in_dir_name = topographies_in_dir + onshore_name |
---|
85 | #island_in_dir_name = topographies_in_dir + island_name |
---|
86 | |
---|
87 | coast_in_dir_name = topographies_in_dir + coast_name |
---|
88 | offshore_in_dir_name = topographies_in_dir + offshore_name |
---|
89 | |
---|
90 | onshore_dir_name = topographies_dir + onshore_name |
---|
91 | #island_dir_name = topographies_dir + island_name |
---|
92 | coast_dir_name = topographies_dir + coast_name |
---|
93 | offshore_dir_name = topographies_dir + offshore_name |
---|
94 | |
---|
95 | #final topo files |
---|
96 | combined_dir_name = topographies_dir + combined_name |
---|
97 | combined_smaller_dir_name = topographies_dir + combined_smaller_name |
---|
98 | |
---|
99 | meshes_dir = anuga_dir+'meshes'+sep |
---|
100 | meshes_dir_name = meshes_dir + scenario_name |
---|
101 | |
---|
102 | polygons_dir = anuga_dir+'polygons'+sep |
---|
103 | tide_dir = anuga_dir+'tide_data'+sep |
---|
104 | |
---|
105 | if source =='dampier': |
---|
106 | boundaries_name = 'broome_3854_17042007' #Dampier gun |
---|
107 | boundaries_in_dir = anuga_dir+'boundaries'+sep+'urs'+sep+'dampier'+sep+'1_10000'+sep |
---|
108 | |
---|
109 | if source=='onslow': |
---|
110 | boundaries_name = 'broome_3859_16052007' #onslow_hedland_broome gun |
---|
111 | boundaries_in_dir = anuga_dir+'boundaries'+sep+'urs'+sep+'onslow_hedland_broome'+sep+'1_10000'+sep |
---|
112 | |
---|
113 | if source=='exmouth': |
---|
114 | boundaries_name = 'broome_3103_18052007' #exmouth gun |
---|
115 | boundaries_in_dir = anuga_dir+'boundaries'+sep+'urs'+sep+'exmouth'+sep+'1_10000'+sep |
---|
116 | |
---|
117 | if source=='other': |
---|
118 | boundaries_name = 'other' #exmouth gun |
---|
119 | boundaries_in_dir = anuga_dir+'boundaries'+sep+'urs'+sep+'exmouth'+sep+'1_10000'+sep |
---|
120 | |
---|
121 | |
---|
122 | #boundaries locations |
---|
123 | boundaries_in_dir_name = boundaries_in_dir + boundaries_name |
---|
124 | boundaries_dir = anuga_dir+'boundaries'+sep |
---|
125 | boundaries_dir_name = boundaries_dir + scenario_name |
---|
126 | |
---|
127 | #output locations |
---|
128 | output_dir = anuga_dir+'outputs'+sep |
---|
129 | output_build_time_dir = output_dir+build_time+'_'+source+sep |
---|
130 | #output_run_time_dir = output_dir +run_time+dir_comment+sep |
---|
131 | output_run_time_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'outputs'+sep+run_time+sep |
---|
132 | output_run_time_dir_name = output_run_time_dir + scenario_name #Used by post processing |
---|
133 | |
---|
134 | #gauges |
---|
135 | gauge_name = '???.csv' |
---|
136 | gauges_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'gauges'+sep |
---|
137 | gauges_dir_name = gauges_dir + gauge_name |
---|
138 | |
---|
139 | buildings_filename = gauges_dir + 'carnarvon_res_Project.csv' |
---|
140 | buildings_filename_out = 'carnarvon_res_Project_modified.csv' |
---|
141 | |
---|
142 | community_filename = gauges_dir +'' |
---|
143 | community_broome = gauges_dir + '' |
---|
144 | |
---|
145 | |
---|
146 | ############################### |
---|
147 | # Domain definitions |
---|
148 | ############################### |
---|
149 | |
---|
150 | from anuga.utilities.polygon import read_polygon, plot_polygons, polygon_area, is_inside_polygon |
---|
151 | |
---|
152 | # bounding polygon for study area |
---|
153 | poly_all = read_polygon(polygons_dir+'poly_all.csv') |
---|
154 | res_poly_all = 100000*res_factor |
---|
155 | |
---|
156 | ################################################################### |
---|
157 | # Clipping regions for export to asc and regions for clipping data |
---|
158 | ################################################################### |
---|
159 | |
---|
160 | # exporting asc grid |
---|
161 | eastingmin = 340000 |
---|
162 | eastingmax = 350000 |
---|
163 | northingmin = 6273400 |
---|
164 | northingmax = 6277700 |
---|
165 | |
---|
166 | ############################### |
---|
167 | # Interior region definitions |
---|
168 | ############################### |
---|
169 | |
---|
170 | #digitized polygons |
---|
171 | poly_carnarvon1 = read_polygon(polygons_dir+'neg20_pos10_polygon.csv') |
---|
172 | res_carnarvon1 = 10000*res_factor |
---|
173 | poly_carnarvon2 = read_polygon(polygons_dir+'neg5_pos5_poly_.csv') |
---|
174 | res_carnarvon2 = 500*res_factor |
---|
175 | |
---|
176 | #plot_polygons([polyAll,poly_broome1,poly_broome2,poly_broome3],figname='boundingpoly2',verbose=False) |
---|
177 | |
---|
178 | interior_regions = [[poly_carnarvon1,res_carnarvon1],[poly_carnarvon2,res_carnarvon2]] |
---|
179 | |
---|
180 | boundary_tags={'back': [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 14], |
---|
181 | 'side': [10,13], 'ocean': [11, 12]} |
---|
182 | |
---|
183 | trigs_min = number_mesh_triangles(interior_regions, poly_all, res_poly_all) |
---|
184 | |
---|
185 | poly_mainland=read_polygon(polygons_dir+'initial_condition_south.csv') |
---|
186 | |
---|
187 | print 'min number triangles', trigs_min |
---|
188 | |
---|
189 | |
---|