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 = 'ceduna' |
---|
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 = 53 # specify zone of model |
---|
30 | event_number = 64469 # the event number or the mux file name |
---|
31 | # ceduna: 7877 (altiplano, south america), 27347 (Java), 46503 (mid america), |
---|
32 | # 57483 (peru), 58331 (Puysegur), 64448 (sandwich), 65304 (shetland), |
---|
33 | # 68792 (sumatra) |
---|
34 | alpha = 0.1 # smoothing parameter for mesh |
---|
35 | friction=0.01 # manning's friction coefficient |
---|
36 | starttime=0 # start time for simulation |
---|
37 | finaltime=1000 # final time for simulation |
---|
38 | |
---|
39 | # index is only used when wave = Tb |
---|
40 | index = 1889 # index from the PTHA |
---|
41 | wave = 'Tb' # Bf (sts wave) Tb (index wave) |
---|
42 | |
---|
43 | setup = 'final' # This can be one of three values |
---|
44 | # trial - coarsest mesh, fast |
---|
45 | # basic - coarse mesh |
---|
46 | # final - fine mesh, slowest |
---|
47 | |
---|
48 | #------------------------------------------------------------------------------- |
---|
49 | # Output filename |
---|
50 | # |
---|
51 | # Your output filename should be unique between different runs on different data. |
---|
52 | # The list of items below will be used to create a file in your output directory. |
---|
53 | # Your user name and time+date will be automatically added. For example, |
---|
54 | # [setup, tide, event_number] |
---|
55 | # will result in a filename like |
---|
56 | # 20090212_091046_run_final_0_27283_rwilson |
---|
57 | #------------------------------------------------------------------------------- |
---|
58 | |
---|
59 | output_comment = [setup, tide, event_number, index, wave] |
---|
60 | |
---|
61 | #------------------------------------------------------------------------------- |
---|
62 | # Input Data |
---|
63 | #------------------------------------------------------------------------------- |
---|
64 | |
---|
65 | # ELEVATION DATA |
---|
66 | # Used in build_elevation.py |
---|
67 | # Format for ascii grids, as produced in ArcGIS + a projection file |
---|
68 | ascii_grid_filenames = [] # 250m grid 2005 |
---|
69 | |
---|
70 | # Format for point is x,y,elevation (with header) |
---|
71 | point_filenames = ['grid250m_pts.txt'] # 250m grid 2005 |
---|
72 | |
---|
73 | ### Add csv header list to all files in point_filenames |
---|
74 | ##headerlist = ['x', 'y', 'elevation'] |
---|
75 | ##for f in point_filenames: |
---|
76 | ## add_csv_header(join(topographies_folder, f), headerlist) |
---|
77 | |
---|
78 | # BOUNDING POLYGON - for data clipping and estimate of triangles in mesh |
---|
79 | # Used in build_elevation.py |
---|
80 | # Format for points easting,northing (no header) |
---|
81 | bounding_polygon_filename = 'bounding_polygon.csv' |
---|
82 | bounding_polygon_maxarea = 100000 |
---|
83 | |
---|
84 | # INTERIOR REGIONS - for designing the mesh |
---|
85 | # Used in run_model.py |
---|
86 | # Format for points easting,northing (no header) |
---|
87 | interior_regions_data = [] |
---|
88 | |
---|
89 | # LAND - used to set the initial stage/water to be offcoast only |
---|
90 | # Used in run_model.py. Format for points easting,northing (no header) |
---|
91 | land_initial_conditions_filename = [] |
---|
92 | |
---|
93 | # GAUGES - for creating timeseries at a specific point |
---|
94 | # Used in get_timeseries.py. |
---|
95 | # Format easting,northing,name,elevation (with header) |
---|
96 | gauges_filename = 'gauges.csv' |
---|
97 | |
---|
98 | # BUILDINGS EXPOSURE - for identifying inundated houses |
---|
99 | # Used in run_building_inundation.py |
---|
100 | # Format latitude,longitude etc (geographic) |
---|
101 | building_exposure_filename = 'busselton_res_clip.csv' # from NEXIS |
---|
102 | |
---|
103 | # BOUNDING POLYGON - used in build_boundary.py and run_model.py respectively |
---|
104 | # NOTE: when files are put together the points must be in sequence |
---|
105 | # For ease go clockwise! |
---|
106 | # Check the run_model.py for boundary_tags |
---|
107 | |
---|
108 | # Thinned ordering file from Hazard Map (geographic) |
---|
109 | # Format is index,latitude,longitude (with header) |
---|
110 | urs_order_filename = 'urs_order.csv' |
---|
111 | |
---|
112 | # Landward bounding points |
---|
113 | # Format easting,northing (no header) |
---|
114 | landward_boundary_filename = 'landward_boundary.csv' |
---|
115 | |
---|
116 | # MUX input filename. |
---|
117 | # If a meta-file from EventSelection is used, set 'multi-mux' to True. |
---|
118 | # If a single MUX stem filename (*.grd) is used, set 'multi-mux' to False. |
---|
119 | ##mux_input_filename = event_number # to be found in event_folder |
---|
120 | # (ie boundaries/event_number/) |
---|
121 | ##multi_mux = False |
---|
122 | mux_input_filename = 'event.list' |
---|
123 | multi_mux = True |
---|
124 | |
---|
125 | |
---|
126 | ################################################################################ |
---|
127 | ################################################################################ |
---|
128 | #### NOTE: NOTHING WOULD NORMALLY CHANGE BELOW THIS POINT. #### |
---|
129 | ################################################################################ |
---|
130 | ################################################################################ |
---|
131 | |
---|
132 | # Get system user and host names. |
---|
133 | # These values can be used to distinguish between two similar runs by two |
---|
134 | # different users or runs by the same user on two different machines. |
---|
135 | user = get_user_name() |
---|
136 | host = get_host_name() |
---|
137 | |
---|
138 | # Environment variable names. |
---|
139 | # The inundation directory, not the data directory. |
---|
140 | ENV_INUNDATIONHOME = 'INUNDATIONHOME' |
---|
141 | |
---|
142 | # Path to MUX data |
---|
143 | ENV_MUXHOME = 'MUXHOME' |
---|
144 | |
---|
145 | #------------------------------------------------------------------------------- |
---|
146 | # Output Elevation Data |
---|
147 | #------------------------------------------------------------------------------- |
---|
148 | |
---|
149 | # Output filename for elevation |
---|
150 | # this is a combination of all the data generated in build_elevation.py |
---|
151 | combined_elevation_basename = scenario_name + '_combined_elevation' |
---|
152 | |
---|
153 | #------------------------------------------------------------------------------- |
---|
154 | # Directory Structure |
---|
155 | #------------------------------------------------------------------------------- |
---|
156 | |
---|
157 | # determines time for setting up output directories |
---|
158 | time = strftime('%Y%m%d_%H%M%S', localtime()) |
---|
159 | gtime = strftime('%Y%m%d_%H%M%S', gmtime()) |
---|
160 | build_time = time + '_build' |
---|
161 | run_time = time + '_run_' |
---|
162 | |
---|
163 | # create paths generated from environment variables. |
---|
164 | home = join(os.getenv(ENV_INUNDATIONHOME), 'data') # Absolute path for data folder |
---|
165 | muxhome = os.getenv(ENV_MUXHOME) |
---|
166 | |
---|
167 | # check various directories/files that must exist |
---|
168 | anuga_folder = join(home, state, scenario_folder, 'anuga') |
---|
169 | topographies_folder = join(anuga_folder, 'topographies') |
---|
170 | polygons_folder = join(anuga_folder, 'polygons') |
---|
171 | boundaries_folder = join(anuga_folder, 'boundaries') |
---|
172 | output_folder = join(anuga_folder, 'outputs') |
---|
173 | gauges_folder = join(anuga_folder, 'gauges') |
---|
174 | meshes_folder = join(anuga_folder, 'meshes') |
---|
175 | event_folder = join(boundaries_folder, str(event_number)) |
---|
176 | |
---|
177 | # MUX data files |
---|
178 | # Directory containing the MUX data files to be used with EventSelection. |
---|
179 | mux_data_folder = join(muxhome, 'mux') |
---|
180 | |
---|
181 | #------------------------------------------------------------------------------- |
---|
182 | # Location of input and output data |
---|
183 | #------------------------------------------------------------------------------- |
---|
184 | |
---|
185 | # Convert the user output_comment to a string for run_model.py |
---|
186 | output_comment = ('_'.join([str(x) for x in output_comment if x != user]) |
---|
187 | + '_' + user) |
---|
188 | |
---|
189 | # The absolute pathname of the all elevation, generated in build_elevation.py |
---|
190 | combined_elevation = join(topographies_folder, combined_elevation_basename) |
---|
191 | |
---|
192 | # The absolute pathname of the mesh, generated in run_model.py |
---|
193 | meshes = join(meshes_folder, scenario_name) + '.msh' |
---|
194 | |
---|
195 | # The pathname for the urs order points, used within build_urs_boundary.py |
---|
196 | urs_order = join(boundaries_folder, urs_order_filename) |
---|
197 | |
---|
198 | # The absolute pathname for the landward points of the bounding polygon, |
---|
199 | # Used within run_model.py) |
---|
200 | landward_boundary = join(boundaries_folder, landward_boundary_filename) |
---|
201 | |
---|
202 | # The absolute pathname for the .sts file, generated in build_boundary.py |
---|
203 | event_sts = join(event_folder, scenario_name) |
---|
204 | |
---|
205 | # The absolute pathname for the output folder names |
---|
206 | # Used for build_elevation.py |
---|
207 | output_build = join(output_folder, build_time) + '_' + str(user) |
---|
208 | # Used for run_model.py |
---|
209 | output_run = join(output_folder, run_time) + output_comment |
---|
210 | # Used by post processing |
---|
211 | output_run_time = join(output_run, scenario_name) |
---|
212 | |
---|
213 | # The absolute pathname for the gauges file |
---|
214 | # Used for get_timeseries.py |
---|
215 | gauges = join(gauges_folder, gauges_filename) |
---|
216 | |
---|
217 | # The absolute pathname for the building file |
---|
218 | # Used for run_building_inundation.py |
---|
219 | building_exposure = join(gauges_folder, building_exposure_filename) |
---|
220 | |
---|
221 | # full path to where MUX files (or meta-files) live |
---|
222 | mux_input = join(event_folder, mux_input_filename) |
---|
223 | |
---|