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 = 'australia_ph2' |
---|
19 | scenario_name = 'eucla_motel' |
---|
20 | scenario_folder = scenario_name |
---|
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 = 0 # difference between MSL and HAT |
---|
29 | zone = 56 # specify zone of model |
---|
30 | event_number = 58362 # 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=1000 # final time for simulation |
---|
35 | |
---|
36 | setup = 'trial' # 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 = [] # 250m grid 2005 |
---|
62 | |
---|
63 | # Format for point is x,y,elevation (with header) |
---|
64 | point_filenames = ['brisbane_250m.txt', |
---|
65 | 'GBR_250m.txt', |
---|
66 | 'Sydney_250m.txt'] # 250m grid 2005 |
---|
67 | |
---|
68 | ### Add csv header list to all files in point_filenames |
---|
69 | ##headerlist = ['x', 'y', 'elevation'] |
---|
70 | ##for f in point_filenames: |
---|
71 | ## add_csv_header(join(topographies_folder, f), headerlist) |
---|
72 | |
---|
73 | # BOUNDING POLYGON - for data clipping and estimate of triangles in mesh |
---|
74 | # Used in build_elevation.py |
---|
75 | # Format for points easting,northing (no header) |
---|
76 | bounding_polygon_filename = 'bounding_polygon.csv' |
---|
77 | bounding_polygon_maxarea = 100000 |
---|
78 | |
---|
79 | # INTERIOR REGIONS - for designing the mesh |
---|
80 | # Used in run_model.py |
---|
81 | # Format for points easting,northing (no header) |
---|
82 | interior_regions_data = [] |
---|
83 | |
---|
84 | # LAND - used to set the initial stage/water to be offcoast only |
---|
85 | # Used in run_model.py. Format for points easting,northing (no header) |
---|
86 | land_initial_conditions_filename = [] |
---|
87 | |
---|
88 | # GAUGES - for creating timeseries at a specific point |
---|
89 | # Used in get_timeseries.py. |
---|
90 | # Format easting,northing,name,elevation (with header) |
---|
91 | gauges_filename = 'gauges.csv' |
---|
92 | |
---|
93 | # BUILDINGS EXPOSURE - for identifying inundated houses |
---|
94 | # Used in run_building_inundation.py |
---|
95 | # Format latitude,longitude etc (geographic) |
---|
96 | building_exposure_filename = 'busselton_res_clip.csv' # from NEXIS |
---|
97 | |
---|
98 | # BOUNDING POLYGON - used in build_boundary.py and run_model.py respectively |
---|
99 | # NOTE: when files are put together the points must be in sequence |
---|
100 | # For ease go clockwise! |
---|
101 | # Check the run_model.py for boundary_tags |
---|
102 | |
---|
103 | # Thinned ordering file from Hazard Map (geographic) |
---|
104 | # Format is index,latitude,longitude (with header) |
---|
105 | urs_order_filename = 'urs_order.csv' |
---|
106 | |
---|
107 | # Landward bounding points |
---|
108 | # Format easting,northing (no header) |
---|
109 | landward_boundary_filename = 'landward_boundary.csv' |
---|
110 | |
---|
111 | # MUX input filename. |
---|
112 | # If a meta-file from EventSelection is used, set 'multi-mux' to True. |
---|
113 | # If a single MUX stem filename (*.grd) is used, set 'multi-mux' to False. |
---|
114 | ##mux_input_filename = event_number # to be found in event_folder |
---|
115 | # (ie boundaries/event_number/) |
---|
116 | ##multi_mux = False |
---|
117 | mux_input_filename = 'event.list' |
---|
118 | multi_mux = True |
---|
119 | |
---|
120 | |
---|
121 | ################################################################################ |
---|
122 | ################################################################################ |
---|
123 | #### NOTE: NOTHING WOULD NORMALLY CHANGE BELOW THIS POINT. #### |
---|
124 | ################################################################################ |
---|
125 | ################################################################################ |
---|
126 | |
---|
127 | # Get system user and host names. |
---|
128 | # These values can be used to distinguish between two similar runs by two |
---|
129 | # different users or runs by the same user on two different machines. |
---|
130 | user = get_user_name() |
---|
131 | host = get_host_name() |
---|
132 | |
---|
133 | # Environment variable names. |
---|
134 | # The inundation directory, not the data directory. |
---|
135 | ENV_INUNDATIONHOME = 'INUNDATIONHOME' |
---|
136 | |
---|
137 | # Path to MUX data |
---|
138 | ENV_MUXHOME = 'MUXHOME' |
---|
139 | |
---|
140 | #------------------------------------------------------------------------------- |
---|
141 | # Output Elevation Data |
---|
142 | #------------------------------------------------------------------------------- |
---|
143 | |
---|
144 | # Output filename for elevation |
---|
145 | # this is a combination of all the data generated in build_elevation.py |
---|
146 | combined_elevation_basename = scenario_name + '_combined_elevation' |
---|
147 | |
---|
148 | #------------------------------------------------------------------------------- |
---|
149 | # Directory Structure |
---|
150 | #------------------------------------------------------------------------------- |
---|
151 | |
---|
152 | # determines time for setting up output directories |
---|
153 | time = strftime('%Y%m%d_%H%M%S', localtime()) |
---|
154 | gtime = strftime('%Y%m%d_%H%M%S', gmtime()) |
---|
155 | build_time = time + '_build' |
---|
156 | run_time = time + '_run_' |
---|
157 | |
---|
158 | # create paths generated from environment variables. |
---|
159 | home = join(os.getenv(ENV_INUNDATIONHOME), 'data') # Absolute path for data folder |
---|
160 | muxhome = os.getenv(ENV_MUXHOME) |
---|
161 | |
---|
162 | # check various directories/files that must exist |
---|
163 | anuga_folder = join(home, state, scenario_folder, 'anuga') |
---|
164 | topographies_folder = join(anuga_folder, 'topographies') |
---|
165 | polygons_folder = join(anuga_folder, 'polygons') |
---|
166 | boundaries_folder = join(anuga_folder, 'boundaries') |
---|
167 | output_folder = join(anuga_folder, 'outputs') |
---|
168 | gauges_folder = join(anuga_folder, 'gauges') |
---|
169 | meshes_folder = join(anuga_folder, 'meshes') |
---|
170 | event_folder = join(boundaries_folder, str(event_number)) |
---|
171 | |
---|
172 | # MUX data files |
---|
173 | # Directory containing the MUX data files to be used with EventSelection. |
---|
174 | mux_data_folder = join(muxhome, 'mux') |
---|
175 | |
---|
176 | #------------------------------------------------------------------------------- |
---|
177 | # Location of input and output data |
---|
178 | #------------------------------------------------------------------------------- |
---|
179 | |
---|
180 | # Convert the user output_comment to a string for run_model.py |
---|
181 | output_comment = ('_'.join([str(x) for x in output_comment if x != user]) |
---|
182 | + '_' + user) |
---|
183 | |
---|
184 | # The absolute pathname of the all elevation, generated in build_elevation.py |
---|
185 | combined_elevation = join(topographies_folder, combined_elevation_basename) |
---|
186 | |
---|
187 | # The absolute pathname of the mesh, generated in run_model.py |
---|
188 | meshes = join(meshes_folder, scenario_name) + '.msh' |
---|
189 | |
---|
190 | # The pathname for the urs order points, used within build_urs_boundary.py |
---|
191 | urs_order = join(boundaries_folder, urs_order_filename) |
---|
192 | |
---|
193 | # The absolute pathname for the landward points of the bounding polygon, |
---|
194 | # Used within run_model.py) |
---|
195 | landward_boundary = join(boundaries_folder, landward_boundary_filename) |
---|
196 | |
---|
197 | # The absolute pathname for the .sts file, generated in build_boundary.py |
---|
198 | event_sts = join(event_folder, scenario_name) |
---|
199 | |
---|
200 | # The absolute pathname for the output folder names |
---|
201 | # Used for build_elevation.py |
---|
202 | output_build = join(output_folder, build_time) + '_' + str(user) |
---|
203 | # Used for run_model.py |
---|
204 | output_run = join(output_folder, run_time) + output_comment |
---|
205 | # Used by post processing |
---|
206 | output_run_time = join(output_run, scenario_name) |
---|
207 | |
---|
208 | # The absolute pathname for the gauges file |
---|
209 | # Used for get_timeseries.py |
---|
210 | gauges = join(gauges_folder, gauges_filename) |
---|
211 | |
---|
212 | # The absolute pathname for the building file |
---|
213 | # Used for run_building_inundation.py |
---|
214 | building_exposure = join(gauges_folder, building_exposure_filename) |
---|
215 | |
---|
216 | # full path to where MUX files (or meta-files) live |
---|
217 | mux_input = join(event_folder, mux_input_filename) |
---|
218 | |
---|