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, polygon_area, is_inside_polygon |
---|
10 | |
---|
11 | if sys.platform == 'win32': |
---|
12 | home = getenv('INUNDATIONHOME') |
---|
13 | user = getenv('USERPROFILE') |
---|
14 | |
---|
15 | else: |
---|
16 | home = getenv('INUNDATIONHOME', sep+'d'+sep+'xrd'+sep+'gem'+sep+'2'+sep+'ramp'+sep+'risk_assessment_methods_project'+sep+'inundation') |
---|
17 | user = getenv('LOGNAME') |
---|
18 | print 'USER:', user |
---|
19 | |
---|
20 | # INUNDATIONHOME is the inundation directory, not the data directory. |
---|
21 | home += sep +'data' |
---|
22 | |
---|
23 | #Making assumptions about the location of scenario data |
---|
24 | state = 'new_south_wales' |
---|
25 | scenario_dir_name = 'sydney_tsunami_scenario_2006' |
---|
26 | |
---|
27 | # onshore data provided by NSW LPI, Krishna merged with existing |
---|
28 | # PMD data to make 100m DEM |
---|
29 | on_offshore_name25 = 'bathy_dem25' |
---|
30 | on_offshore_name100 = 'bathyland100' |
---|
31 | nsw100 = 'dem_utm' |
---|
32 | |
---|
33 | # survey data |
---|
34 | offshore_name1 = 'surveyAreaA' |
---|
35 | offshore_name2 = 'surveyAreaB' |
---|
36 | offshore_name3 = 'surveyAreaC' |
---|
37 | |
---|
38 | # AHO data |
---|
39 | offshore_name4 = '1000003611export' |
---|
40 | offshore_name5 = '1000003613export' |
---|
41 | offshore_name6 = '1000003614export' |
---|
42 | offshore_name7 = '1000003627export' |
---|
43 | offshore_name8 = '1000003628export' |
---|
44 | offshore_name9 = 'AHDexport' |
---|
45 | |
---|
46 | #swollen/ all data output |
---|
47 | basename = 'source' |
---|
48 | codename = 'project_slide.py' |
---|
49 | |
---|
50 | #Derive subdirectories and filenames |
---|
51 | local_time = strftime('%Y%m%d_%H%M%S',gmtime()) |
---|
52 | meshdir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'meshes'+sep |
---|
53 | datadir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'topographies'+sep |
---|
54 | gaugedir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'gauges'+sep |
---|
55 | polygondir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'polygons'+sep |
---|
56 | boundarydir = home+sep+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'boundaries'+sep |
---|
57 | outputdir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'outputs'+sep |
---|
58 | outputtimedir = outputdir + local_time + sep |
---|
59 | polygondir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'polygons'+sep |
---|
60 | |
---|
61 | gauge_filename = gaugedir + 'sydney_slide_gauges.csv' |
---|
62 | codedir = getcwd()+sep |
---|
63 | codedirname = codedir + 'project_slide.py' |
---|
64 | meshname = outputtimedir + 'mesh_' + basename |
---|
65 | |
---|
66 | # Necessary if using point datasets, rather than grid |
---|
67 | on_offshore25_dem_name = datadir + on_offshore_name25 |
---|
68 | on_offshore100_dem_name = datadir + on_offshore_name100 |
---|
69 | nsw_dem_name = datadir + nsw100 |
---|
70 | offshore_dem_name1 = datadir + offshore_name1 |
---|
71 | offshore_dem_name2 = datadir + offshore_name2 |
---|
72 | offshore_dem_name3 = datadir + offshore_name3 |
---|
73 | offshore_dem_name4 = datadir + offshore_name4 |
---|
74 | offshore_dem_name5 = datadir + offshore_name5 |
---|
75 | offshore_dem_name6 = datadir + offshore_name6 |
---|
76 | offshore_dem_name7 = datadir + offshore_name7 |
---|
77 | offshore_dem_name8 = datadir + offshore_name8 |
---|
78 | offshore_dem_name9 = datadir + offshore_name9 |
---|
79 | combined_dem_name = datadir + 'sydney_combined_elevation' |
---|
80 | |
---|
81 | ############################### |
---|
82 | # Domain definitions |
---|
83 | ############################### |
---|
84 | |
---|
85 | # bounding polygon for study area |
---|
86 | polyAll = read_polygon(polygondir+'extent3.csv') |
---|
87 | |
---|
88 | print 'Area of bounding polygon', polygon_area(polyAll)/1000000.0 |
---|
89 | |
---|
90 | ############################### |
---|
91 | # Interior region definitions |
---|
92 | ############################### |
---|
93 | |
---|
94 | # sydney digitized polygons |
---|
95 | poly_coast = read_polygon(polygondir+'coast2.csv') |
---|
96 | poly_syd1 = read_polygon(polygondir+'local.csv') |
---|
97 | |
---|
98 | print 'Area of local polygon', polygon_area(poly_syd1)/1000000.0 |
---|
99 | print 'Area of coastal polygon', polygon_area(poly_coast)/1000000.0 |
---|
100 | |
---|
101 | ################################################################### |
---|
102 | # Clipping regions for export to asc and regions for clipping data |
---|
103 | ################################################################### |
---|
104 | |
---|
105 | # clipping for 25m grid for conversion |
---|
106 | eastingmin25 = 324825 |
---|
107 | eastingmax25 = 347650 |
---|
108 | northingmin25 = 6231960 |
---|
109 | northingmax25 = 6272543 |
---|
110 | |
---|
111 | poly_25mclip = read_polygon(polygondir+'25mclip.csv') |
---|
112 | |
---|
113 | # clipping for 100m grid for conversion |
---|
114 | eastingmin100 = 315870 |
---|
115 | eastingmax100 = 361607 |
---|
116 | northingmin100 = 6227588 |
---|
117 | northingmax100 = 6285975 |
---|
118 | |
---|
119 | poly_surveyclip = read_polygon(polygondir+'surveyclip.csv') |
---|
120 | |
---|
121 | # clipping for nsw grid for conversion |
---|
122 | eastingmin_nsw = 315870 |
---|
123 | eastingmax_nsw = 390480 |
---|
124 | northingmin_nsw = 6161100 |
---|
125 | northingmax_nsw = 6330000 |
---|
126 | |
---|
127 | poly_origsyd = [[eastingmin100,northingmin100],[eastingmax100,northingmin100],\ |
---|
128 | [eastingmax100,northingmax100],[eastingmin100,northingmax100]] |
---|
129 | |
---|
130 | # exporting asc grid |
---|
131 | eastingmin = 333000 |
---|
132 | eastingmax = 354000 |
---|
133 | northingmin = 6244800 |
---|
134 | northingmax = 6274550 |
---|
135 | |
---|
136 | ################################################################### |
---|
137 | # Slide characteristics |
---|
138 | ################################################################### |
---|
139 | |
---|
140 | slide_origin_a = [352928.37,6188303.94] |
---|
141 | slide_origin_b = [393301.80,6253255.08] |
---|
142 | slide_origin_c = [446025.35,6330307.46] |
---|
143 | |
---|
144 | bulli_depth = 2087.0 |
---|
145 | bulli_length = 16840.0 |
---|
146 | bulli_thickness = 424.0 |
---|
147 | bulli_width = 8860.0 |
---|
148 | bulli_density = 1.46 |
---|
149 | bulli_slope = 4.0 |
---|
150 | bulli_alpha = 126.0 - 90.0 |
---|
151 | |
---|
152 | shovel_depth = 968.0 |
---|
153 | shovel_length = 13500.0 |
---|
154 | shovel_thickness = 165.0 |
---|
155 | shovel_width = 4350.0 |
---|
156 | shovel_density = 1.49 |
---|
157 | shovel_slope = 4.0 |
---|
158 | shovel_alpha = 118.0 - 90.0 |
---|
159 | |
---|
160 | yacaaba_depth = 1119.0 |
---|
161 | yacaaba_length = 7050.0 |
---|
162 | yacaaba_thickness = 144.0 |
---|
163 | yacaaba_width = 3080.0 |
---|
164 | yacaaba_density = 1.48 |
---|
165 | yacaaba_slope = 3.0 |
---|
166 | yacaaba_alpha = 133.0 - 90.0 |
---|