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 = 'queensland' |
---|
19 | scenario_name = 'gold_coast' |
---|
20 | scenario_folder = 'gold_coast_tsunami_scenario_2009' |
---|
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 | |
---|
29 | # difference between MSL and HAT in metres |
---|
30 | central_meridian = None # Central meridian for projection (optional) |
---|
31 | zone = 56 |
---|
32 | import sys |
---|
33 | if len(sys.argv) > 1: |
---|
34 | event_number = int(sys.argv[1]) |
---|
35 | else: |
---|
36 | event_number = 51469 # the event number or the mux file name |
---|
37 | |
---|
38 | event_number_list = [51469, 50863, 51392] # To piggy back multiple events |
---|
39 | |
---|
40 | tide = 0 |
---|
41 | alpha = 0.1 # smoothing parameter for mesh |
---|
42 | friction=0.01 # manning's friction coefficient |
---|
43 | starttime=0 # start time for simulation |
---|
44 | finaltime=80000 # final time for simulation |
---|
45 | |
---|
46 | setup = 'final' # This can be one of three values |
---|
47 | # trial - coarsest mesh, fast |
---|
48 | # basic - coarse mesh |
---|
49 | # final - fine mesh, slowest |
---|
50 | |
---|
51 | #------------------------------------------------------------------------------- |
---|
52 | # Output filename |
---|
53 | # |
---|
54 | # Your output filename should be unique between different runs on different data. |
---|
55 | # The list of items below will be used to create a file in your output directory. |
---|
56 | # Your user name and time+date will be automatically added. For example, |
---|
57 | # [setup, tide, event_number] |
---|
58 | # will result in a filename like |
---|
59 | # 20090212_091046_run_final_0_27283_rwilson |
---|
60 | #------------------------------------------------------------------------------- |
---|
61 | |
---|
62 | output_comment = [setup, tide, '250m', event_number] |
---|
63 | |
---|
64 | #------------------------------------------------------------------------------- |
---|
65 | # Input Datayieldstep |
---|
66 | #------------------------------------------------------------------------------- |
---|
67 | |
---|
68 | # ELEVATION DATA |
---|
69 | # Used in build_elevation.py |
---|
70 | # Format for ascii grids, as produced in ArcGIS + a projection file |
---|
71 | ascii_grid_filenames = ['grid250m_all_pro'] # 2005 250m grid |
---|
72 | ## ['GC_DTM_30m']] # supplied DEM |
---|
73 | |
---|
74 | # Format for point is x,y,elevation (with header) |
---|
75 | point_filenames = [] |
---|
76 | |
---|
77 | ### Add csv header list to all files in point_filenames |
---|
78 | ##headerlist = ['x', 'y', 'elevation'] |
---|
79 | ##for f in point_filenames: |
---|
80 | ## add_csv_header(join(topographies_folder, f), headerlist) |
---|
81 | |
---|
82 | # BOUNDING POLYGON - for data clipping and estimate of triangles in mesh |
---|
83 | # Used in build_elevation.py |
---|
84 | # Format for points easting,northing (no header) |
---|
85 | bounding_polygon_filename = 'bounding_polygon_sml.csv' |
---|
86 | bounding_polygon_maxarea = 125000 |
---|
87 | |
---|
88 | # INTERIOR REGIONS - for designing the mesh |
---|
89 | # Used in run_model.py |
---|
90 | # Format for points easting,northing (no header) |
---|
91 | interior_regions_data = [] |
---|
92 | |
---|
93 | # LAND - used to set the initial stage/water to be offcoast only |
---|
94 | # Used in run_model.py. Format for points easting,northing (no header) |
---|
95 | land_initial_conditions_filename = [['initial_conditions_sml.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 = 'gauges.csv' |
---|
101 | |
---|
102 | # BUILDINGS EXPOSURE - for identifying inundated houses |
---|
103 | # Used in run_building_inundation.py |
---|
104 | # Format latitude,longitude etc (geographic) |
---|
105 | building_exposure_filename = 'gold_coast_res_clip.csv' # from NEXIS |
---|
106 | |
---|
107 | # AREA OF IMAGES - Extent of each image to find out highest runup |
---|
108 | # Headerr: easting, northing, id, value |
---|
109 | # Used in get_runup.py |
---|
110 | images_filename = 'images.csv' |
---|
111 | |
---|
112 | # BOUNDING POLYGON - used in build_boundary.py and run_model.py respectively |
---|
113 | # NOTE: when files are put together the points must be in sequence |
---|
114 | # For ease go clockwise! |
---|
115 | # Check the run_model.py for boundary_tags |
---|
116 | |
---|
117 | |
---|
118 | # Thinned ordering file from Hazard Map (geographic) |
---|
119 | # Format is index,latitude,longitude (with header) |
---|
120 | urs_order_filename = 'urs_order_sml.csv' |
---|
121 | |
---|
122 | # Landward bounding points |
---|
123 | # Format easting,northing (no header) |
---|
124 | landward_boundary_filename = 'landward_boundary_sml.csv' |
---|
125 | |
---|
126 | # MUX input filename. |
---|
127 | # If a meta-file from EventSelection is used, set 'multi-mux' to True. |
---|
128 | # If a single MUX stem filename (*.grd) is used, set 'multi-mux' to False. |
---|
129 | ##mux_input_filename = event_number # to be found in event_folder |
---|
130 | # (ie boundaries/event_number/) |
---|
131 | ##multi_mux = False |
---|
132 | mux_input_filename = 'event.list' |
---|
133 | multi_mux = True |
---|
134 | |
---|
135 | #------------------------------------------------------------------------------- |
---|
136 | # Clipping regions for export to asc and regions for clipping data |
---|
137 | # Final inundation maps should only be created in regions of the finest mesh |
---|
138 | #------------------------------------------------------------------------------- |
---|
139 | |
---|
140 | # ASCII export grid for Gold Coast |
---|
141 | xminGold_Coast = 541500 |
---|
142 | xmaxGold_Coast = 546000 |
---|
143 | yminGold_Coast = 6893500 |
---|
144 | ymaxGold_Coast = 6898500 |
---|
145 | |
---|
146 | # ASCII export grid for dune study |
---|
147 | xminDune = 536710 |
---|
148 | xmaxDune = 556150 |
---|
149 | yminDune = 6881125 |
---|
150 | ymaxDune = 6926860 |
---|
151 | |
---|
152 | ################################################################################ |
---|
153 | ################################################################################ |
---|
154 | #### NOTE: NOTHING WOULD NORMALLY CHANGE BELOW THIS POINT. #### |
---|
155 | ################################################################################ |
---|
156 | ################################################################################ |
---|
157 | |
---|
158 | # Get system user and host names. |
---|
159 | # These values can be used to distinguish between two similar runs by two |
---|
160 | # different users or runs by the same user on two different machines. |
---|
161 | user = get_user_name() |
---|
162 | host = get_host_name() |
---|
163 | |
---|
164 | # Environment variable names. |
---|
165 | # The inundation directory, not the data directory. |
---|
166 | ENV_INUNDATIONHOME = 'ANUGADATA' |
---|
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_250m' |
---|
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 | |
---|
189 | # check various directories/files that must exist |
---|
190 | anuga_folder = join(home, state, scenario_folder, 'anuga') |
---|
191 | topographies_folder = join(anuga_folder, 'topographies') |
---|
192 | polygons_folder = join(anuga_folder, 'polygons') |
---|
193 | boundaries_folder = join(anuga_folder, 'boundaries') |
---|
194 | output_folder = join(anuga_folder, 'outputs') |
---|
195 | gauges_folder = join(anuga_folder, 'gauges') |
---|
196 | event_folder = join(boundaries_folder, str(event_number)) |
---|
197 | |
---|
198 | #------------------------------------------------------------------------------- |
---|
199 | # Location of input and output data |
---|
200 | #------------------------------------------------------------------------------- |
---|
201 | |
---|
202 | # Convert the user output_comment to a string for run_model.py |
---|
203 | output_comment = ('_'.join([str(x) for x in output_comment if x != user]) |
---|
204 | + '_' + user) |
---|
205 | |
---|
206 | # The absolute pathname of the all elevation, generated in build_elevation.py |
---|
207 | combined_elevation = join(topographies_folder, combined_elevation_basename) |
---|
208 | |
---|
209 | |
---|
210 | # The pathname for the urs order points, used within build_urs_boundary.py |
---|
211 | if urs_order_filename: |
---|
212 | urs_order = join(boundaries_folder, urs_order_filename) |
---|
213 | |
---|
214 | # The absolute pathname for the landward points of the bounding polygon, |
---|
215 | # Used within run_model.py) |
---|
216 | if landward_boundary_filename: |
---|
217 | landward_boundary = join(boundaries_folder, landward_boundary_filename) |
---|
218 | |
---|
219 | # The absolute pathname for the .sts file, generated in build_boundary.py |
---|
220 | event_sts = join(event_folder, scenario_name) |
---|
221 | |
---|
222 | # The absolute pathname for the output folder names |
---|
223 | # Used for build_elevation.py |
---|
224 | output_build = join(output_folder, build_time) + '_' + str(user) |
---|
225 | # Used for run_model.py |
---|
226 | output_run = join(output_folder, run_time) + output_comment |
---|
227 | # Used by post processing |
---|
228 | output_run_time = join(output_run, scenario_name) |
---|
229 | |
---|
230 | # The absolute pathname of the mesh, generated in run_model.py |
---|
231 | meshes = join(output_run, scenario_name) + '.msh' |
---|
232 | |
---|
233 | # The absolute pathname for the gauges file |
---|
234 | # Used for get_timeseries.py |
---|
235 | if gauges_filename: |
---|
236 | gauges = join(gauges_folder, gauges_filename) |
---|
237 | |
---|
238 | # The absolute pathname for the building file |
---|
239 | # Used for run_building_inundation.py |
---|
240 | if building_exposure_filename: |
---|
241 | building_exposure = join(gauges_folder, building_exposure_filename) |
---|
242 | |
---|
243 | # The absolute pathname for the image file |
---|
244 | # Used for get_runup.py |
---|
245 | if images_filename: |
---|
246 | images = join(polygons_folder, images_filename) |
---|
247 | |
---|
248 | # full path to where MUX files (or meta-files) live |
---|
249 | mux_input = join(event_folder, mux_input_filename) |
---|
250 | |
---|