1 | """Common filenames and locations for topographic data, meshes and outputs. |
---|
2 | """ |
---|
3 | |
---|
4 | import sys |
---|
5 | from os import sep, environ, getenv, getcwd |
---|
6 | from os.path import expanduser, basename |
---|
7 | |
---|
8 | from anuga.coordinate_transforms.redfearn import\ |
---|
9 | degminsec2decimal_degrees,\ |
---|
10 | convert_from_latlon_to_utm |
---|
11 | |
---|
12 | from time import localtime, strftime |
---|
13 | from anuga.geospatial_data.geospatial_data import * |
---|
14 | |
---|
15 | # Location and naming of scenario data |
---|
16 | state = 'western_australia' |
---|
17 | scenario_dir_name = 'dampier_tsunami_scenario_2006' |
---|
18 | #scenario_dir_name = 'karratha_tsunami_scenario_2005' # Tmp location |
---|
19 | |
---|
20 | basename = 'elevation50m' |
---|
21 | boundary_basename = 'dampier' |
---|
22 | |
---|
23 | |
---|
24 | # Data output |
---|
25 | codename = 'project.py' |
---|
26 | |
---|
27 | home = getenv('INUNDATIONHOME') #Sandpit's parent dir |
---|
28 | |
---|
29 | if sys.platform == 'win32': |
---|
30 | user = getenv('USERPROFILE') |
---|
31 | else: |
---|
32 | user = getenv('LOGNAME') |
---|
33 | |
---|
34 | # INUNDATIONHOME is the inundation directory, not the data directory. |
---|
35 | home += sep +'data' |
---|
36 | |
---|
37 | #Derive subdirectories and filenames |
---|
38 | print 'home',home |
---|
39 | time = strftime('%Y%m%d_%H%M%S',localtime()) #gets time for new dir |
---|
40 | outputtimedir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'outputs'+sep+time+sep |
---|
41 | |
---|
42 | meshdir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'meshes'+sep |
---|
43 | datadir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'topographies'+sep |
---|
44 | gaugedir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'gauges'+sep |
---|
45 | polygondir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'polygons'+sep |
---|
46 | boundarydir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'boundaries'+sep+'urs'+sep+'test'+sep |
---|
47 | outputdir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'outputs'+sep |
---|
48 | tidedir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'tide_data'+sep |
---|
49 | |
---|
50 | #gauge_filename = gaugedir + 'gauge_location_broome.csv' |
---|
51 | |
---|
52 | meshname = meshdir + basename |
---|
53 | outputname = outputtimedir + basename #Used by post processing |
---|
54 | boundaryname = boundarydir + boundary_basename #Used by post processing |
---|
55 | |
---|
56 | |
---|
57 | |
---|
58 | |
---|
59 | # Regions |
---|
60 | |
---|
61 | refzone = 50 |
---|
62 | south = degminsec2decimal_degrees(-20,55,0) |
---|
63 | north = degminsec2decimal_degrees(-20,15,0) |
---|
64 | west = degminsec2decimal_degrees(116,17,0) |
---|
65 | east = degminsec2decimal_degrees(117,10,0) |
---|
66 | |
---|
67 | p0 = [south, degminsec2decimal_degrees(116,32,0)] |
---|
68 | p1 = [south, west] |
---|
69 | p2 = [degminsec2decimal_degrees(-20,23,0), west] |
---|
70 | p3 = [north, degminsec2decimal_degrees(116,45,0)] |
---|
71 | p4 = [north, degminsec2decimal_degrees(117,0,0)] |
---|
72 | p5 = [p2[0], degminsec2decimal_degrees(117,8,0)] |
---|
73 | p6 = [degminsec2decimal_degrees(-20,30,0), east] |
---|
74 | p7 = [degminsec2decimal_degrees(-20,38,0), east] |
---|
75 | p8 = [south, east] |
---|
76 | |
---|
77 | |
---|
78 | bounding_polygon, zone =\ |
---|
79 | convert_from_latlon_to_utm([p0, p1, p2, p3, p4, |
---|
80 | p5, p6, p7, p8]) |
---|
81 | refzone = zone |
---|
82 | |
---|
83 | |
---|
84 | #Interior regions |
---|
85 | |
---|
86 | # CIPMA point of interest |
---|
87 | cipma_latitude = -20.588456 |
---|
88 | cipma_longitude = 116.771527 |
---|
89 | |
---|
90 | |
---|
91 | k0 = [cipma_latitude-0.02, cipma_longitude-0.02] |
---|
92 | k1 = [cipma_latitude-0.02, cipma_longitude+0.02] |
---|
93 | k2 = [cipma_latitude+0.02, cipma_longitude+0.02] |
---|
94 | k3 = [cipma_latitude+0.02, cipma_longitude-0.02] |
---|
95 | |
---|
96 | cipma_polygon, zone = convert_from_latlon_to_utm([k0, k1, k2, k3]) |
---|
97 | assert zone == refzone |
---|
98 | |
---|
99 | e_min_area = 474000 |
---|
100 | e_max_area = 480000 |
---|
101 | n_min_area = 7719000 |
---|
102 | n_max_area = 7725000 |
---|
103 | |
---|
104 | #Interior regions |
---|
105 | karratha_south = degminsec2decimal_degrees(-20,44,0) |
---|
106 | karratha_north = degminsec2decimal_degrees(-20,42,0) |
---|
107 | karratha_west = degminsec2decimal_degrees(116,48,0) |
---|
108 | karratha_east = degminsec2decimal_degrees(116,53,30) |
---|
109 | |
---|
110 | k0 = [karratha_south, karratha_west] |
---|
111 | k1 = [karratha_south, karratha_east] |
---|
112 | k2 = [karratha_north, karratha_east] |
---|
113 | k3 = [karratha_north, karratha_west] |
---|
114 | |
---|
115 | karratha_polygon, zone = convert_from_latlon_to_utm([k0, k1, k2, k3]) |
---|
116 | assert zone == refzone |
---|
117 | |
---|
118 | |
---|
119 | #Interior regions |
---|
120 | dampier_south = degminsec2decimal_degrees(-20,40,0) |
---|
121 | dampier_north = degminsec2decimal_degrees(-20,38,10) |
---|
122 | dampier_west = degminsec2decimal_degrees(116,43,0) |
---|
123 | dampier_east = degminsec2decimal_degrees(116,45,0) |
---|
124 | |
---|
125 | d0 = [dampier_south, dampier_west] |
---|
126 | d1 = [dampier_south, dampier_east] |
---|
127 | d2 = [dampier_north, dampier_east] |
---|
128 | d3 = [dampier_north, dampier_west] |
---|
129 | |
---|
130 | dampier_polygon, zone = convert_from_latlon_to_utm([d0, d1, d2, d3]) |
---|
131 | assert zone == refzone |
---|
132 | |
---|
133 | |
---|
134 | #Interior regions |
---|
135 | refinery_south = degminsec2decimal_degrees(-20,37,50) |
---|
136 | refinery_north = degminsec2decimal_degrees(-20,36,0) |
---|
137 | refinery_west = degminsec2decimal_degrees(116,44,0) |
---|
138 | refinery_east = degminsec2decimal_degrees(116,46,10) |
---|
139 | |
---|
140 | d0 = [refinery_south, refinery_west] |
---|
141 | d1 = [refinery_south, refinery_east] |
---|
142 | d2 = [refinery_north, refinery_east] |
---|
143 | d3 = [refinery_north, refinery_west] |
---|
144 | |
---|
145 | refinery_polygon, zone = convert_from_latlon_to_utm([d0, d1, d2, d3]) |
---|
146 | assert zone == refzone |
---|
147 | |
---|
148 | |
---|
149 | #Interior region around 468899, 7715177: |
---|
150 | #lat (-20, 39, 44.93753), lon (116, 42, 5.09106) |
---|
151 | |
---|
152 | point_south = degminsec2decimal_degrees(-20,39,46) |
---|
153 | point_north = degminsec2decimal_degrees(-20,39,42) |
---|
154 | point_west = degminsec2decimal_degrees(116,42,0) |
---|
155 | point_east = degminsec2decimal_degrees(116,42,10) |
---|
156 | |
---|
157 | d0 = [point_south, point_west] |
---|
158 | d1 = [point_south, point_east] |
---|
159 | d2 = [point_north, point_east] |
---|
160 | d3 = [point_north, point_west] |
---|
161 | |
---|
162 | point_polygon, zone = convert_from_latlon_to_utm([d0, d1, d2, d3]) |
---|
163 | assert zone == refzone |
---|
164 | |
---|
165 | |
---|
166 | #Neils areas around interesting points |
---|
167 | neil1_point1 = [degminsec2decimal_degrees(-20,35,34), |
---|
168 | degminsec2decimal_degrees(116,45,18)] |
---|
169 | neil1_point2 = [degminsec2decimal_degrees(-20,36,15), |
---|
170 | degminsec2decimal_degrees(116,46,18)] |
---|
171 | neil1_point3 = [degminsec2decimal_degrees(-20,35,9), |
---|
172 | degminsec2decimal_degrees(116,47,17)] |
---|
173 | neil1_point4 = [degminsec2decimal_degrees(-20,34,26), |
---|
174 | degminsec2decimal_degrees(116,46,17)] |
---|
175 | |
---|
176 | neil1_polygon, zone = convert_from_latlon_to_utm([neil1_point1, |
---|
177 | neil1_point2, |
---|
178 | neil1_point3, |
---|
179 | neil1_point4]) |
---|
180 | assert zone == refzone |
---|
181 | |
---|
182 | |
---|
183 | |
---|
184 | |
---|
185 | neil2_point1 = [degminsec2decimal_degrees(-20,39,36), |
---|
186 | degminsec2decimal_degrees(116,41,33)] |
---|
187 | neil2_point2 = [degminsec2decimal_degrees(-20,40,10), |
---|
188 | degminsec2decimal_degrees(116,42,13)] |
---|
189 | neil2_point3 = [degminsec2decimal_degrees(-20,38,39), |
---|
190 | degminsec2decimal_degrees(116,43,49)] |
---|
191 | neil2_point4 = [degminsec2decimal_degrees(-20,38,5), |
---|
192 | degminsec2decimal_degrees(116,43,9)] |
---|
193 | |
---|
194 | neil2_polygon, zone = convert_from_latlon_to_utm([neil2_point1, |
---|
195 | neil2_point2, |
---|
196 | neil2_point3, |
---|
197 | neil2_point4]) |
---|
198 | assert zone == refzone |
---|
199 | |
---|
200 | |
---|
201 | |
---|
202 | |
---|
203 | |
---|
204 | #Withnell bay |
---|
205 | wb_point1 = [degminsec2decimal_degrees(-20,35,34), |
---|
206 | degminsec2decimal_degrees(116,45,18)] |
---|
207 | wb_point2 = [degminsec2decimal_degrees(-20,36,15), |
---|
208 | degminsec2decimal_degrees(116,46,18)] |
---|
209 | wb_point3 = [degminsec2decimal_degrees(-20,35,9), |
---|
210 | degminsec2decimal_degrees(116,47,17)] |
---|
211 | wb_point4 = [degminsec2decimal_degrees(-20,34,26), |
---|
212 | degminsec2decimal_degrees(116,46,17)] |
---|
213 | |
---|
214 | wb_polygon, zone = convert_from_latlon_to_utm([wb_point1, wb_point2, |
---|
215 | wb_point3, wb_point4]) |
---|
216 | assert zone == refzone |
---|
217 | |
---|
218 | |
---|
219 | |
---|
220 | |
---|
221 | |
---|
222 | #Larger Withnell bay |
---|
223 | lwb_point1 = [degminsec2decimal_degrees(-20,35,59), |
---|
224 | degminsec2decimal_degrees(116,42,00)] |
---|
225 | lwb_point2 = [degminsec2decimal_degrees(-20,36,50), |
---|
226 | degminsec2decimal_degrees(116,46,50)] |
---|
227 | lwb_point3 = [degminsec2decimal_degrees(-20,34,00), |
---|
228 | degminsec2decimal_degrees(116,47,39)] |
---|
229 | lwb_point4 = [degminsec2decimal_degrees(-20,33,00), |
---|
230 | degminsec2decimal_degrees(116,42,50)] |
---|
231 | |
---|
232 | lwb_polygon, zone = convert_from_latlon_to_utm([lwb_point1, lwb_point2, |
---|
233 | lwb_point3, lwb_point4]) |
---|
234 | |
---|
235 | assert zone == refzone |
---|
236 | |
---|
237 | |
---|
238 | |
---|
239 | |
---|