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 |
---|
31 | |
---|
32 | #Making assumptions about the location of scenario data |
---|
33 | state = 'western_australia' |
---|
34 | scenario_name = 'broome' |
---|
35 | scenario = 'broome_tsunami_scenario_2006' |
---|
36 | |
---|
37 | # onshore data provided by WA DLI |
---|
38 | onshore_name = 'Broome_topography_DLI' # original |
---|
39 | |
---|
40 | #island |
---|
41 | #island_name = 'rott_dli_ext' # original |
---|
42 | |
---|
43 | # offshore |
---|
44 | coast_name = 'Broome_coastline' |
---|
45 | |
---|
46 | offshore_name = 'Broome_Bathymetry' |
---|
47 | offshore_name1 = 'inferred_north' |
---|
48 | offshore_name2 = 'inferred_south' |
---|
49 | |
---|
50 | #final topo name |
---|
51 | combined_name ='broome_combined_elevation' |
---|
52 | combined_small_name = 'broome_combined_elevation_small' |
---|
53 | |
---|
54 | topographies_in_dir = home+sep+state+sep+scenario+sep+'elevation_final'+sep+'points'+sep+'Feb07'+sep |
---|
55 | topographies_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'topographies'+sep |
---|
56 | topographies_time_dir = topographies_dir+build_time+sep |
---|
57 | |
---|
58 | #input topo file location |
---|
59 | onshore_in_dir_name = topographies_in_dir + onshore_name |
---|
60 | #island_in_dir_name = topographies_in_dir + island_name |
---|
61 | |
---|
62 | coast_in_dir_name = topographies_in_dir + coast_name |
---|
63 | |
---|
64 | offshore_in_dir_name = topographies_in_dir + offshore_name |
---|
65 | offshore_in_dir_name1 = topographies_in_dir + offshore_name1 |
---|
66 | offshore_in_dir_name2 = topographies_in_dir + offshore_name2 |
---|
67 | |
---|
68 | onshore_dir_name = topographies_dir + onshore_name |
---|
69 | |
---|
70 | #island_dir_name = topographies_dir + island_name |
---|
71 | |
---|
72 | coast_dir_name = topographies_dir + coast_name |
---|
73 | |
---|
74 | offshore_dir_name = topographies_dir + offshore_name |
---|
75 | offshore_dir_name1 = topographies_dir + offshore_name1 |
---|
76 | offshore_dir_name2 = topographies_dir + offshore_name2 |
---|
77 | |
---|
78 | #final topo files |
---|
79 | combined_dir_name = topographies_dir + combined_name |
---|
80 | combined_small_name_dir = topographies_dir + combined_small_name |
---|
81 | |
---|
82 | meshes_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'meshes'+sep |
---|
83 | meshes_dir_name = meshes_dir + scenario_name |
---|
84 | |
---|
85 | polygons_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'polygons'+sep |
---|
86 | tide_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'tide_data'+sep |
---|
87 | |
---|
88 | |
---|
89 | boundaries_source = '????' |
---|
90 | #boundaries locations |
---|
91 | boundaries_in_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'boundaries'+sep+'urs'+sep+boundaries_source+sep |
---|
92 | boundaries_in_dir_name = boundaries_in_dir + scenario_name |
---|
93 | boundaries_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'boundaries'+sep |
---|
94 | boundaries_dir_name = boundaries_dir + scenario_name |
---|
95 | #boundaries_time_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'boundaries'+sep+build_time+sep |
---|
96 | #boundaries_time_dir_name = boundaries_time_dir + boundaries_name #Used by post processing |
---|
97 | |
---|
98 | #output locations |
---|
99 | output_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'outputs'+sep |
---|
100 | output_build_time_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'outputs'+sep+build_time+sep |
---|
101 | output_run_time_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'outputs'+sep+run_time+sep |
---|
102 | output_run_time_dir_name = output_run_time_dir + scenario_name #Used by post processing |
---|
103 | |
---|
104 | #gauges |
---|
105 | gauge_name = 'broome_gauges.csv' |
---|
106 | gauges_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'gauges'+sep |
---|
107 | gauges_dir_name = gauges_dir + gauge_name |
---|
108 | |
---|
109 | community_filename = gauges_dir + 'CHINS_v2.csv' |
---|
110 | community_broome = gauges_dir + 'community_broome.csv' |
---|
111 | |
---|
112 | #buildings_filename = gauges_dir + 'broome_res_nexis.csv' |
---|
113 | buildings_filename_damage_out = 'broome_res_nexis_modified.csv' |
---|
114 | |
---|
115 | ############################### |
---|
116 | # Domain definitions |
---|
117 | ############################### |
---|
118 | from anuga.utilities.polygon import read_polygon, plot_polygons, polygon_area, is_inside_polygon |
---|
119 | |
---|
120 | poly_all = read_polygon(polygons_dir+'extent.csv') |
---|
121 | res_poly_all = 150000 |
---|
122 | |
---|
123 | ############################### |
---|
124 | # Interior region definitions |
---|
125 | ############################### |
---|
126 | |
---|
127 | poly_0 = read_polygon(polygons_dir+'neg20_coast_contour_pts.csv') |
---|
128 | res_0 = 10000 |
---|
129 | poly_1 = read_polygon(polygons_dir+'broome_north_coast_inside_extent.csv') |
---|
130 | res_1 = 5000 |
---|
131 | |
---|
132 | poly_2 = read_polygon(polygons_dir+'broome_south_coast_inside_extent.csv') |
---|
133 | res_2 = 5000 |
---|
134 | |
---|
135 | poly_3 = read_polygon(polygons_dir+'Broome_town_pts.csv') |
---|
136 | res_3 = 2000 |
---|
137 | |
---|
138 | poly_4 = read_polygon(polygons_dir+'Broome_inner_town_pts.csv') |
---|
139 | res_4 = 500 |
---|
140 | #assert zone == refzone |
---|
141 | |
---|
142 | interior_regions = [[poly_0,res_0],[poly_1,res_1],[poly_2,res_2] |
---|
143 | ,[poly_3,res_3],[poly_4,res_4]] |
---|
144 | |
---|
145 | trigs_min = number_mesh_triangles(interior_regions, poly_all, res_poly_all) |
---|
146 | |
---|
147 | print 'min number triangles', trigs_min |
---|
148 | |
---|
149 | ################################################################### |
---|
150 | # Clipping regions for export to asc and regions for clipping data |
---|
151 | ################################################################### |
---|
152 | |
---|
153 | # exporting asc grid |
---|
154 | eastingmin = 406215.87 |
---|
155 | eastingmax = 440208.78 |
---|
156 | northingmin = 7983427.73 |
---|
157 | northingmax = 8032834.52 |
---|
158 | |
---|
159 | |
---|
160 | |
---|