1 | """ |
---|
2 | This file contains all your file and directory definitions |
---|
3 | for elevation, meshes and outputs. |
---|
4 | """ |
---|
5 | |
---|
6 | import os |
---|
7 | from anuga.utilities.system_tools import get_user_name, get_host_name |
---|
8 | from time import localtime, strftime, gmtime |
---|
9 | from os.path import join, exists |
---|
10 | |
---|
11 | #------------------------------------------------------------------------------- |
---|
12 | # Directory setup |
---|
13 | #------------------------------------------------------------------------------- |
---|
14 | |
---|
15 | # this section needs to be updated to reflect the modelled community. |
---|
16 | # Note, the user needs to set up the directory system accordingly |
---|
17 | state = 'tasmania' |
---|
18 | scenario_name = 'hobart' |
---|
19 | scenario_folder = 'hobart_tsunami_scenario_2009' |
---|
20 | |
---|
21 | #------------------------------------------------------------------------------- |
---|
22 | # Initial Conditions |
---|
23 | #------------------------------------------------------------------------------- |
---|
24 | |
---|
25 | # Model specific parameters. |
---|
26 | # One or all can be changed each time the run_model script is executed |
---|
27 | tide = 0 # difference between MSL and HAT in metres |
---|
28 | # Highest Astronomical Tide = 0.8 m for Hobart |
---|
29 | zone = 55 # specify UTM zone of model |
---|
30 | event_number = 58260 # 58280, 64477 the event number - See event_chosen.xls |
---|
31 | # in anuga/boundaries for more details |
---|
32 | alpha = 0.1 # smoothing parameter for mesh |
---|
33 | friction=0.01 # manning's friction coefficient |
---|
34 | starttime=0 # start time for simulation |
---|
35 | finaltime=65000 # final time for simulation |
---|
36 | |
---|
37 | setup = 'final' # This can be one of three values |
---|
38 | # trial - coarsest mesh, fast |
---|
39 | # basic - coarse mesh |
---|
40 | # final - fine mesh, slowest |
---|
41 | |
---|
42 | #------------------------------------------------------------------------------- |
---|
43 | # Output filename |
---|
44 | # |
---|
45 | # Your output filename should be unique between different runs on different data. |
---|
46 | # The list of items below will be used to create a file in your output directory. |
---|
47 | # Your user name and time+date will be automatically added. For example, |
---|
48 | # [setup, tide, event_number] |
---|
49 | # will result in a filename like |
---|
50 | # 20090212_091046_run_final_0_27283_rwilson |
---|
51 | #------------------------------------------------------------------------------- |
---|
52 | |
---|
53 | output_comment = [setup, tide, event_number] |
---|
54 | |
---|
55 | #------------------------------------------------------------------------------- |
---|
56 | # Input Data |
---|
57 | #------------------------------------------------------------------------------- |
---|
58 | |
---|
59 | # ELEVATION DATA |
---|
60 | # Used in build_elevation.py |
---|
61 | ascii_grid_filenames = [] |
---|
62 | ## Add csv header list to all files in point_filenames |
---|
63 | ##headerlist = ['x', 'y', 'elevation'] |
---|
64 | point_filenames = [] |
---|
65 | |
---|
66 | |
---|
67 | # BOUNDING POLYGON - for data clipping and estimate of triangles in mesh |
---|
68 | # Used in build_elevation.py |
---|
69 | # Format for points easting,northing (no header) |
---|
70 | bounding_polygon_filename = 'bounding_polygon.csv' |
---|
71 | bounding_polygon_maxarea = 1000000 |
---|
72 | |
---|
73 | # INTERIOR REGIONS - for designing the mesh |
---|
74 | # Used in run_model.py |
---|
75 | # Format for points easting,northing (no header) |
---|
76 | interior_regions_data = [['aos1.csv', 1500], |
---|
77 | ['aos2.csv', 1500], |
---|
78 | ['sw.csv', 30000]] |
---|
79 | PriorityArea_filename = 'PriorityAreas.csv' |
---|
80 | |
---|
81 | # LAND - used to set the initial stage/water to be offcoast only |
---|
82 | # Used in run_model.py. Format for points easting,northing (no header) |
---|
83 | land_initial_conditions_filename = 'initial_conditions.csv' |
---|
84 | |
---|
85 | # FINAL BOUNDING POLYGON - used in build_boundary.py and run_model.py respectively |
---|
86 | # NOTE: when files are put together the points must be in sequence |
---|
87 | # For ease go clockwise! |
---|
88 | # Check the run_model.py for boundary_tags |
---|
89 | |
---|
90 | # Thinned ordering file from Hazard Map (geographic) |
---|
91 | # Format is index,latitude,longitude (with header) |
---|
92 | urs_order_filename = 'urs_order.csv' |
---|
93 | |
---|
94 | # Landward bounding points |
---|
95 | # Format easting,northing (no header) |
---|
96 | landward_boundary_filename = 'landward_boundary.csv' |
---|
97 | |
---|
98 | # GAUGES - for creating timeseries at a specific point |
---|
99 | # Used in get_timeseries.py. |
---|
100 | # Format easting,northing,name,elevation (with header) |
---|
101 | gauges_filename = 'time_of_arrival_all.csv' #'TideGaugesPoints.csv' |
---|
102 | #'tsunamipointsMGA.csv' |
---|
103 | |
---|
104 | #------------------------------------------------------------------------------- |
---|
105 | # Clipping regions for export to asc and regions for clipping data |
---|
106 | # Final inundation maps should only be created in regions of the finest mesh |
---|
107 | #------------------------------------------------------------------------------- |
---|
108 | |
---|
109 | # ASCII export grid for Hobart Communities |
---|
110 | xminHobart = 520000 |
---|
111 | xmaxHobart = 545000 |
---|
112 | yminHobart = 5230000 |
---|
113 | ymaxHobart = 5260000 |
---|
114 | |
---|
115 | # ASCII export grid for North West Communities |
---|
116 | xminNW = 548000 |
---|
117 | xmaxNW = 561000 |
---|
118 | yminNW = 5250000 |
---|
119 | ymaxNW = 5258000 |
---|
120 | |
---|
121 | # ASCII export grid for South Communities |
---|
122 | xminSouth = 523000 |
---|
123 | xmaxSouth = 533300 |
---|
124 | yminSouth = 5197000 |
---|
125 | ymaxSouth = 5214000 |
---|
126 | |
---|
127 | |
---|
128 | ################################################################################ |
---|
129 | ################################################################################ |
---|
130 | #### NOTE: NOTHING WOULD NORMALLY CHANGE BELOW THIS POINT. #### |
---|
131 | ################################################################################ |
---|
132 | ################################################################################ |
---|
133 | |
---|
134 | # Get system user and host names. |
---|
135 | # These values can be used to distinguish between two similar runs by two |
---|
136 | # different users or runs by the same user on two different machines. |
---|
137 | user = get_user_name() |
---|
138 | host = get_host_name() |
---|
139 | |
---|
140 | # Environment variable names. |
---|
141 | # The inundation directory, not the data directory. |
---|
142 | ENV_INUNDATIONHOME = 'ANUGADATA' |
---|
143 | |
---|
144 | #------------------------------------------------------------------------------- |
---|
145 | # Output Elevation Data |
---|
146 | #------------------------------------------------------------------------------- |
---|
147 | |
---|
148 | # Output filename for elevation |
---|
149 | # this is a combination of all the data generated in build_elevation.py |
---|
150 | combined_elevation_basename = scenario_name + '_combined_elevation' |
---|
151 | |
---|
152 | #------------------------------------------------------------------------------- |
---|
153 | # Directory Structure |
---|
154 | #------------------------------------------------------------------------------- |
---|
155 | |
---|
156 | # determines time for setting up output directories |
---|
157 | time = strftime('%Y%m%d_%H%M%S', localtime()) |
---|
158 | gtime = strftime('%Y%m%d_%H%M%S', gmtime()) |
---|
159 | build_time = time + '_build' |
---|
160 | run_time = time + '_run_' |
---|
161 | |
---|
162 | # create paths generated from environment variables. |
---|
163 | home = join(os.getenv(ENV_INUNDATIONHOME), 'data') # Absolute path for data folder |
---|
164 | |
---|
165 | # check various directories/files that must exist |
---|
166 | anuga_folder = join(home, state, scenario_folder, 'anuga') |
---|
167 | topographies_folder = join(anuga_folder, 'topographies') |
---|
168 | polygons_folder = join(anuga_folder, 'polygons') |
---|
169 | boundaries_folder = join(anuga_folder, 'boundaries') |
---|
170 | output_folder = join(anuga_folder, 'outputs') |
---|
171 | gauges_folder = join(anuga_folder, 'gauges') |
---|
172 | event_folder = join(boundaries_folder, str(event_number)) |
---|
173 | |
---|
174 | #------------------------------------------------------------------------------- |
---|
175 | # Location of input and output data |
---|
176 | #------------------------------------------------------------------------------- |
---|
177 | |
---|
178 | # Convert the user output_comment to a string for run_model.py |
---|
179 | output_comment = ('_'.join([str(x) for x in output_comment if x != user]) |
---|
180 | + '_' + user) |
---|
181 | |
---|
182 | # The absolute pathname of the all elevation, generated in build_elevation.py |
---|
183 | combined_elevation = join(topographies_folder, combined_elevation_basename) |
---|
184 | |
---|
185 | # The pathname for the urs order points, used within build_urs_boundary.py |
---|
186 | if urs_order_filename: |
---|
187 | urs_order = join(boundaries_folder, urs_order_filename) |
---|
188 | |
---|
189 | # The absolute pathname for the landward points of the bounding polygon, |
---|
190 | # Used within run_model.py) |
---|
191 | if landward_boundary_filename: |
---|
192 | landward_boundary = join(boundaries_folder, landward_boundary_filename) |
---|
193 | |
---|
194 | # The absolute pathname for the .sts file, generated in build_boundary.py |
---|
195 | event_sts = join(event_folder, scenario_name) |
---|
196 | |
---|
197 | # The absolute pathname for the output folder names |
---|
198 | # Used for build_elevation.py |
---|
199 | output_build = join(output_folder, build_time) + '_' + str(user) |
---|
200 | # Used for run_model.py |
---|
201 | output_run = join(output_folder, run_time) + output_comment |
---|
202 | # Used by post processing |
---|
203 | output_run_time = join(output_run, scenario_name) |
---|
204 | |
---|
205 | # The absolute pathname of the mesh, generated in run_model.py |
---|
206 | meshes = join(output_run, scenario_name) + '.msh' |
---|
207 | |
---|
208 | # The absolute pathname for the gauges file |
---|
209 | # Used for get_timeseries.py |
---|
210 | if gauges_filename: |
---|
211 | gauges = join(gauges_folder, gauges_filename) |
---|
212 | |
---|
213 | #Multiple polygons in one CSV file to make internal polygons |
---|
214 | PriorityAreas = join(polygons_folder, PriorityArea_filename) |
---|
215 | |
---|
216 | |
---|