1 | # -*- coding: cp1252 -*- |
---|
2 | """Common filenames and locations for topographic data, meshes and outputs. |
---|
3 | """ |
---|
4 | |
---|
5 | from os import sep, environ, getenv, getcwd |
---|
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 |
---|
12 | |
---|
13 | # file and system info |
---|
14 | #--------------------------------- |
---|
15 | codename = 'project.py' |
---|
16 | |
---|
17 | home = getenv('INUNDATIONHOME') #Sandpit's parent dir |
---|
18 | user = get_user_name() |
---|
19 | |
---|
20 | # INUNDATIONHOME is the inundation directory, not the data directory. |
---|
21 | home += sep +'data' |
---|
22 | |
---|
23 | #time stuff |
---|
24 | time = strftime('%Y%m%d_%H%M%S',gmtime()) #gets time for new dir |
---|
25 | #time = strftime('%Y%m%d_%H%M%S',localtime()) #gets time for new dir |
---|
26 | gtime = strftime('%Y%m%d_%H%M%S',gmtime()) #gets time for new dir |
---|
27 | build_time = time+'_build' |
---|
28 | run_time = time+'_run' |
---|
29 | print 'gtime: ', gtime |
---|
30 | |
---|
31 | #tide = -5.3 |
---|
32 | tide = 0 |
---|
33 | #tide = 4.9 |
---|
34 | |
---|
35 | #Making assumptions about the location of scenario data |
---|
36 | state = 'western_australia' |
---|
37 | scenario_name = 'broome' |
---|
38 | scenario = 'broome_tsunami_scenario_2006' |
---|
39 | |
---|
40 | # onshore data provided by WA DLI |
---|
41 | onshore_name = 'Broome_topography_DLI' # original |
---|
42 | |
---|
43 | #island |
---|
44 | #island_name = 'rott_dli_ext' # original |
---|
45 | |
---|
46 | # offshore |
---|
47 | coast_name = 'Broome_coastline' |
---|
48 | |
---|
49 | offshore_name = 'Broome_Bathymetry' |
---|
50 | offshore_name1 = 'inferred_north' |
---|
51 | offshore_name2 = 'inferred_south' |
---|
52 | |
---|
53 | #final topo name |
---|
54 | combined_name ='broome_combined_elevation' |
---|
55 | combined_name1 ='broome_combined_elevation1' |
---|
56 | combined_name_unclipped1 ='broome_combined_elevation_unclipped1' |
---|
57 | combined_small_name = 'broome_combined_elevation_small' |
---|
58 | |
---|
59 | topographies_in_dir = home+sep+state+sep+scenario+sep+'elevation_final'+sep+'points'+sep+'Feb07'+sep |
---|
60 | topographies_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'topographies'+sep |
---|
61 | topographies_time_dir = topographies_dir+build_time+sep |
---|
62 | |
---|
63 | #input topo file location |
---|
64 | onshore_in_dir_name = topographies_in_dir + onshore_name |
---|
65 | #island_in_dir_name = topographies_in_dir + island_name |
---|
66 | |
---|
67 | coast_in_dir_name = topographies_in_dir + coast_name |
---|
68 | |
---|
69 | offshore_in_dir_name = topographies_in_dir + offshore_name |
---|
70 | offshore_in_dir_name1 = topographies_in_dir + offshore_name1 |
---|
71 | offshore_in_dir_name2 = topographies_in_dir + offshore_name2 |
---|
72 | |
---|
73 | onshore_dir_name = topographies_dir + onshore_name |
---|
74 | |
---|
75 | #island_dir_name = topographies_dir + island_name |
---|
76 | |
---|
77 | coast_dir_name = topographies_dir + coast_name |
---|
78 | |
---|
79 | offshore_dir_name = topographies_dir + offshore_name |
---|
80 | offshore_dir_name1 = topographies_dir + offshore_name1 |
---|
81 | offshore_dir_name2 = topographies_dir + offshore_name2 |
---|
82 | |
---|
83 | #final topo files |
---|
84 | combined_dir_name = topographies_dir + combined_name |
---|
85 | combined_dir_name_unclipped1 = topographies_dir + combined_name_unclipped1 |
---|
86 | combined_dir_name1 = topographies_dir + combined_name1 |
---|
87 | combined_small_name_dir = topographies_dir + combined_small_name |
---|
88 | |
---|
89 | meshes_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'meshes'+sep |
---|
90 | meshes_dir_name = meshes_dir + scenario_name |
---|
91 | |
---|
92 | polygons_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'polygons'+sep |
---|
93 | tide_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'tide_data'+sep |
---|
94 | |
---|
95 | |
---|
96 | boundaries_source = 'broome_3854_17042007' |
---|
97 | #boundaries locations |
---|
98 | boundaries_in_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'boundaries'+sep+'urs'+sep |
---|
99 | #boundaries_in_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'boundaries'+sep+'urs'+sep+boundaries_source+sep |
---|
100 | boundaries_in_dir_name = boundaries_in_dir + boundaries_source |
---|
101 | boundaries_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'boundaries'+sep |
---|
102 | boundaries_dir_name = boundaries_dir + boundaries_source |
---|
103 | #boundaries_time_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'boundaries'+sep+build_time+sep |
---|
104 | #boundaries_time_dir_name = boundaries_time_dir + boundaries_name #Used by post processing |
---|
105 | |
---|
106 | #output locations |
---|
107 | output_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'outputs'+sep |
---|
108 | output_build_time_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'outputs'+sep+build_time+sep |
---|
109 | output_run_time_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'outputs'+sep+run_time+sep |
---|
110 | output_run_time_dir_name = output_run_time_dir + scenario_name #Used by post processing |
---|
111 | |
---|
112 | #gauges |
---|
113 | beach_gauges = 'beach_gauges.csv' |
---|
114 | gauge_name = 'broome_gauges.csv' |
---|
115 | gauges_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'gauges'+sep |
---|
116 | gauges_dir_name = gauges_dir + gauge_name |
---|
117 | |
---|
118 | community_filename = gauges_dir + 'CHINS_v2.csv' |
---|
119 | community_broome = gauges_dir + 'community_broome.csv' |
---|
120 | |
---|
121 | buildings_filename = gauges_dir + 'Broome_res_Project.csv' |
---|
122 | buildings_filename_out = 'Broome_res_Project_modified.csv' |
---|
123 | |
---|
124 | ############################### |
---|
125 | # Domain definitions |
---|
126 | ############################### |
---|
127 | from anuga.utilities.polygon import read_polygon, plot_polygons, polygon_area, is_inside_polygon |
---|
128 | |
---|
129 | poly_all = read_polygon(polygons_dir+'extent_small.csv') |
---|
130 | #poly_all = read_polygon(polygons_dir+'extent.csv') |
---|
131 | res_factor = 2 |
---|
132 | #res_poly_all = 500000 |
---|
133 | res_poly_all = 150000*res_factor |
---|
134 | |
---|
135 | ############################### |
---|
136 | # Interior region definitions |
---|
137 | ############################### |
---|
138 | |
---|
139 | poly_0 = read_polygon(polygons_dir+'neg20_coast_contour_pts.csv') |
---|
140 | #res_0 = 100000 |
---|
141 | res_0 = 20000*res_factor |
---|
142 | |
---|
143 | poly_1 = read_polygon(polygons_dir+'broome_north_coast_inside_extent.csv') |
---|
144 | #res_1 = 50000 |
---|
145 | res_1 = 5000*res_factor |
---|
146 | |
---|
147 | poly_2 = read_polygon(polygons_dir+'broome_south_coast_inside_extent.csv') |
---|
148 | #res_2 = 50000 |
---|
149 | res_2 = 5000*res_factor |
---|
150 | |
---|
151 | poly_3 = read_polygon(polygons_dir+'Broome_town_pts.csv') |
---|
152 | #res_3 = 20000 |
---|
153 | res_3 = 2000*res_factor |
---|
154 | |
---|
155 | poly_4 = read_polygon(polygons_dir+'Broome_inner_town_pts.csv') |
---|
156 | #res_4 = 5000 |
---|
157 | res_4 = 500*res_factor |
---|
158 | #assert zone == refzone |
---|
159 | |
---|
160 | interior_regions = [[poly_0,res_0],[poly_1,res_1],[poly_2,res_2] |
---|
161 | ,[poly_3,res_3],[poly_4,res_4]] |
---|
162 | |
---|
163 | trigs_min = number_mesh_triangles(interior_regions, poly_all, res_poly_all) |
---|
164 | |
---|
165 | print 'min number triangles', trigs_min |
---|
166 | |
---|
167 | poly_mainland = read_polygon(polygons_dir+'Initial_Condition.csv') |
---|
168 | |
---|
169 | ################################################################### |
---|
170 | # Clipping regions for export to asc and regions for clipping data |
---|
171 | ################################################################### |
---|
172 | |
---|
173 | # exporting asc grid |
---|
174 | e_min_area = 412000.0 |
---|
175 | e_max_area = 423000.0 |
---|
176 | n_min_area = 8007000.0 |
---|
177 | n_max_area = 8022000.0 |
---|
178 | |
---|
179 | |
---|
180 | |
---|