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

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

Looped elevation data conversions

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