source: anuga_work/production/busselton/standardised_version/project.py @ 6262

Last change on this file since 6262 was 6262, checked in by ole, 15 years ago

Cleanup before coding style meeting

File size: 10.3 KB
Line 
1"""Common filenames and locations for elevation, meshes and outputs.
2This script is the heart of all scripts in the folder
3"""
4#------------------------------------------------------------------------------
5# Import necessary modules
6#------------------------------------------------------------------------------
7
8import os
9from os import sep, getenv
10from time import localtime, strftime, gmtime
11from anuga.utilities.polygon import read_polygon, number_mesh_triangles
12from anuga.utilities.system_tools import get_user_name, get_host_name
13
14#------------------------------------------------------------------------------
15# Directory setup
16#------------------------------------------------------------------------------
17# Note: INUNDATIONHOME is the inundation directory, not the data directory.
18
19home = getenv('INUNDATIONHOME') + sep +'data'+sep #Sandpit's parent diruser = get_user_name()
20muxhome = getenv('MUXHOME')
21user = get_user_name()
22host = get_host_name()
23
24# determines time for setting up output directories
25time = strftime('%Y%m%d_%H%M%S',localtime()) 
26gtime = strftime('%Y%m%d_%H%M%S',gmtime()) 
27build_time = time+'_build'
28run_time = time+'_run'
29
30#------------------------------------------------------------------------------
31# Initial Conditions
32#------------------------------------------------------------------------------
33
34# this section needs to be updated to reflect the modelled community.
35# Note, the user needs to set up the directory system accordingly
36state = 'western_australia'
37scenario_name = 'busselton'
38scenario = 'busselton_tsunami_scenario'
39
40# Model specific parameters. One or all can be changed each time the
41# run_scenario script is executed
42tide = 0              #0.6
43#event_number = 27255 # Java 9.3 worst case for Perth
44#event_number = 68693 # Sumatra 9.2
45event_number = 27283  # Java 9.3 original
46alpha = 0.1             # smoothing parameter for mesh
47friction=0.01           # manning's friction coefficient
48starttime=0             
49finaltime=80000         # final time for simulation
50
51setup='trial'  # Final can be replaced with trial or basic.
52               # Either will result in a coarser mesh that will allow a
53               # faster, but less accurate, simulation.
54
55if setup =='trial':
56    print'trial'
57    res_factor=100
58    time_thinning=96
59    yieldstep=240
60if setup =='basic': 
61    print'basic'
62    res_factor=4
63    time_thinning=12
64    yieldstep=120
65if setup =='final': 
66    print'final'
67    res_factor=1
68    time_thinning=4
69    yieldstep=60
70
71#------------------------------------------------------------------------------
72# Revision numbers - for comparisons study
73#------------------------------------------------------------------------------
74rev_num = 'newExtent'
75#rev_num = '5449'
76#rev_num = '4695' # 2nd Sept 2007
77#rev_num = '4743' # 3nd Oct 2007
78#rev_num = '4777' # 1st Nov 2007
79#rev_num = '4874' # 3rd Dec 2007
80#rev_num = '4901' # 3rd Jan 2007
81#rev_num = '4990' # 5th Feb 2007
82#rev_num = '5103' # 3rd March 2007
83#rev_num = '5120' # 5th March 2007
84#rev_num = '5140' # 7th March 2007
85#rev_num = '5160' # 11th March 2007
86#rev_num = '5185' # 1st April 2007
87#rev_num = '5273' # 2nd May 2007
88
89
90#------------------------------------------------------------------------------
91# Output Filename
92#------------------------------------------------------------------------------
93# Important to distinguish each run - ensure str(user) is included!
94# Note, the user is free to include as many parameters as desired
95dir_comment='_'+setup+'_'+str(tide)+'_'+str(event_number)+'_'+ 'alpha' +str(alpha)+'_'+str(user)
96
97#------------------------------------------------------------------------------
98# Input Data
99#------------------------------------------------------------------------------
100
101
102# elevation data used in build_busselton.py
103# onshore data: format ascii grid with accompanying projection file
104onshore_name = 'busselton_v2_gda94_mga50' 
105# coastline: format x,y,elevation (with title)
106coast_name = 'Busselton_Contour0.txt'
107coast_name1 = 'Busselton_BeachSurvey.txt'
108# bathymetry: format x,y,elevation (with title)
109offshore_name = 'Busselton_NavyFinal.txt'
110offshore_name1 = 'Busselton_Chart.txt'
111offshore_name2 = 'Busselton_Digitised.txt'
112offshore_name3 = 'Busselton_250m.txt' # for areas that were heading to zero - 2005 Bathymetry grid
113offshore_name4 = 'DPI.txt' # for area within Bunbury 500 mesh less than zero generated from TIN
114offshore_name5 = 'topo_20m_buss_1km' # for area within Busselton 500 mesh less than zero generated from TIN
115
116# gauges - used in get_timeseries.py
117#gauge_name = scenario_name+'.txt'
118gauge_name = 'Gauges.csv'
119# buildings - used in run_building_inundation.py
120building = 'busselton_res_clip'
121
122
123# BOUNDING POLYGON - used in build_boundary.py and run_busselton.py respectively
124# NOTE: when files are put together the points must be in sequence - for ease go clockwise!
125# Check the run_busselton.py for boundary_tags
126# thinned ordering file from Hazard Map: format is index,latitude,longitude (with title)
127order_filename = 'thinned_boundary_ordering.csv'
128#landward bounding points
129landward = 'landward_bounding_polygon.csv'
130
131
132#------------------------------------------------------------------------------
133# Output Elevation Data
134#------------------------------------------------------------------------------
135# Output filename for elevation
136# this is a combination of all the data (utilisied in build_boundary)
137combined_name ='busselton_combined_elevation'
138combined_smaller_name = 'busselton_combined_elevation_smaller'
139
140#------------------------------------------------------------------------------
141# Directory Structure
142#------------------------------------------------------------------------------
143anuga_dir = home+state+sep+scenario+sep+'anuga'+sep
144topographies_in_dir = home+state+sep+scenario+sep+'elevation_final'+sep+'points'+sep
145topographies_dir = anuga_dir+'topographies'+sep
146polygons_dir = anuga_dir+'polygons'+sep
147tide_dir = anuga_dir+'tide_data'+sep
148boundaries_dir = anuga_dir+'boundaries'+ sep
149output_dir = anuga_dir+'outputs'+sep
150gauges_dir = anuga_dir+'gauges'+sep
151meshes_dir = anuga_dir+'meshes'+sep
152
153#------------------------------------------------------------------------------
154# Location of input and output data
155#------------------------------------------------------------------------------
156
157ascii_grid_filenames = [onshore_name,   # Topo
158                        offshore_name5] # Busselton Topo
159
160point_filenames = [coast_name,     # Coastline
161                   coast_name1,    # Beach survey
162                   offshore_name,  # Bathymetry
163                   offshore_name1, # Bathymetry Charts
164                   offshore_name2, # Digitised Fairsheet
165                   offshore_name3, # 250m
166                   offshore_name4] # Bunbury DPI
167
168
169# Where the combined elevation file sits
170combined_dir_name = topographies_dir + combined_name
171combined_smaller_name_dir = topographies_dir + combined_smaller_name
172
173# Where the mesh sits (this is created during the run_busselton.py)
174meshes_dir_name = meshes_dir + scenario_name+'.msh'
175
176# Where the boundary ordering files sit (this is used within build_boundary.py)
177order_filename_dir = boundaries_dir + order_filename
178
179# Where the landward points of boundary extent sit (this is used within run_busselton.py)
180landward_dir = boundaries_dir + landward
181
182# Where the event sts files sits (this is created during the build_boundary.py)
183boundaries_dir_event = boundaries_dir + str(event_number) + sep
184boundaries_dir_mux = muxhome
185urs_boundary_name = os.path.join(boundaries_dir_event,
186                                 scenario_name)
187
188
189# Where the directory of the output filename sits
190output_build_time_dir = output_dir+build_time+dir_comment+sep   #used for build_busselton.py
191output_run_time_dir = output_dir+run_time+dir_comment+sep       #used for run_busselton.py
192output_run_time_dir_name = output_run_time_dir + scenario_name  #Used by post processing
193
194# Where the directory of the gauges sit
195gauges_dir_name = gauges_dir + gauge_name       #used for get_timeseries.py
196building_in_dir_name = gauges_dir + building + '.csv'    #used for run_building_inundation.py
197
198#------------------------------------------------------------------------------
199# Interior region definitions
200#------------------------------------------------------------------------------
201
202# Land, to set the initial stage/water to be offcoast only
203poly_mainland = read_polygon(polygons_dir+'initial_condition.csv')
204
205# Land, to set the initial stage/water to be offcoast only
206poly_marina = read_polygon(polygons_dir+'initial_condition_marina.csv')
207
208# Initial bounding polygon for data clipping
209poly_all = read_polygon(polygons_dir+'poly_all_extend.csv')
210res_poly_all = 100000*res_factor
211
212# Area of Interest 1 (Busselton)
213poly_aoi1 = read_polygon(polygons_dir+'busselton_1km.csv')
214res_aoi1 = 500*res_factor
215
216# Area of Interest 2 (Bunbury)
217poly_aoi2 = read_polygon(polygons_dir+'bunbury_1km.csv')
218res_aoi2 = 500*res_factor
219
220# Area of Significance 1 (Busselton)
221poly_aos1 = read_polygon(polygons_dir+'busselton_2km.csv')
222res_aos1 = 10000*res_factor
223
224# Area of Significance 2 (Bunbury)
225poly_aos2 = read_polygon(polygons_dir+'busselton_2km.csv')
226res_aos2 = 10000*res_factor
227
228# Refined areas
229# Polygon designed to islands
230poly_aos3 = read_polygon(polygons_dir+'island1.csv')
231res_aos3 = 10000*res_factor
232poly_aos4 = read_polygon(polygons_dir+'island2.csv')
233res_aos4 = 10000*res_factor
234
235# Shallow water 1
236poly_sw1 = read_polygon(polygons_dir+'coast_5km_d20m.csv')
237res_sw1 = 40000*res_factor
238
239# Combined all regions, must check that all are included!
240interior_regions = [[poly_aoi1,res_aoi1],[poly_aoi2,res_aoi2],
241                    [poly_aos1,res_aos1],[poly_aos2,res_aos2],
242                    [poly_aos3,res_aos3],[poly_aos4,res_aos4],
243                    [poly_sw1,res_sw1]]
244
245   
246trigs_min = number_mesh_triangles(interior_regions, poly_all,
247                                  res_poly_all)
248print 'min estimated number of triangles', trigs_min
249   
250#------------------------------------------------------------------------------
251# Clipping regions for export to asc and regions for clipping data
252# Final inundation maps should only be created in regions of the finest mesh
253#------------------------------------------------------------------------------
254
255# ASCII export grid for Busselton
256xminBusselton = 340000
257xmaxBusselton = 352000
258yminBusselton = 6271500
259ymaxBusselton = 6280000
260
261# ASCII export grid for Bunbury
262xminBunbury = 369000
263xmaxBunbury = 381000
264yminBunbury = 6308000
265ymaxBunbury = 6316500
266
Note: See TracBrowser for help on using the repository browser.