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 = 'newcastle_tsunami_scenario_2006' |
---|
26 | |
---|
27 | # onshore data provided by NSW LPI, Krishna merged with existing |
---|
28 | # PMD data to make 100m DEM |
---|
29 | nsw100 = 'dem_utm' |
---|
30 | |
---|
31 | # survey data |
---|
32 | offshore_name2 = 'surveyAreaB' |
---|
33 | offshore_name3 = 'surveyAreaC' |
---|
34 | |
---|
35 | # AHO data |
---|
36 | offshore_name4 = '1000003611export' |
---|
37 | offshore_name5 = '1000003613export' |
---|
38 | offshore_name6 = '1000003614export' |
---|
39 | offshore_name7 = '1000003627export' |
---|
40 | offshore_name8 = '1000003628export' |
---|
41 | offshore_name9 = 'AHDexport' |
---|
42 | |
---|
43 | #swollen/ all data output |
---|
44 | basename = 'source' |
---|
45 | codename = 'project_slide.py' |
---|
46 | |
---|
47 | #Derive subdirectories and filenames |
---|
48 | local_time = strftime('%Y%m%d_%H%M%S',gmtime()) |
---|
49 | meshdir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'meshes'+sep |
---|
50 | datadir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'topographies'+sep |
---|
51 | gaugedir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'gauges'+sep |
---|
52 | polygondir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'polygons'+sep |
---|
53 | boundarydir = home+sep+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'boundaries'+sep |
---|
54 | outputdir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'outputs'+sep |
---|
55 | outputtimedir = outputdir + local_time + sep |
---|
56 | polygondir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'polygons'+sep |
---|
57 | |
---|
58 | gauge_filename = gaugedir + 'newcastle_gauges.csv' |
---|
59 | codedir = getcwd()+sep |
---|
60 | codedirname = codedir + 'project_slide.py' |
---|
61 | meshname = outputtimedir + 'mesh_' + basename |
---|
62 | |
---|
63 | # Necessary if using point datasets, rather than grid |
---|
64 | nsw_dem_name = datadir + nsw100 |
---|
65 | offshore_dem_name2 = datadir + offshore_name2 |
---|
66 | offshore_dem_name3 = datadir + offshore_name3 |
---|
67 | offshore_dem_name4 = datadir + offshore_name4 |
---|
68 | offshore_dem_name5 = datadir + offshore_name5 |
---|
69 | offshore_dem_name6 = datadir + offshore_name6 |
---|
70 | offshore_dem_name7 = datadir + offshore_name7 |
---|
71 | offshore_dem_name8 = datadir + offshore_name8 |
---|
72 | offshore_dem_name9 = datadir + offshore_name9 |
---|
73 | combined_dem_name = datadir + 'newcastle_combined_elevation' |
---|
74 | |
---|
75 | ############################### |
---|
76 | # Domain definitions |
---|
77 | ############################### |
---|
78 | |
---|
79 | # bounding polygon for study area |
---|
80 | polyAll = read_polygon(polygondir+'extentC3.csv') |
---|
81 | |
---|
82 | print 'Area of bounding polygon', polygon_area(polyAll)/1000000.0 |
---|
83 | |
---|
84 | ############################### |
---|
85 | # Interior region definitions |
---|
86 | ############################### |
---|
87 | |
---|
88 | # newcastle digitized polygons |
---|
89 | poly_local = read_polygon(polygondir+'local2.csv') |
---|
90 | poly_newcastle = read_polygon(polygondir+'newcastle.csv') |
---|
91 | |
---|
92 | print 'Area of local polygon', polygon_area(poly_local)/1000000.0 |
---|
93 | print 'Area of CBD polygon', polygon_area(poly_newcastle)/1000000.0 |
---|
94 | |
---|
95 | #plot_polygons([polyAll,poly_local,poly_newcastle],'fig',verbose=True) |
---|
96 | ################################################################### |
---|
97 | # Clipping regions for export to asc and regions for clipping data |
---|
98 | ################################################################### |
---|
99 | |
---|
100 | # clipping for nsw grid for conversion |
---|
101 | eastingmin_nsw = 350390 |
---|
102 | eastingmax_nsw = 546000 |
---|
103 | northingmin_nsw = 6253970 |
---|
104 | northingmax_nsw = 6424600 |
---|
105 | |
---|
106 | poly_surveyclip = read_polygon(polygondir+'surveyclip.csv') |
---|
107 | |
---|
108 | # exporting asc grid |
---|
109 | eastingmin = 366890 |
---|
110 | eastingmax = 404270 |
---|
111 | northingmin = 6335450 |
---|
112 | northingmax = 6375630 |
---|
113 | |
---|
114 | ################################################################### |
---|
115 | # Slide characteristics |
---|
116 | ################################################################### |
---|
117 | |
---|
118 | slide_origin_a = [352928.37,6188303.94] |
---|
119 | slide_origin_b = [393301.80,6253255.08] |
---|
120 | slide_origin_c = [446025.35,6330307.46] |
---|
121 | |
---|
122 | bulli_depth = 2087.0 |
---|
123 | bulli_length = 16840.0 |
---|
124 | bulli_thickness = 424.0 |
---|
125 | bulli_width = 8860.0 |
---|
126 | bulli_density = 1.46 |
---|
127 | bulli_slope = 4.0 |
---|
128 | bulli_alpha = 126.0 - 90.0 |
---|
129 | |
---|
130 | shovel_depth = 968.0 |
---|
131 | shovel_length = 13500.0 |
---|
132 | shovel_thickness = 165.0 |
---|
133 | shovel_width = 4350.0 |
---|
134 | shovel_density = 1.49 |
---|
135 | shovel_slope = 4.0 |
---|
136 | shovel_alpha = 118.0 - 90.0 |
---|
137 | |
---|
138 | yacaaba_depth = 1119.0 |
---|
139 | yacaaba_length = 7050.0 |
---|
140 | yacaaba_thickness = 144.0 |
---|
141 | yacaaba_width = 3080.0 |
---|
142 | yacaaba_density = 1.48 |
---|
143 | yacaaba_slope = 3.0 |
---|
144 | yacaaba_alpha = 133.0 - 90.0 |
---|