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 = 'busselton' |
---|
35 | scenario = 'busselton_tsunami_scenario_2006' |
---|
36 | |
---|
37 | # onshore data provided by WA DLI |
---|
38 | onshore_name = 'DLI_orthophoto_DEM' # original |
---|
39 | #islands |
---|
40 | |
---|
41 | # AHO + DPI data |
---|
42 | coast_name = '100k_coastline' |
---|
43 | offshore_name = 'Bathymetry' |
---|
44 | |
---|
45 | #final topo name |
---|
46 | combined_name ='busselton_combined_elevation' |
---|
47 | combined_smaller_name = 'busselton_combined_elevation_smaller' |
---|
48 | |
---|
49 | |
---|
50 | topographies_in_dir = home+sep+state+sep+scenario+sep+'elevation_final'+sep+'points'+sep |
---|
51 | topographies_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'topographies'+sep |
---|
52 | topographies_time_dir = topographies_dir+build_time+sep |
---|
53 | |
---|
54 | #input topo file location |
---|
55 | onshore_in_dir_name = topographies_in_dir + onshore_name |
---|
56 | #island_in_dir_name = topographies_in_dir + island_name |
---|
57 | |
---|
58 | coast_in_dir_name = topographies_in_dir + coast_name |
---|
59 | offshore_in_dir_name = topographies_in_dir + offshore_name |
---|
60 | |
---|
61 | onshore_dir_name = topographies_dir + onshore_name |
---|
62 | #island_dir_name = topographies_dir + island_name |
---|
63 | |
---|
64 | coast_dir_name = topographies_dir + coast_name |
---|
65 | offshore_dir_name = topographies_dir + offshore_name |
---|
66 | |
---|
67 | #final topo files |
---|
68 | combined_dir_name = topographies_dir + combined_name |
---|
69 | combined_time_dir_name = topographies_time_dir + combined_name |
---|
70 | combined_smaller_dir_name = topographies_dir + combined_smaller_name |
---|
71 | |
---|
72 | meshes_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'meshes'+sep |
---|
73 | meshes_dir_name = meshes_dir + scenario_name |
---|
74 | |
---|
75 | polygons_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'polygons'+sep |
---|
76 | tide_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'tide_data'+sep |
---|
77 | |
---|
78 | boundaries_source = '????' |
---|
79 | #boundaries locations |
---|
80 | boundaries_in_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'boundaries'+sep+'urs'+sep+boundaries_source+sep |
---|
81 | boundaries_in_dir_name = boundaries_in_dir + scenario_name |
---|
82 | boundaries_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'boundaries'+sep |
---|
83 | boundaries_dir_name = boundaries_dir + scenario_name |
---|
84 | #boundaries_time_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'boundaries'+sep+build_time+sep |
---|
85 | #boundaries_time_dir_name = boundaries_time_dir + boundaries_name #Used by post processing |
---|
86 | |
---|
87 | #output locations |
---|
88 | output_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'outputs'+sep |
---|
89 | output_build_time_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'outputs'+sep+build_time+sep |
---|
90 | output_run_time_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'outputs'+sep+run_time+sep |
---|
91 | output_run_time_dir_name = output_run_time_dir + scenario_name #Used by post processing |
---|
92 | |
---|
93 | #gauges |
---|
94 | gauge_name = '???.csv' |
---|
95 | gauges_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'gauges'+sep |
---|
96 | gauges_dir_name = gauges_dir + gauge_name |
---|
97 | |
---|
98 | buildings_filename = gauges_dir + 'Busselton_res_Project.csv' |
---|
99 | buildings_filename_out = 'Busselton_res_Project_modified.csv' |
---|
100 | |
---|
101 | ############################### |
---|
102 | # Domain definitions |
---|
103 | ############################### |
---|
104 | |
---|
105 | # bounding box for clipping MOST/URS output (much bigger than study area) |
---|
106 | |
---|
107 | # bounding polygon for study area |
---|
108 | poly_all = read_polygon(polygons_dir+'poly_all.csv') |
---|
109 | res_poly_all = 100000 |
---|
110 | |
---|
111 | ################################################################### |
---|
112 | # Clipping regions for export to asc and regions for clipping data |
---|
113 | ################################################################### |
---|
114 | |
---|
115 | # exporting asc grid |
---|
116 | eastingmin = 406215.87 |
---|
117 | eastingmax = 440208.78 |
---|
118 | northingmin = 7983427.73 |
---|
119 | northingmax = 8032834.52 |
---|
120 | |
---|
121 | ############################### |
---|
122 | # Interior region definitions |
---|
123 | ############################### |
---|
124 | |
---|
125 | #digitized polygons |
---|
126 | poly_busselton1 = read_polygon(polygons_dir+'neg20_pos10_polygon.csv') |
---|
127 | res_busselton1 = 10000 |
---|
128 | poly_busselton2 = read_polygon(polygons_dir+'neg5_pos5_poly_.csv') |
---|
129 | res_busselton2 = 500 |
---|
130 | |
---|
131 | #plot_polygons([polyAll,poly_broome1,poly_broome2,poly_broome3],figname='boundingpoly2',verbose=False) |
---|
132 | |
---|
133 | interior_regions = [[poly_busselton1,res_busselton1],[poly_busselton2,res_busselton2]] |
---|
134 | |
---|
135 | trigs_min = number_mesh_triangles(interior_regions, poly_all, res_poly_all) |
---|
136 | |
---|
137 | print 'min number triangles', trigs_min |
---|
138 | |
---|
139 | |
---|