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',localtime()) #gets time for new dir |
---|
25 | gtime = strftime('%Y%m%d_%H%M%S',gmtime()) #gets time for new dir |
---|
26 | build_time = time+'_build' |
---|
27 | run_time = time+'_run' |
---|
28 | print 'gtime: ', gtime |
---|
29 | |
---|
30 | tide = 0 |
---|
31 | |
---|
32 | #Making assumptions about the location of scenario data |
---|
33 | state = 'western_australia' |
---|
34 | scenario_name = 'broome' |
---|
35 | scenario = 'broome_tsunami_scenario_2006' |
---|
36 | |
---|
37 | # onshore data provided by WA DLI |
---|
38 | onshore_name = 'dted2_z51' # original |
---|
39 | |
---|
40 | #island |
---|
41 | #island_name = 'rott_dli_ext' # original |
---|
42 | |
---|
43 | # offshore |
---|
44 | coast_name = 'coastline' |
---|
45 | offshore_name1 = 'XY100011610' |
---|
46 | offshore_name2 = 'XY100011611' |
---|
47 | offshore_name3 = 'XY100011613' |
---|
48 | offshore_name4 = 'XY100011614' |
---|
49 | offshore_name5 = 'XY100011616' |
---|
50 | offshore_name6 = 'XY100011617' |
---|
51 | offshore_name7 = 'XY100011618' |
---|
52 | offshore_name8 = 'XY100011621' |
---|
53 | offshore_name9 = 'XY100011623' |
---|
54 | offshore_name10 = 'XY100011745' |
---|
55 | offshore_name11 = 'XY100011746' |
---|
56 | offshore_name12 = 'XY100017530' |
---|
57 | offshore_name13 = 'XY100017532' |
---|
58 | offshore_name14 = 'XY100017538' |
---|
59 | offshore_name15 = 'XY100017540' |
---|
60 | offshore_name16 = 'XYBR66' |
---|
61 | offshore_name17 = 'XYBR70' |
---|
62 | offshore_name18 = 'XYBR80' |
---|
63 | offshore_name19 = 'XYBR88' |
---|
64 | offshore_name20 = 'XYBR93' |
---|
65 | offshore_name21 = 'XYBR0110' |
---|
66 | offshore_name22 = 'XYWADPI' |
---|
67 | |
---|
68 | #final topo name |
---|
69 | combined_name ='perth_combined_elevation' |
---|
70 | combined_smaller_name = 'perth_combined_elevation_smaller' |
---|
71 | |
---|
72 | |
---|
73 | topographies_in_dir = home+sep+state+sep+scenario+sep+'elevation_final'+sep+'points'+sep |
---|
74 | topographies_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'topographies'+sep |
---|
75 | topographies_time_dir = topographies_dir+build_time+sep |
---|
76 | |
---|
77 | #input topo file location |
---|
78 | onshore_in_dir_name = topographies_in_dir + onshore_name |
---|
79 | island_in_dir_name = topographies_in_dir + island_name |
---|
80 | island_in_dir_name1 = topographies_in_dir + island_name1 |
---|
81 | island_in_dir_name2 = topographies_in_dir + island_name2 |
---|
82 | island_in_dir_name3 = topographies_in_dir + island_name3 |
---|
83 | |
---|
84 | coast_in_dir_name = topographies_in_dir + coast_name |
---|
85 | offshore_in_dir_name = topographies_in_dir + offshore_name |
---|
86 | offshore1_in_dir_name = topographies_in_dir + offshore1_name |
---|
87 | |
---|
88 | onshore_dir_name = topographies_dir + onshore_name |
---|
89 | island_dir_name = topographies_dir + island_name |
---|
90 | island_dir_name1 = topographies_dir + island_name1 |
---|
91 | island_dir_name2 = topographies_dir + island_name2 |
---|
92 | island_dir_name3 = topographies_dir + island_name3 |
---|
93 | |
---|
94 | coast_dir_name = topographies_dir + coast_name |
---|
95 | offshore_dir_name = topographies_dir + offshore_name |
---|
96 | |
---|
97 | #final topo files |
---|
98 | combined_dir_name = topographies_dir + combined_name |
---|
99 | combined_time_dir_name = topographies_time_dir + combined_name |
---|
100 | combined_smaller_name_dir = topographies_dir + combined_smaller_name |
---|
101 | #combined_time_dir_final_name = topographies_time_dir + combined_final_name |
---|
102 | |
---|
103 | meshes_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'meshes'+sep |
---|
104 | meshes_dir_name = meshes_dir + scenario_name |
---|
105 | |
---|
106 | polygons_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'polygons'+sep |
---|
107 | tide_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'tide_data'+sep |
---|
108 | |
---|
109 | |
---|
110 | boundaries_source = '????' |
---|
111 | #boundaries locations |
---|
112 | boundaries_in_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'boundaries'+sep+'urs'+sep+boundaries_source+sep |
---|
113 | boundaries_in_dir_name = boundaries_in_dir + scenario_name |
---|
114 | boundaries_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'boundaries'+sep |
---|
115 | boundaries_dir_name = boundaries_dir + scenario_name |
---|
116 | #boundaries_time_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'boundaries'+sep+build_time+sep |
---|
117 | #boundaries_time_dir_name = boundaries_time_dir + boundaries_name #Used by post processing |
---|
118 | |
---|
119 | #output locations |
---|
120 | output_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'outputs'+sep |
---|
121 | output_build_time_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'outputs'+sep+build_time+sep |
---|
122 | output_run_time_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'outputs'+sep+run_time+sep |
---|
123 | output_run_time_dir_name = output_run_time_dir + scenario_name #Used by post processing |
---|
124 | |
---|
125 | #gauges |
---|
126 | gauge_name = 'broome_gauges.csv' |
---|
127 | gauges_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'gauges'+sep |
---|
128 | gauges_dir_name = gauges_dir + gauge_name |
---|
129 | |
---|
130 | community_filename = gauges_dir + 'CHINS_v2.csv' |
---|
131 | community_broome = gauges_dir + 'community_broome.csv' |
---|
132 | |
---|
133 | |
---|
134 | |
---|
135 | ############################### |
---|
136 | # Domain definitions |
---|
137 | ############################### |
---|
138 | from anuga.utilities.polygon import read_polygon, plot_polygons, polygon_area, is_inside_polygon |
---|
139 | |
---|
140 | poly_all = read_polygon(polygons_dir+'extent.csv') |
---|
141 | res_poly_all = 100000 |
---|
142 | |
---|
143 | ############################### |
---|
144 | # Interior region definitions |
---|
145 | ############################### |
---|
146 | |
---|
147 | poly_1 = read_polygon(polygons_dir+'Broome_Local_Polygon_update.csv') |
---|
148 | res_1 = 20000 |
---|
149 | |
---|
150 | poly_2 = read_polygon(polygons_dir+'Broome_Close2_update.csv') |
---|
151 | res_2 = 1000 |
---|
152 | |
---|
153 | poly_3 = read_polygon(polygons_dir+'Broome_Coast_update2.csv') |
---|
154 | res_3 = 1000 |
---|
155 | #assert zone == refzone |
---|
156 | |
---|
157 | interior_regions = [[poly_1,res_1],[poly_2,res_2] |
---|
158 | ,[poly_3,res_3]] |
---|
159 | |
---|
160 | trigs_min = number_mesh_triangles(interior_regions, poly_all, res_poly_all) |
---|
161 | |
---|
162 | print 'min number triangles', trigs_min |
---|
163 | |
---|
164 | ################################################################### |
---|
165 | # Clipping regions for export to asc and regions for clipping data |
---|
166 | ################################################################### |
---|
167 | |
---|
168 | # exporting asc grid |
---|
169 | eastingmin = 406215.87 |
---|
170 | eastingmax = 440208.78 |
---|
171 | northingmin = 7983427.73 |
---|
172 | northingmax = 8032834.52 |
---|
173 | |
---|
174 | |
---|
175 | |
---|