source: anuga_work/production/perth/project.py @ 5818

Last change on this file since 5818 was 5818, checked in by kristy, 16 years ago
File size: 10.1 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 = 'onslow'
41scenario = 'onslow_tsunami_scenario_2008'
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   # linked to hazard map
47event_number = 27283
48alpha = 0.1             # smoothing parameter for mesh
49friction=0.01           # manning's friction coefficient
50starttime=0             
51finaltime=80000         # final time for simulation
52
53setup='final'  # Final can be replaced with trial or basic.
54               # Either will result in a coarser mesh that will allow a
55               # faster, but less accurate, simulation.
56
57if setup =='trial':
58    print'trial'
59    res_factor=10
60    time_thinning=48
61    yieldstep=240
62if setup =='basic': 
63    print'basic'
64    res_factor=4
65    time_thinning=12
66    yieldstep=120
67if setup =='final': 
68    print'final'
69    res_factor=1
70    time_thinning=4
71    yieldstep=60
72
73#------------------------------------------------------------------------------
74# Output Filename
75#------------------------------------------------------------------------------
76# Important to distinguish each run - ensure str(user) is included!
77# Note, the user is free to include as many parameters as desired
78dir_comment='_'+setup+'_'+str(tide)+'_'+str(event_number)+'_'+ 'alpha' +str(alpha)+'_'+str(user)
79
80#------------------------------------------------------------------------------
81# Input Data
82#------------------------------------------------------------------------------
83
84# elevation data used in build_onslow.py
85# onshore data: format ascii grid with accompanying projection file
86onshore_name = 'revised_onshore_20m_dli' 
87# island: format ascii grid with accompanying projection file
88island_name = 'onslow_islands_dted2' 
89# coastline: format x,y,elevation (with title)
90coast_name = 'revised_coastline.txt'
91# bathymetry: format x,y,elevation (with title)
92offshore_name = 'onslow_offshore_points.txt'
93offshore_name1 = 'ONS16FINAL.txt'
94offshore_name2 = 'ONS18FINAL.txt'
95offshore_name3 = 'ONS18FINAL.txt'
96offshore_name4 = 'beach_survey.txt'
97
98# gauges - used in get_timeseries.py
99#gauge_name = 'onslow.csv'
100#gauge_name2 = 'thinned_MGA50.csv'
101
102# BOUNDING POLYGON - used in build_boundary.py and run_onslow.py respectively
103# NOTE: when files are put together the points must be in sequence - for ease go clockwise!
104# Check the run_onslow.py for boundary_tags
105# thinned ordering file from Hazard Map: format is index,latitude,longitude (with title)
106order_filename = 'thinned_boundary_ordering.csv'
107#landward bounding points
108landward = 'landward_bounding_polygon.csv'
109
110#------------------------------------------------------------------------------
111# Output Elevation Data
112#------------------------------------------------------------------------------
113# Output filename for elevation
114# this is a combination of all the data (utilisied in build_boundary)
115combined_name ='onslow_combined_elevation'
116combined_smaller_name = 'onslow_combined_elevation_smaller'
117
118#------------------------------------------------------------------------------
119# Directory Structure
120#------------------------------------------------------------------------------
121anuga_dir = home+state+sep+scenario+sep+'anuga'+sep
122topographies_in_dir = home+state+sep+scenario+sep+'elevation_final'+sep+'points'+sep
123topographies_dir = anuga_dir+'topographies'+sep
124polygons_dir = anuga_dir+'polygons'+sep
125tide_dir = anuga_dir+'tide_data'+sep
126boundaries_dir = anuga_dir+'boundaries'+ sep
127output_dir = anuga_dir+'outputs'+sep
128gauges_dir = anuga_dir+'gauges'+sep
129meshes_dir = anuga_dir+'meshes'+sep
130
131#------------------------------------------------------------------------------
132# Location of input and output data
133#------------------------------------------------------------------------------
134# where the input data sits
135onshore_in_dir_name = topographies_in_dir + onshore_name
136island_in_dir_name = topographies_in_dir + island_name
137coast_in_dir_name = topographies_in_dir + coast_name
138offshore_in_dir_name = topographies_in_dir + offshore_name
139offshore_in_dir_name1 = topographies_in_dir + offshore_name1
140offshore_in_dir_name2 = topographies_in_dir + offshore_name2
141offshore_in_dir_name3 = topographies_in_dir + offshore_name3
142offshore_in_dir_name4 = topographies_in_dir + offshore_name4
143
144# where the output data sits
145onshore_dir_name = topographies_dir + onshore_name
146island_dir_name = topographies_dir + island_name
147coast_dir_name = topographies_dir + coast_name
148offshore_dir_name = topographies_dir + offshore_name
149offshore_dir_name1 = topographies_dir + offshore_name1
150offshore_dir_name2 = topographies_dir + offshore_name2
151offshore_dir_name3 = topographies_dir + offshore_name3
152offshore_dir_name4 = topographies_dir + offshore_name4
153
154# where the combined elevation file sits
155combined_dir_name = topographies_dir + combined_name
156combined_smaller_name_dir = topographies_dir + combined_smaller_name
157
158# where the mesh sits (this is created during the run_onslow.py)
159meshes_dir_name = meshes_dir + scenario_name+'.msh'
160
161# where the boundary ordering files sit (this is used within build_boundary.py)
162order_filename_dir = boundaries_dir + order_filename
163
164# where the landward points of boundary extent sit (this is used within run_onslow.py)
165landward_dir = boundaries_dir + landward
166
167# where the event sts files sits (this is created during the build_boundary.py)
168boundaries_dir_event = boundaries_dir + str(event_number) + sep
169boundaries_dir_mux = muxhome
170
171# where the directory of the output filename sits
172output_build_time_dir = output_dir+build_time+dir_comment+sep   #used for build_onslow.py
173output_run_time_dir = output_dir+run_time+dir_comment+sep       #used for run_onslow.py
174output_run_time_dir_name = output_run_time_dir + scenario_name  #Used by post processing
175
176#w here the directory of the gauges sit
177#gauges_dir_name = gauges_dir + gauge_name       #used for get_timeseries.py
178#gauges_dir_name2 = gauges_dir + gauge_name2     #used for get_timeseries.py
179
180#------------------------------------------------------------------------------
181# Interior region definitions
182#------------------------------------------------------------------------------
183
184<<<<<<< .mine
185#Land North, to set the initial stage/water to be offcoast only
186poly_mainland_N = read_polygon(polygons_dir+'initial_conditions_N.csv')
187=======
188#Land, to set the initial stage/water to be offcoast only
189poly_mainland = read_polygon(polygons_dir+'initial_conditions_mainland.csv')
190>>>>>>> .r5816
191
192<<<<<<< .mine
193#Land South, to set the initial stage/water to be offcoast only
194poly_mainland_S = read_polygon(polygons_dir+'initial_conditions_S.csv')
195
196#Rottnest, to set the initial stage/water to be offcoast only
197poly_island1 = read_polygon(polygons_dir+'initial_conditions_rottnest.csv')
198
199#Garden, to set the initial stage/water to be offcoast only
200poly_island2 = read_polygon(polygons_dir+'initial_conditions_garden.csv')
201
202=======
203#Ocean
204poly_ocean = read_polygon(polygons_dir+'initial_conditions_ocean.csv')
205
206>>>>>>> .r5816
207# Initial bounding polygon for data clipping
208poly_all = read_polygon(polygons_dir+'poly_all.csv')
209res_poly_all = 100000*res_factor
210
211# Area of Interest 1 (Onslow)
212poly_aoi1 = read_polygon(polygons_dir+'aoi.csv')
213res_aoi1 = 500*res_factor
214
215# Area of Significance 1 (Onslow)
216poly_aos1 = read_polygon(polygons_dir+'aos.csv')
217res_aos1 = 1000*res_factor
218
219# Shallow water 1
220poly_sw1 = read_polygon(polygons_dir+'shallow_water.csv')
221res_sw1 = 25000*res_factor
222
223# Combined all regions, must check that all are included!
224interior_regions = [[poly_aoi1,res_aoi1],[poly_aos1,res_aos1]
225                     ,[poly_sw1,res_sw1]]
226
227   
228trigs_min = number_mesh_triangles(interior_regions, poly_all, res_poly_all)
229print 'min estimated number of triangles', trigs_min
230   
231#------------------------------------------------------------------------------
232# Clipping regions for export to asc and regions for clipping data
233# Final inundation maps should only be created in regions of the finest mesh
234#------------------------------------------------------------------------------
235
236###Geordie Bay extract ascii grid
237##xminGeordie = 358000
238##xmaxGeordie = 362000
239##yminGeordie = 6458500
240##ymaxGeordie = 6461000
241##
242###Sorrento extract ascii grid
243##xminSorrento = 379000
244##xmaxSorrento = 382500
245##yminSorrento = 6477000
246##ymaxSorrento = 6480000
247##
248###Fremantle extract ascii grid
249##xminFremantle = 376000
250##xmaxFremantle = 388000
251##yminFremantle = 6449000
252##ymaxFremantle = 6461000
253##
254###Rockingham extract ascii grid
255##xminRockingham = 373500
256##xmaxRockingham = 385500
257##yminRockingham = 6424000
258##ymaxRockingham = 6433000
259
Note: See TracBrowser for help on using the repository browser.