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

Last change on this file since 6256 was 6256, checked in by ole, 10 years ago

Work on busselton for modelling style guide.

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