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