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, is_inside_polygon, number_mesh_triangles |
---|
10 | #from anuga.coordinate_transforms.redfearn import degminsec2decimal_degrees, convert_points_from_latlon_to_utm |
---|
11 | from anuga.utilities.system_tools import get_user_name |
---|
12 | |
---|
13 | # file and system info |
---|
14 | #--------------------------------- |
---|
15 | codename = 'project.py' |
---|
16 | |
---|
17 | home = getenv('INUNDATIONHOME') #Sandpit's parent dir |
---|
18 | user = get_user_name() |
---|
19 | |
---|
20 | # INUNDATIONHOME is the inundation directory, not the data directory. |
---|
21 | home += sep +'data' |
---|
22 | |
---|
23 | #time stuff |
---|
24 | time = strftime('%Y%m%d_%H%M%S',localtime()) #gets time for new dir |
---|
25 | gtime = strftime('%Y%m%d_%H%M%S',gmtime()) #gets time for new dir |
---|
26 | build_time = time+'_build' |
---|
27 | run_time = time+'_run' |
---|
28 | print 'gtime: ', gtime |
---|
29 | |
---|
30 | tide = 0.6 |
---|
31 | |
---|
32 | #Making assumptions about the location of scenario data |
---|
33 | state = 'western_australia' |
---|
34 | scenario_name = 'perth' |
---|
35 | scenario = 'perth_tsunami_scenario_2006' |
---|
36 | |
---|
37 | # onshore data provided by WA DLI |
---|
38 | onshore_name = 'perth_dli_ext' # original |
---|
39 | #island |
---|
40 | island_name = 'rott_dli_ext' # original |
---|
41 | island_name1 = 'gard_dli_ext' |
---|
42 | island_name2 = 'carnac_island_dted' |
---|
43 | island_name3 = 'penguin_dted' |
---|
44 | |
---|
45 | # AHO + DPI data + colin French coastline |
---|
46 | coast_name = 'waterline' |
---|
47 | offshore_name = 'perth_bathymetry' |
---|
48 | offshore1_name = 'missing_fairsheets' |
---|
49 | |
---|
50 | #final topo name |
---|
51 | combined_name ='perth_combined_elevation' |
---|
52 | combined_smaller_name = 'perth_combined_elevation_smaller' |
---|
53 | |
---|
54 | |
---|
55 | topographies_in_dir = home+sep+state+sep+scenario+sep+'elevation_final'+sep+'points'+sep |
---|
56 | topographies_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'topographies'+sep |
---|
57 | topographies_time_dir = topographies_dir+build_time+sep |
---|
58 | |
---|
59 | # input topo file location |
---|
60 | onshore_in_dir_name = topographies_in_dir + onshore_name |
---|
61 | island_in_dir_name = topographies_in_dir + island_name |
---|
62 | island_in_dir_name1 = topographies_in_dir + island_name1 |
---|
63 | island_in_dir_name2 = topographies_in_dir + island_name2 |
---|
64 | island_in_dir_name3 = topographies_in_dir + island_name3 |
---|
65 | |
---|
66 | coast_in_dir_name = topographies_in_dir + coast_name |
---|
67 | offshore_in_dir_name = topographies_in_dir + offshore_name |
---|
68 | offshore1_in_dir_name = topographies_in_dir + offshore1_name |
---|
69 | |
---|
70 | onshore_dir_name = topographies_dir + onshore_name |
---|
71 | island_dir_name = topographies_dir + island_name |
---|
72 | island_dir_name1 = topographies_dir + island_name1 |
---|
73 | island_dir_name2 = topographies_dir + island_name2 |
---|
74 | island_dir_name3 = topographies_dir + island_name3 |
---|
75 | |
---|
76 | coast_dir_name = topographies_dir + coast_name |
---|
77 | offshore_dir_name = topographies_dir + offshore_name |
---|
78 | |
---|
79 | #final topo files |
---|
80 | combined_dir_name = topographies_dir + combined_name |
---|
81 | combined_time_dir_name = topographies_time_dir + combined_name |
---|
82 | combined_smaller_name_dir = topographies_dir + combined_smaller_name |
---|
83 | #combined_time_dir_final_name = topographies_time_dir + combined_final_name |
---|
84 | |
---|
85 | |
---|
86 | |
---|
87 | meshes_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'meshes'+sep |
---|
88 | meshes_dir_name = meshes_dir + scenario_name |
---|
89 | |
---|
90 | polygons_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'polygons'+sep |
---|
91 | tide_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'tide_data'+sep |
---|
92 | |
---|
93 | |
---|
94 | boundaries_source = '????' |
---|
95 | #boundaries locations |
---|
96 | boundaries_in_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'boundaries'+sep+'urs'+sep+boundaries_source+sep |
---|
97 | boundaries_in_dir_name = boundaries_in_dir + scenario_name |
---|
98 | boundaries_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'boundaries'+sep |
---|
99 | boundaries_dir_name = boundaries_dir + scenario_name |
---|
100 | #boundaries_time_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'boundaries'+sep+build_time+sep |
---|
101 | #boundaries_time_dir_name = boundaries_time_dir + boundaries_name #Used by post processing |
---|
102 | |
---|
103 | #output locations |
---|
104 | output_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'outputs'+sep |
---|
105 | output_build_time_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'outputs'+sep+build_time+sep |
---|
106 | output_run_time_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'outputs'+sep+run_time+sep |
---|
107 | output_run_time_dir_name = output_run_time_dir + scenario_name #Used by post processing |
---|
108 | |
---|
109 | #gauges |
---|
110 | gauge_name = 'perth.csv' |
---|
111 | gauges_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'gauges'+sep |
---|
112 | gauges_dir_name = gauges_dir + gauge_name |
---|
113 | |
---|
114 | #buildings_filename = gauges_dir + 'perth_res_nexis.csv' |
---|
115 | buildings_filename_damage_out = 'perth_res_nexis_modified.csv' |
---|
116 | |
---|
117 | ############################### |
---|
118 | # Domain definitions |
---|
119 | ############################### |
---|
120 | from anuga.utilities.polygon import read_polygon, plot_polygons, polygon_area, is_inside_polygon |
---|
121 | |
---|
122 | poly_all = read_polygon(polygons_dir+'bounding_poly.csv') |
---|
123 | res_poly_all = 100000 |
---|
124 | |
---|
125 | refzone = 50 |
---|
126 | |
---|
127 | |
---|
128 | ############################### |
---|
129 | # Interior region definitions |
---|
130 | ############################### |
---|
131 | |
---|
132 | #poly_pos20_neg20 = read_polygon(polygons_dir+'pos20_neg20pts.csv') |
---|
133 | poly_pos20_neg20 = read_polygon(polygons_dir+'pos20_neg20_new_pts.csv') |
---|
134 | res_pos20_neg20 = 20000 |
---|
135 | |
---|
136 | #poly_cbd = read_polygon(polygons_dir+'cbd_pts.csv') |
---|
137 | poly_cbd = read_polygon(polygons_dir+'cbd_new_pts.csv') |
---|
138 | res_cbd = 1000 |
---|
139 | |
---|
140 | poly_penguin = read_polygon(polygons_dir+'penguin_pts.csv') |
---|
141 | res_penguin = 1000 |
---|
142 | #assert zone == refzone |
---|
143 | |
---|
144 | interior_regions = [[poly_pos20_neg20,res_pos20_neg20],[poly_cbd,res_cbd] |
---|
145 | ,[poly_penguin,res_penguin]] |
---|
146 | |
---|
147 | trigs_min = number_mesh_triangles(interior_regions, poly_all, res_poly_all) |
---|
148 | |
---|
149 | print 'min number triangles', trigs_min |
---|
150 | |
---|
151 | ################################################################### |
---|
152 | # Clipping regions for export to asc and regions for clipping data |
---|
153 | ################################################################### |
---|
154 | |
---|
155 | # exporting asc grid |
---|
156 | eastingmin = 406215.87 |
---|
157 | eastingmax = 440208.78 |
---|
158 | northingmin = 7983427.73 |
---|
159 | northingmax = 8032834.52 |
---|
160 | |
---|
161 | |
---|
162 | |
---|