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 | import csv |
---|
11 | #import run_model_later |
---|
12 | |
---|
13 | |
---|
14 | #------------------------------------------------------------------------------- |
---|
15 | # Directory setup |
---|
16 | #------------------------------------------------------------------------------- |
---|
17 | |
---|
18 | # this section needs to be updated to reflect the modelled community. |
---|
19 | # Note, the user needs to set up the directory system accordingly |
---|
20 | state = 'new_south_wales' |
---|
21 | scenario_name = 'gosford' |
---|
22 | scenario_folder = 'gosford_tsunami_scenario_2009' |
---|
23 | |
---|
24 | #------------------------------------------------------------------------------- |
---|
25 | # Initial Conditions |
---|
26 | #------------------------------------------------------------------------------- |
---|
27 | |
---|
28 | tide = 0.0 |
---|
29 | # difference between MSL and HAT in metres |
---|
30 | zone = 56 # specify zone of model |
---|
31 | #event_number = 58242 # Puysegur 1 in 10 000 # the event number or the mux file name |
---|
32 | #event_number = 51436 # New Hebrides 1 in 10 000 |
---|
33 | #event_number = 58349 # Puysegur 1 in 5000 |
---|
34 | #event_number = 58284 # Puysegur 1 in 2000 |
---|
35 | #event_number = 58187 # Puysegur 1 in 1000 |
---|
36 | #event_number = 58113 # Puysegur 1 in 500 |
---|
37 | event_number = 58025 # Puysegur 1 in 200 |
---|
38 | |
---|
39 | alpha = 0.1 # smoothing parameter for mesh |
---|
40 | friction=0.01 # manning's friction coefficient |
---|
41 | starttime=0 # start time for simulation |
---|
42 | finaltime=60000 # final time for simulation |
---|
43 | |
---|
44 | setup = 'final' # This can be one of three values |
---|
45 | # trial - coarsest mesh, fast |
---|
46 | # basic - coarse mesh |
---|
47 | # final - fine mesh, slowest |
---|
48 | |
---|
49 | #------------------------------------------------------------------------------- |
---|
50 | # Output filename |
---|
51 | # |
---|
52 | # Your output filename should be unique between different runs on different data. |
---|
53 | # The list of items below will be used to create a file in your output directory. |
---|
54 | # Your user name and time+date will be automatically added. For example, |
---|
55 | # [setup, tide, event_number] |
---|
56 | # will result in a filename like |
---|
57 | # 20090212_091046_run_final_0_27283_rwilson |
---|
58 | #------------------------------------------------------------------------------- |
---|
59 | |
---|
60 | output_comment = [setup, tide, event_number] |
---|
61 | |
---|
62 | #------------------------------------------------------------------------------- |
---|
63 | # Input Data |
---|
64 | #------------------------------------------------------------------------------- |
---|
65 | |
---|
66 | # ELEVATION DATA |
---|
67 | # Used in build_elevation.py |
---|
68 | # Format for ascii grids, as produced in ArcGIS + a projection file |
---|
69 | ascii_grid_filenames = [] |
---|
70 | |
---|
71 | # Format for point is x,y,elevation (with header) |
---|
72 | point_filenames = [] |
---|
73 | |
---|
74 | |
---|
75 | # BOUNDING POLYGON - for data clipping and estimate of triangles in mesh |
---|
76 | # Used in build_elevation.py |
---|
77 | # Format for points easting,northing (no header) |
---|
78 | bounding_polygon_filename = 'bounding_polygon.csv' |
---|
79 | bounding_polygon_maxarea = 100000 |
---|
80 | |
---|
81 | # INTERIOR REGIONS - for designing the mesh |
---|
82 | # Used in run_model.py |
---|
83 | # Format for points easting,northing (no header) |
---|
84 | |
---|
85 | interior_regions_data =[['aoi_umina_large.csv', 500], |
---|
86 | ['aoi_terrigal.csv', 500], |
---|
87 | ['aos_umina_large.csv', 2500], |
---|
88 | ['aos_terrigal.csv', 2500]] |
---|
89 | |
---|
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 = [['initial_conditions.csv', 0]] |
---|
94 | |
---|
95 | |
---|
96 | # GAUGES - for creating timeseries at a specific point |
---|
97 | # Used in get_timeseries.py. |
---|
98 | # Format easting,northing,name,elevation (with header) |
---|
99 | gauges_filename = 'gauges.csv' |
---|
100 | |
---|
101 | # BUILDINGS EXPOSURE - for identifying inundated houses |
---|
102 | # Used in run_building_inundation.py |
---|
103 | # Format latitude,longitude etc (geographic) |
---|
104 | ##building_exposure_filename = 'busselton_res_clip.csv' # from NEXIS |
---|
105 | |
---|
106 | # AREA OF IMAGES - Extent of each image to find out highest runup |
---|
107 | # Header - easting,northing,id,value |
---|
108 | # Used in get_runup.py |
---|
109 | images_filename = '' |
---|
110 | |
---|
111 | # BOUNDING POLYGON - used in build_boundary.py and run_model.py respectively |
---|
112 | # NOTE: when files are put together the points must be in sequence |
---|
113 | # For ease go clockwise! |
---|
114 | # Check the run_model.py for boundary_tags |
---|
115 | |
---|
116 | # Thinned ordering file from Hazard Map (geographic) |
---|
117 | # Format is index,latitude,longitude (with header) |
---|
118 | urs_order_filename = 'urs_order.csv' |
---|
119 | |
---|
120 | # Landward bounding points |
---|
121 | # Format easting,northing (no header) |
---|
122 | landward_boundary_filename = 'landward_boundary.csv' |
---|
123 | |
---|
124 | # MUX input filename. |
---|
125 | # If a meta-file from EventSelection is used, set 'multi-mux' to True. |
---|
126 | # If a single MUX stem filename (*.grd) is used, set 'multi-mux' to False. |
---|
127 | ##mux_input_filename = event_number # to be found in event_folder |
---|
128 | # (ie boundaries/event_number/) |
---|
129 | ##multi_mux = False |
---|
130 | mux_input_filename = 'event.list' |
---|
131 | multi_mux = True |
---|
132 | |
---|
133 | zone = 56 |
---|
134 | #------------------------------------------------------------------------------- |
---|
135 | # Clipping regions for export to asc and regions for clipping data |
---|
136 | # Final inundation maps should only be created in regions of the finest mesh |
---|
137 | #------------------------------------------------------------------------------- |
---|
138 | |
---|
139 | # ASCII export grid for Gosford |
---|
140 | ##xminGosford = |
---|
141 | ##xmaxGosford = |
---|
142 | ##yminGosford = |
---|
143 | ##ymaxGosford = |
---|
144 | |
---|
145 | |
---|
146 | ################################################################################ |
---|
147 | ################################################################################ |
---|
148 | #### NOTE: NOTHING WOULD NORMALLY CHANGE BELOW THIS POINT. #### |
---|
149 | ################################################################################ |
---|
150 | ################################################################################ |
---|
151 | |
---|
152 | # Get system user and host names. |
---|
153 | # These values can be used to distinguish between two similar runs by two |
---|
154 | # different users or runs by the same user on two different machines. |
---|
155 | user = get_user_name() |
---|
156 | host = get_host_name() |
---|
157 | |
---|
158 | # Environment variable names. |
---|
159 | # The inundation directory, not the data directory. |
---|
160 | ENV_INUNDATIONHOME = 'ANUGADATA' |
---|
161 | |
---|
162 | #------------------------------------------------------------------------------- |
---|
163 | # Output Elevation Data |
---|
164 | #------------------------------------------------------------------------------- |
---|
165 | |
---|
166 | # Output filename for elevation |
---|
167 | # this is a combination of all the data generated in build_elevation.py |
---|
168 | combined_elevation_basename = scenario_name + '_combined_elevation' |
---|
169 | |
---|
170 | #------------------------------------------------------------------------------- |
---|
171 | # Directory Structure |
---|
172 | #------------------------------------------------------------------------------- |
---|
173 | |
---|
174 | # determines time for setting up output directories |
---|
175 | time = strftime('%Y%m%d_%H%M%S', localtime()) |
---|
176 | gtime = strftime('%Y%m%d_%H%M%S', gmtime()) |
---|
177 | build_time = time + '_build' |
---|
178 | run_time = time + '_run_' |
---|
179 | |
---|
180 | # create paths generated from environment variables. |
---|
181 | home = join(os.getenv(ENV_INUNDATIONHOME), 'data') # Absolute path for data folder |
---|
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 | meshes_folder = join(anuga_folder, 'meshes') |
---|
191 | event_folder = join(boundaries_folder, str(event_number)) |
---|
192 | |
---|
193 | #------------------------------------------------------------------------------- |
---|
194 | # Location of input and output data |
---|
195 | #------------------------------------------------------------------------------- |
---|
196 | |
---|
197 | # Convert the user output_comment to a string for run_model.py |
---|
198 | output_comment = ('_'.join([str(x) for x in output_comment if x != user]) |
---|
199 | + '_' + user) |
---|
200 | |
---|
201 | # The absolute pathname of the all elevation, generated in build_elevation.py |
---|
202 | combined_elevation = join(topographies_folder, combined_elevation_basename) |
---|
203 | |
---|
204 | # The absolute pathname of the mesh, generated in run_model.py |
---|
205 | meshes = join(meshes_folder, scenario_name) + '.msh' |
---|
206 | |
---|
207 | # The pathname for the urs order points, used within build_urs_boundary.py |
---|
208 | urs_order = join(boundaries_folder, urs_order_filename) |
---|
209 | |
---|
210 | # The absolute pathname for the landward points of the bounding polygon, |
---|
211 | # Used within run_model.py) |
---|
212 | landward_boundary = join(boundaries_folder, landward_boundary_filename) |
---|
213 | |
---|
214 | # The absolute pathname for the .sts file, generated in build_boundary.py |
---|
215 | event_sts = join(event_folder, scenario_name) |
---|
216 | |
---|
217 | # The absolute pathname for the output folder names |
---|
218 | # Used for build_elevation.py |
---|
219 | output_build = join(output_folder, build_time) + '_' + str(user) |
---|
220 | # Used for run_model.py |
---|
221 | output_run = join(output_folder, run_time) + output_comment |
---|
222 | # Used by post processing |
---|
223 | output_run_time = join(output_run, scenario_name) |
---|
224 | |
---|
225 | # The absolute pathname for the gauges file |
---|
226 | # Used for get_timeseries.py |
---|
227 | gauges = join(gauges_folder, gauges_filename) |
---|
228 | |
---|
229 | # The absolute pathname for the building file |
---|
230 | # Used for run_building_inundation.py |
---|
231 | ##building_exposure = join(gauges_folder, building_exposure_filename) |
---|
232 | |
---|
233 | # The absolute pathname for the image file |
---|
234 | # Used for get_runup.py |
---|
235 | if images_filename: |
---|
236 | images = join(polygons_folder, images_filename) |
---|
237 | |
---|
238 | # full path to where MUX files (or meta-files) live |
---|
239 | mux_input = join(event_folder, mux_input_filename) |
---|
240 | |
---|