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 | #------------------------------------------------------------------------------- |
---|
13 | # Directory setup |
---|
14 | #------------------------------------------------------------------------------- |
---|
15 | |
---|
16 | # this section needs to be updated to reflect the modelled community. |
---|
17 | # Note, the user needs to set up the directory system accordingly |
---|
18 | state = 'western_australia' |
---|
19 | scenario_name = 'carnarvon' |
---|
20 | scenario_folder = 'carnarvon_tsunami_scenario' |
---|
21 | |
---|
22 | #------------------------------------------------------------------------------- |
---|
23 | # Initial Conditions |
---|
24 | #------------------------------------------------------------------------------- |
---|
25 | |
---|
26 | # Model specific parameters. |
---|
27 | # One or all can be changed each time the run_model script is executed |
---|
28 | tide = 1 # difference between MSL and HAT in metres |
---|
29 | zone = 49 # specify zone of model |
---|
30 | event_number = 68693 # the event number or the mux file name |
---|
31 | alpha = 0.1 # smoothing parameter for mesh |
---|
32 | friction=0.01 # manning's friction coefficient |
---|
33 | starttime=0 # start time for simulation |
---|
34 | finaltime=80000 # final time for simulation |
---|
35 | |
---|
36 | setup = 'final' # This can be one of three values |
---|
37 | # trial - coarsest mesh, fast |
---|
38 | # basic - coarse mesh |
---|
39 | # final - fine mesh, slowest |
---|
40 | |
---|
41 | #------------------------------------------------------------------------------- |
---|
42 | # Output filename |
---|
43 | # |
---|
44 | # Your output filename should be unique between different runs on different data. |
---|
45 | # The list of items below will be used to create a file in your output directory. |
---|
46 | # Your user name and time+date will be automatically added. For example, |
---|
47 | # [setup, tide, event_number] |
---|
48 | # will result in a filename like |
---|
49 | # 20090212_091046_run_final_0_27283_rwilson |
---|
50 | #------------------------------------------------------------------------------- |
---|
51 | |
---|
52 | output_comment = [setup, tide, event_number] |
---|
53 | |
---|
54 | #------------------------------------------------------------------------------- |
---|
55 | # Input Data |
---|
56 | #------------------------------------------------------------------------------- |
---|
57 | |
---|
58 | # ELEVATION DATA |
---|
59 | # Used in build_elevation.py |
---|
60 | # Format for ascii grids, as produced in ArcGIS + a projection file |
---|
61 | ascii_grid_filenames = ['dem_onshore', # |
---|
62 | 'topo_20m_aoi', |
---|
63 | 'topo_50m_aos'] # |
---|
64 | |
---|
65 | # Format for point is x,y,elevation (with header) |
---|
66 | point_filenames = ['carnarvon_data.txt', # |
---|
67 | 'makeup.txt'] # |
---|
68 | |
---|
69 | extent_polygon_filenames = ['extract_aos.csv', |
---|
70 | 'Carnarvon5m.csv'] |
---|
71 | |
---|
72 | ### Add csv header list to all files in point_filenames |
---|
73 | ##headerlist = ['x', 'y', 'elevation'] |
---|
74 | ##for f in point_filenames: |
---|
75 | ## add_csv_header(join(topographies_folder, f), headerlist) |
---|
76 | |
---|
77 | # BOUNDING POLYGON - for data clipping and estimate of triangles in mesh |
---|
78 | # Used in build_elevation.py |
---|
79 | # Format for points easting,northing (no header) |
---|
80 | bounding_polygon_filename = 'poly_all.csv' |
---|
81 | bounding_polygon_maxarea = 100000 |
---|
82 | |
---|
83 | # INTERIOR REGIONS - for designing the mesh |
---|
84 | # Used in run_model.py |
---|
85 | # Format for points easting,northing (no header) |
---|
86 | interior_regions_data = [['Carnarvon5m.csv', 500], |
---|
87 | ['Carnarvon10m.csv', 1500], |
---|
88 | ['Carnarvon20m.csv', 25000], |
---|
89 | ['Island20m.csv', 50000]] |
---|
90 | |
---|
91 | # LAND - used to set the initial stage/water to be offcoast only |
---|
92 | # Used in run_model.py. Format for points easting,northing (no header) |
---|
93 | land_initial_conditions_filename = [['land_initial_condition.csv', 0], |
---|
94 | ['land_initial_condition_bernier.csv', 0], |
---|
95 | ['land_initial_condition_dorne.csv', 0]] |
---|
96 | |
---|
97 | # GAUGES - for creating timeseries at a specific point |
---|
98 | # Used in get_timeseries.py. |
---|
99 | # Format easting,northing,name,elevation (with header) |
---|
100 | gauges_filename = 'MH_gauges_deep.csv' #'carnarvon.csv' |
---|
101 | gauges_filename2 = 'thinned_MGA50.csv' |
---|
102 | |
---|
103 | |
---|
104 | # BUILDINGS EXPOSURE - for identifying inundated houses |
---|
105 | # Used in run_building_inundation.py |
---|
106 | # Format latitude,longitude etc (geographic) |
---|
107 | building_exposure_filename = 'carnarvon_res.csv' # from NEXIS |
---|
108 | |
---|
109 | # BOUNDING POLYGON - used in build_boundary.py and run_model.py respectively |
---|
110 | # NOTE: when files are put together the points must be in sequence |
---|
111 | # For ease go clockwise! |
---|
112 | # Check the run_model.py for boundary_tags |
---|
113 | |
---|
114 | # Thinned ordering file from Hazard Map (geographic) |
---|
115 | # Format is index,latitude,longitude (with header) |
---|
116 | urs_order_filename = 'thinned_boundary_ordering.csv' |
---|
117 | |
---|
118 | # Landward bounding points |
---|
119 | # Format easting,northing (no header) |
---|
120 | landward_boundary_filename = 'landward_bounding_polygon.csv' |
---|
121 | |
---|
122 | # MUX input filename. |
---|
123 | # If a meta-file from EventSelection is used, set 'multi-mux' to True. |
---|
124 | # If a single MUX stem filename (*.grd) is used, set 'multi-mux' to False. |
---|
125 | ##mux_input_filename = event_number # to be found in event_folder |
---|
126 | # (ie boundaries/event_number/) |
---|
127 | ##multi_mux = False |
---|
128 | mux_input_filename = 'event.list' |
---|
129 | multi_mux = True |
---|
130 | |
---|
131 | #------------------------------------------------------------------------------- |
---|
132 | # Clipping regions for export to asc and regions for clipping data |
---|
133 | # Final inundation maps should only be created in regions of the finest mesh |
---|
134 | #------------------------------------------------------------------------------- |
---|
135 | |
---|
136 | # carnarvon CBD extract ascii grid |
---|
137 | xminCBD = 763000 |
---|
138 | xmaxCBD = 775000 |
---|
139 | yminCBD = 7239000 |
---|
140 | ymaxCBD = 7251000 |
---|
141 | |
---|
142 | ################################################################################ |
---|
143 | ################################################################################ |
---|
144 | #### NOTE: NOTHING WOULD NORMALLY CHANGE BELOW THIS POINT. #### |
---|
145 | ################################################################################ |
---|
146 | ################################################################################ |
---|
147 | |
---|
148 | # Get system user and host names. |
---|
149 | # These values can be used to distinguish between two similar runs by two |
---|
150 | # different users or runs by the same user on two different machines. |
---|
151 | user = get_user_name() |
---|
152 | host = get_host_name() |
---|
153 | |
---|
154 | # Environment variable names. |
---|
155 | # The inundation directory, not the data directory. |
---|
156 | ENV_INUNDATIONHOME = 'INUNDATIONHOME' |
---|
157 | |
---|
158 | # Path to MUX data |
---|
159 | ENV_MUXHOME = 'MUXHOME' |
---|
160 | |
---|
161 | #------------------------------------------------------------------------------- |
---|
162 | # Output Elevation Data |
---|
163 | #------------------------------------------------------------------------------- |
---|
164 | |
---|
165 | # Output filename for elevation |
---|
166 | # this is a combination of all the data generated in build_elevation.py |
---|
167 | combined_elevation_basename = scenario_name + '_combined_elevation' |
---|
168 | |
---|
169 | #------------------------------------------------------------------------------- |
---|
170 | # Directory Structure |
---|
171 | #------------------------------------------------------------------------------- |
---|
172 | |
---|
173 | # determines time for setting up output directories |
---|
174 | time = strftime('%Y%m%d_%H%M%S', localtime()) |
---|
175 | gtime = strftime('%Y%m%d_%H%M%S', gmtime()) |
---|
176 | build_time = time + '_build' |
---|
177 | run_time = time + '_run_' |
---|
178 | |
---|
179 | # create paths generated from environment variables. |
---|
180 | home = join(os.getenv(ENV_INUNDATIONHOME), 'data') # Absolute path for data folder |
---|
181 | muxhome = os.getenv(ENV_MUXHOME) |
---|
182 | |
---|
183 | # check various directories/files that must exist |
---|
184 | anuga_folder = join(home, state, scenario_folder, 'anuga') |
---|
185 | topographies_folder = join(anuga_folder, 'topographies') |
---|
186 | polygons_folder = join(anuga_folder, 'polygons') |
---|
187 | boundaries_folder = join(anuga_folder, 'boundaries') |
---|
188 | output_folder = join(anuga_folder, 'outputs') |
---|
189 | gauges_folder = join(anuga_folder, 'gauges') |
---|
190 | event_folder = join(boundaries_folder, str(event_number)) |
---|
191 | |
---|
192 | # MUX data files |
---|
193 | # Directory containing the MUX data files to be used with EventSelection. |
---|
194 | mux_data_folder = join(muxhome, 'mux') |
---|
195 | |
---|
196 | #------------------------------------------------------------------------------- |
---|
197 | # Location of input and output data |
---|
198 | #------------------------------------------------------------------------------- |
---|
199 | |
---|
200 | # Convert the user output_comment to a string for run_model.py |
---|
201 | output_comment = ('_'.join([str(x) for x in output_comment if x != user]) |
---|
202 | + '_' + user) |
---|
203 | |
---|
204 | # The absolute pathname of the all elevation, generated in build_elevation.py |
---|
205 | combined_elevation = join(topographies_folder, combined_elevation_basename) |
---|
206 | |
---|
207 | # The pathname for the urs order points, used within build_urs_boundary.py |
---|
208 | if urs_order_filename: |
---|
209 | urs_order = join(boundaries_folder, urs_order_filename) |
---|
210 | |
---|
211 | # The absolute pathname for the landward points of the bounding polygon, |
---|
212 | # Used within run_model.py) |
---|
213 | if landward_boundary_filename: |
---|
214 | landward_boundary = join(boundaries_folder, landward_boundary_filename) |
---|
215 | |
---|
216 | # The absolute pathname for the .sts file, generated in build_boundary.py |
---|
217 | event_sts = join(event_folder, scenario_name) |
---|
218 | |
---|
219 | # The absolute pathname for the output folder names |
---|
220 | # Used for build_elevation.py |
---|
221 | output_build = join(output_folder, build_time) + '_' + str(user) |
---|
222 | # Used for run_model.py |
---|
223 | output_run = join(output_folder, run_time) + output_comment |
---|
224 | # Used by post processing |
---|
225 | output_run_time = join(output_run, scenario_name) |
---|
226 | |
---|
227 | # The absolute pathname of the mesh, generated in run_model.py |
---|
228 | meshes = join(output_run, scenario_name) + '.msh' |
---|
229 | |
---|
230 | # The absolute pathname for the gauges file |
---|
231 | # Used for get_timeseries.py |
---|
232 | if gauges_filename: |
---|
233 | gauges = join(gauges_folder, gauges_filename) |
---|
234 | |
---|
235 | # The absolute pathname for the building file |
---|
236 | # Used for run_building_inundation.py |
---|
237 | if building_exposure_filename: |
---|
238 | building_exposure = join(gauges_folder, building_exposure_filename) |
---|
239 | |
---|
240 | # full path to where MUX files (or meta-files) live |
---|
241 | mux_input = join(event_folder, mux_input_filename) |
---|
242 | |
---|