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 |
---|
10 | from anuga.coordinate_transforms.redfearn import degminsec2decimal_degrees, convert_points_from_latlon_to_utm |
---|
11 | |
---|
12 | if sys.platform == 'win32': |
---|
13 | home = getenv('INUNDATIONHOME') |
---|
14 | user = getenv('USERPROFILE') |
---|
15 | |
---|
16 | else: |
---|
17 | home = getenv('INUNDATIONHOME', sep+'d'+sep+'xrd'+sep+'gem'+sep+'2'+sep+'ramp'+sep+'risk_assessment_methods_project'+sep+'inundation') |
---|
18 | user = getenv('LOGNAME') |
---|
19 | print 'USER:', user |
---|
20 | |
---|
21 | # INUNDATIONHOME is the inundation directory, not the data directory. |
---|
22 | home += sep +'data' |
---|
23 | |
---|
24 | #Making assumptions about the location of scenario data |
---|
25 | state = 'tasmania' |
---|
26 | scenario_dir_name = 'hobart_tsunami_scenario_2006' |
---|
27 | |
---|
28 | # data provided by Tas SES and checked by NM&I |
---|
29 | #onshore_name = 'hob3_topo' # original |
---|
30 | onshore_name = 'hob5_topo' # 12.5m grid and clipped to 100m elevation or 3000m from coast |
---|
31 | #onshore_name_25 = 'hob5_topo_25m' # 25m grid and clipped to 100m elevation or 3000m from coast |
---|
32 | onshore_name_25 = 'hob6_topo_25m' # 25m grid NOT clipped |
---|
33 | offshore_name_tas1 = 'derwent_2m' |
---|
34 | offshore_name_tas2 = 'derwent_5m' |
---|
35 | offshore_name_tas3 = 'south_east_tas' #actually this is AHO |
---|
36 | offshore_name_tas4 = 'hobart_1m' |
---|
37 | |
---|
38 | # AHO data and checked by NM&I |
---|
39 | offshore_name1 = 'xy100003760' |
---|
40 | offshore_name2 = 'xy100003761' |
---|
41 | offshore_name3 = 'xy100003762' |
---|
42 | offshore_name4 = 'xy100003907' |
---|
43 | offshore_name5 = 'xy100003908' |
---|
44 | offshore_name6 = 'xy100003909' |
---|
45 | offshore_name7 = 'xy100003910' |
---|
46 | offshore_name8 = 'xy100003932' |
---|
47 | offshore_name9 = 'xy100003933' |
---|
48 | offshore_name10 = 'xy100003934' |
---|
49 | offshore_name11 = 'xy100003935' |
---|
50 | offshore_name12 = 'xy100003936' |
---|
51 | offshore_name13 = 'xy100003964' |
---|
52 | offshore_name14 = 'xy100014250' |
---|
53 | offshore_name15 = 'xy100014253' |
---|
54 | offshore_name16 = 'xy100016142' |
---|
55 | |
---|
56 | # developed by NM&I |
---|
57 | coast_name = 'coastline_points' |
---|
58 | |
---|
59 | boundary_basename = 'puysegur' |
---|
60 | |
---|
61 | #swollen/ all data output |
---|
62 | basename = 'source' |
---|
63 | |
---|
64 | codename = 'project.py' |
---|
65 | |
---|
66 | #Derive subdirectories and filenames |
---|
67 | #time = strftime('%Y%m%d_%H%M%S',localtime()) #gets time for new dir |
---|
68 | local_time = strftime('%Y%m%d_%H%M%S',gmtime()) #gets time for new dir |
---|
69 | meshdir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'meshes'+sep |
---|
70 | datadir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'topographies'+sep |
---|
71 | gaugedir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'gauges'+sep |
---|
72 | polygondir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'polygons'+sep |
---|
73 | boundarydir = home+sep+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'boundaries'+sep |
---|
74 | outputdir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'outputs'+sep |
---|
75 | outputtimedir = outputdir + local_time + sep |
---|
76 | polygondir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'polygons'+sep |
---|
77 | |
---|
78 | gauge_filename = gaugedir + 'hobart_gauges.xya' |
---|
79 | buildings_filename = gaugedir + 'hobart_res.csv' |
---|
80 | buildings_filename_damage_out = 'hobart_res_modified.csv' |
---|
81 | gaugetimeseries = gaugedir + 'hobart' |
---|
82 | |
---|
83 | # boundary source data |
---|
84 | #MOST_dir = 'f:'+sep+'3'+sep+'ehn'+sep+'users'+sep+'davidb'+sep+'tsunami'+sep+'WA_project'+sep+'SU-AU_90'+sep+'most_2'+sep+'detailed'+sep |
---|
85 | |
---|
86 | codedir = getcwd()+sep |
---|
87 | codedirname = codedir + 'project.py' |
---|
88 | meshname = outputtimedir + 'mesh_' + basename |
---|
89 | |
---|
90 | onshore_dem_name = datadir + onshore_name |
---|
91 | onshore_dem_name_25 = datadir + onshore_name_25 |
---|
92 | all_onshore_dem_name = datadir + 'combined_onshore' |
---|
93 | offshore_dem_name_local1 = datadir + offshore_name_tas1 |
---|
94 | offshore_dem_name_local2 = datadir + offshore_name_tas2 |
---|
95 | offshore_dem_name_local3 = datadir + offshore_name_tas3 |
---|
96 | offshore_dem_name_local4 = datadir + offshore_name_tas4 |
---|
97 | offshore_dem_name_aho1 = datadir + offshore_name1 |
---|
98 | offshore_dem_name_aho2 = datadir + offshore_name2 |
---|
99 | offshore_dem_name_aho3 = datadir + offshore_name3 |
---|
100 | offshore_dem_name_aho4 = datadir + offshore_name4 |
---|
101 | offshore_dem_name_aho5 = datadir + offshore_name5 |
---|
102 | offshore_dem_name_aho6 = datadir + offshore_name6 |
---|
103 | offshore_dem_name_aho7 = datadir + offshore_name7 |
---|
104 | offshore_dem_name_aho8 = datadir + offshore_name8 |
---|
105 | offshore_dem_name_aho9 = datadir + offshore_name9 |
---|
106 | offshore_dem_name_aho10 = datadir + offshore_name10 |
---|
107 | offshore_dem_name_aho11 = datadir + offshore_name11 |
---|
108 | offshore_dem_name_aho12 = datadir + offshore_name12 |
---|
109 | offshore_dem_name_aho13 = datadir + offshore_name13 |
---|
110 | offshore_dem_name_aho14 = datadir + offshore_name14 |
---|
111 | offshore_dem_name_aho15 = datadir + offshore_name15 |
---|
112 | offshore_dem_name_aho16 = datadir + offshore_name16 |
---|
113 | coast_dem_name = datadir + coast_name |
---|
114 | # addition once total grid delivered |
---|
115 | #onshore_offshore_dem_name = datadir + '25m_se_tas' #25m grid |
---|
116 | onshore_offshore_dem_name = datadir + '50m_se_tas' #50m grid |
---|
117 | |
---|
118 | combined_dem_name = datadir + 'hobart_combined_elevation' |
---|
119 | combined_dem_name2 = datadir + 'hobart_combined_elevation2' # for alpha checking |
---|
120 | |
---|
121 | outputname = outputtimedir + basename #Used by post processing |
---|
122 | |
---|
123 | ############################### |
---|
124 | # Domain definitions |
---|
125 | ############################### |
---|
126 | |
---|
127 | # bounding box |
---|
128 | south = degminsec2decimal_degrees(-44,45,0) |
---|
129 | north = degminsec2decimal_degrees(-42,0,0) |
---|
130 | west = degminsec2decimal_degrees(146,45,0) |
---|
131 | east = degminsec2decimal_degrees(148,25,0) #degminsec2decimal_degrees(148,15,0) |
---|
132 | |
---|
133 | #Main Domain of Hobart: first run JS 18/9/06 |
---|
134 | d0 = [south, west] |
---|
135 | d1 = [south, east] |
---|
136 | d2 = [north, east] |
---|
137 | d3 = [north, west] |
---|
138 | polyAll2, zone = convert_points_from_latlon_to_utm([d0, d1, d2, d3]) |
---|
139 | print "polyAll2", polyAll2 |
---|
140 | refzone = zone |
---|
141 | |
---|
142 | # Second run - bottom bright, topr, top, left |
---|
143 | #polyAll = [[520000, 5170000],[580000, 5170000],[580000, 5200000],[590000,5240000],[520000,5260000]] |
---|
144 | |
---|
145 | # Third run - afternoon Wed 27 Sep; surrounds -100m and 20mish elevation |
---|
146 | #polyAll = read_polygon(polygondir+'new_extent.csv') |
---|
147 | #plot_polygons([polyAll],'boundingpoly',verbose=False) |
---|
148 | |
---|
149 | # Mark run - morning Fri 29 Sep; surrounds -100m and 20mish elevation |
---|
150 | polyAll = read_polygon(polygondir+'new_extent.csv') |
---|
151 | plot_polygons([polyAll, polyAll2],'boundingpoly',verbose=False) |
---|
152 | |
---|
153 | |
---|
154 | ################################################################### |
---|
155 | # Clipping regions for export to asc and regions for clipping data |
---|
156 | ################################################################### |
---|
157 | |
---|
158 | # region to export for inundation map |
---|
159 | e_min_area = 520000#490000 |
---|
160 | e_max_area = 580000#580000 |
---|
161 | n_min_area = 5180000#5160000 |
---|
162 | n_max_area = 5260000#5275000 |
---|
163 | |
---|
164 | # clipping 12.5m onshore data set |
---|
165 | eastingmin = 520000 |
---|
166 | eastingmax = 536000 |
---|
167 | northingmin = 5245000 |
---|
168 | northingmax = 5265000 |
---|
169 | # clipping 25m onshore data set |
---|
170 | eastingmin25 = 520000 |
---|
171 | eastingmax25 = 580000 |
---|
172 | northingmin25 = 5170000 |
---|
173 | northingmax25 = 5260000 |
---|
174 | |
---|
175 | ############################### |
---|
176 | # Interior region definitions |
---|
177 | ############################### |
---|
178 | |
---|
179 | ###Interior region - Hobart city area + Glenorchy, Kingston |
---|
180 | ##i0 = [517000, 5267000] |
---|
181 | ##i1 = [517000, 5255000] |
---|
182 | ##i2 = [520000, 5250000] |
---|
183 | ##i3 = [522000, 5239000] |
---|
184 | ##i4 = [524000, 5238000] |
---|
185 | ##i5 = [526000, 5236000] |
---|
186 | ##i6 = [530000, 5244000] |
---|
187 | ##i7 = [530000, 5250000] |
---|
188 | ##i8 = [534000, 5254000] |
---|
189 | ##i9 = [520000, 5270000] |
---|
190 | ## |
---|
191 | ##poly_hobart = [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9] |
---|
192 | ## |
---|
193 | ### Tasman Peninsula |
---|
194 | ##l0 = [550000, 5247000] |
---|
195 | ##l1 = [550000, 5211000] |
---|
196 | ##l2 = [583000, 5211000] |
---|
197 | ##l3 = [583000, 5247000] |
---|
198 | ## |
---|
199 | ##poly_tasman_peninsula = [l0, l1, l2, l3] |
---|
200 | ## |
---|
201 | ### Bruny Island |
---|
202 | ##poly_bruny = read_polygon(polygondir+'bruny.csv') |
---|
203 | |
---|
204 | |
---|
205 | # Hobart digitized polygons |
---|
206 | poly_hobart1 = read_polygon(polygondir+'Hob_poly1.csv') |
---|
207 | poly_hobart2 = read_polygon(polygondir+'Hob_poly2.csv') |
---|
208 | poly_hobart3 = read_polygon(polygondir+'Hob_poly3.csv') |
---|
209 | |
---|
210 | plot_polygons([polyAll, poly_hobart1,poly_hobart2,poly_hobart3],'boundingpoly2',verbose=False) |
---|