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 | |
---|
29 | ## |
---|
30 | ### data provided by Tas SES and checked by NM&I |
---|
31 | ###onshore_name = 'hob3_topo' # original |
---|
32 | ###onshore_name_25 = 'hob5_topo_25m' # 25m grid and clipped to 100m elevation or 3000m from coast |
---|
33 | ##onshore_name = 'hob5_topo' # 12.5m grid and clipped to 100m elevation or 3000m from coast |
---|
34 | ##onshore_name_25 = 'hob6_topo_25m' # 25m grid NOT clipped |
---|
35 | ##offshore_name_tas1 = 'derwent_2m' |
---|
36 | ##offshore_name_tas2 = 'derwent_5m' |
---|
37 | ##offshore_name_tas3 = 'south_east_tas' #actually this is AHO |
---|
38 | ##offshore_name_tas4 = 'hobart_1m' |
---|
39 | ## |
---|
40 | ### AHO data and checked by NM&I |
---|
41 | ##offshore_name1 = 'xy100003760' |
---|
42 | ##offshore_name2 = 'xy100003761' |
---|
43 | ##offshore_name3 = 'xy100003762' |
---|
44 | ##offshore_name4 = 'xy100003907' |
---|
45 | ##offshore_name5 = 'xy100003908' |
---|
46 | ##offshore_name6 = 'xy100003909' |
---|
47 | ##offshore_name7 = 'xy100003910' |
---|
48 | ##offshore_name8 = 'xy100003932' |
---|
49 | ##offshore_name9 = 'xy100003933' |
---|
50 | ##offshore_name10 = 'xy100003934' |
---|
51 | ##offshore_name11 = 'xy100003935' |
---|
52 | ##offshore_name12 = 'xy100003936' |
---|
53 | ##offshore_name13 = 'xy100003964' |
---|
54 | ##offshore_name14 = 'xy100014250' |
---|
55 | ##offshore_name15 = 'xy100014253' |
---|
56 | ##offshore_name16 = 'xy100016142' |
---|
57 | ## |
---|
58 | ### developed by NM&I |
---|
59 | ##coast_name = 'coastline_points' |
---|
60 | |
---|
61 | boundary_basename = 'puysegur' # Mw 8.7 |
---|
62 | #boundary_basename = 'puysegur_clip' # Mw 8.5 |
---|
63 | |
---|
64 | |
---|
65 | #swollen/ all data output |
---|
66 | basename = 'source' |
---|
67 | |
---|
68 | codename = 'project.py' |
---|
69 | |
---|
70 | #Derive subdirectories and filenames |
---|
71 | #time = strftime('%Y%m%d_%H%M%S',localtime()) #gets time for new dir |
---|
72 | local_time = strftime('%Y%m%d_%H%M%S',gmtime()) #gets time for new dir |
---|
73 | meshdir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'meshes'+sep |
---|
74 | datadir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'topographies'+sep |
---|
75 | gaugedir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'gauges'+sep |
---|
76 | polygondir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'polygons'+sep |
---|
77 | boundarydir = home+sep+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'boundaries'+sep |
---|
78 | outputdir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'outputs'+sep |
---|
79 | outputtimedir = outputdir + local_time + sep |
---|
80 | polygondir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'polygons'+sep |
---|
81 | |
---|
82 | gauge_filename = gaugedir + 'hobart_gauges_final.csv' |
---|
83 | #buildings_filename = gaugedir + 'hobart_res.csv' |
---|
84 | #buildings_filename_damage_out = 'hobart_res_modified.csv' |
---|
85 | #gaugetimeseries = gaugedir + 'hobart' |
---|
86 | |
---|
87 | # boundary source data |
---|
88 | #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 |
---|
89 | |
---|
90 | codedir = getcwd()+sep |
---|
91 | codedirname = codedir + 'project.py' |
---|
92 | meshname = outputtimedir + 'mesh_' + basename |
---|
93 | |
---|
94 | # Necessary if using point datasets, rather than grid |
---|
95 | ##onshore_dem_name = datadir + onshore_name |
---|
96 | ##onshore_dem_name_25 = datadir + onshore_name_25 |
---|
97 | ##all_onshore_dem_name = datadir + 'combined_onshore' |
---|
98 | ##offshore_dem_name_local1 = datadir + offshore_name_tas1 |
---|
99 | ##offshore_dem_name_local2 = datadir + offshore_name_tas2 |
---|
100 | ##offshore_dem_name_local3 = datadir + offshore_name_tas3 |
---|
101 | ##offshore_dem_name_local4 = datadir + offshore_name_tas4 |
---|
102 | ##offshore_dem_name_aho1 = datadir + offshore_name1 |
---|
103 | ##offshore_dem_name_aho2 = datadir + offshore_name2 |
---|
104 | ##offshore_dem_name_aho3 = datadir + offshore_name3 |
---|
105 | ##offshore_dem_name_aho4 = datadir + offshore_name4 |
---|
106 | ##offshore_dem_name_aho5 = datadir + offshore_name5 |
---|
107 | ##offshore_dem_name_aho6 = datadir + offshore_name6 |
---|
108 | ##offshore_dem_name_aho7 = datadir + offshore_name7 |
---|
109 | ##offshore_dem_name_aho8 = datadir + offshore_name8 |
---|
110 | ##offshore_dem_name_aho9 = datadir + offshore_name9 |
---|
111 | ##offshore_dem_name_aho10 = datadir + offshore_name10 |
---|
112 | ##offshore_dem_name_aho11 = datadir + offshore_name11 |
---|
113 | ##offshore_dem_name_aho12 = datadir + offshore_name12 |
---|
114 | ##offshore_dem_name_aho13 = datadir + offshore_name13 |
---|
115 | ##offshore_dem_name_aho14 = datadir + offshore_name14 |
---|
116 | ##offshore_dem_name_aho15 = datadir + offshore_name15 |
---|
117 | ##offshore_dem_name_aho16 = datadir + offshore_name16 |
---|
118 | ##coast_dem_name = datadir + coast_name |
---|
119 | |
---|
120 | |
---|
121 | # addition once total grid delivered |
---|
122 | onshore_offshore_dem_name_25 = datadir + '25m_se_tas' #25m grid |
---|
123 | onshore_offshore_dem_name = datadir + '50m_se_tas' #50m grid |
---|
124 | |
---|
125 | # output names |
---|
126 | bruny_dem_name_25 = datadir + 'bruny_25_dem' |
---|
127 | hobart_dem_name_25 = datadir + 'hobart_25_dem' |
---|
128 | combined_dem_name = datadir + 'hobart_combined_elevation' |
---|
129 | combined_dem_name_2 = datadir + 'hobart_combined_elevation_2' |
---|
130 | |
---|
131 | #outputname = outputtimedir + basename #Used by post processing |
---|
132 | |
---|
133 | |
---|
134 | ############################### |
---|
135 | # Domain definitions |
---|
136 | ############################### |
---|
137 | |
---|
138 | # bounding box for clipping MOST output (much bigger than study area) |
---|
139 | south = degminsec2decimal_degrees(-44,45,0) |
---|
140 | north = degminsec2decimal_degrees(-42,0,0) |
---|
141 | west = degminsec2decimal_degrees(146,45,0) |
---|
142 | east = degminsec2decimal_degrees(148,25,0) |
---|
143 | |
---|
144 | ###Main Domain of Hobart: |
---|
145 | d0 = [south, west] |
---|
146 | d1 = [south, east] |
---|
147 | d2 = [north, east] |
---|
148 | d3 = [north, west] |
---|
149 | polyAll2, zone = convert_points_from_latlon_to_utm([d0, d1, d2, d3]) |
---|
150 | refzone = zone |
---|
151 | |
---|
152 | # Second run - bottom bright, topr, top, left |
---|
153 | #polyAll = [[520000, 5170000],[580000, 5170000],[580000, 5200000],[590000,5240000],[520000,5260000]] |
---|
154 | |
---|
155 | |
---|
156 | # Mark run - morning Fri 29 Sep; surrounds -100m and 20mish elevation |
---|
157 | polyAll = read_polygon(polygondir+'new_extent.csv') |
---|
158 | plot_polygons([polyAll, polyAll2],'boundingpoly',verbose=False) |
---|
159 | |
---|
160 | |
---|
161 | ################################################################### |
---|
162 | # Clipping regions for export to asc and regions for clipping data |
---|
163 | ################################################################### |
---|
164 | |
---|
165 | |
---|
166 | # clipping 25m data set - Hobart |
---|
167 | eastingmin25 = 524208.387 |
---|
168 | eastingmax25 = 554867.24 |
---|
169 | northingmin25 = 5229154.555 |
---|
170 | northingmax25 = 5258511.857 |
---|
171 | |
---|
172 | # clipping 25m data set - Bruny |
---|
173 | eastingmin25_2 = 523672.502 |
---|
174 | eastingmax25_2 = 536020.057 |
---|
175 | northingmin25_2 = 5203120.035 |
---|
176 | northingmax25_2 = 5212052.309 |
---|
177 | |
---|
178 | |
---|
179 | |
---|
180 | ############################### |
---|
181 | # Interior region definitions |
---|
182 | ############################### |
---|
183 | |
---|
184 | ###Interior region - Hobart city area + Glenorchy, Kingston |
---|
185 | ##i0 = [517000, 5267000] |
---|
186 | ##i1 = [517000, 5255000] |
---|
187 | ##i2 = [520000, 5250000] |
---|
188 | ##i3 = [522000, 5239000] |
---|
189 | ##i4 = [524000, 5238000] |
---|
190 | ##i5 = [526000, 5236000] |
---|
191 | ##i6 = [530000, 5244000] |
---|
192 | ##i7 = [530000, 5250000] |
---|
193 | ##i8 = [534000, 5254000] |
---|
194 | ##i9 = [520000, 5270000] |
---|
195 | ## |
---|
196 | ##poly_hobart = [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9] |
---|
197 | ## |
---|
198 | ### Tasman Peninsula |
---|
199 | ##l0 = [550000, 5247000] |
---|
200 | ##l1 = [550000, 5211000] |
---|
201 | ##l2 = [583000, 5211000] |
---|
202 | ##l3 = [583000, 5247000] |
---|
203 | ## |
---|
204 | ##poly_tasman_peninsula = [l0, l1, l2, l3] |
---|
205 | ## |
---|
206 | ### Bruny Island |
---|
207 | ##poly_bruny = read_polygon(polygondir+'bruny.csv') |
---|
208 | |
---|
209 | |
---|
210 | # Hobart digitized polygons |
---|
211 | poly_hobart1 = read_polygon(polygondir+'Hob_poly1.csv') |
---|
212 | poly_hobart2 = read_polygon(polygondir+'Hob_poly2.csv') |
---|
213 | poly_hobart3 = read_polygon(polygondir+'Hob_poly3.csv') |
---|
214 | |
---|
215 | plot_polygons([polyAll, poly_hobart1,poly_hobart2,poly_hobart3],'boundingpoly2',verbose=False) |
---|