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

Last change on this file since 5825 was 5825, checked in by kristy, 16 years ago
File size: 10.9 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 = 'perth'
41scenario = 'perth_tsunami_scenario'
42
43# Model specific parameters. One or all can be changed each time the
44# run_scenario script is executed
45tide = 0.6                #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_perth.py
85# onshore data: format ascii grid with accompanying projection file
86onshore_name = 'perth_dli_ext' 
87# island: format ascii grid with accompanying projection file
88island_name = 'rott_dli_ext' 
89island_name1 = 'gard_dli_ext'
90island_name2 = 'carnac_island_dli_ext'
91island_name3 = 'penguin_dli_ext'
92# coastline: format x,y,elevation (with title)
93coast_name = 'coastline_perthP.txt'
94# bathymetry: format x,y,elevation (with title)
95offshore_name = 'Perth.txt'
96offshore_name1 = 'Perth_Chart.txt'
97offshore_name2 = 'Fremantle_north.txt'
98offshore_name3 = 'port_swanriver.txt'
99
100# gauges - used in get_timeseries.py
101gauge_name = 'perth.csv'
102gauge_name2 = 'thinned_MGA50.csv'
103
104# BOUNDING POLYGON - used in build_boundary.py and run_perth.py respectively
105# NOTE: when files are put together the points must be in sequence - for ease go clockwise!
106# Check the run_perth.py for boundary_tags
107# thinned ordering file from Hazard Map: format is index,latitude,longitude (with title)
108order_filename = 'thinned_boundary_ordering.csv'
109#landward bounding points
110landward = 'landward_bounding_polygon.csv'
111
112#------------------------------------------------------------------------------
113# Output Elevation Data
114#------------------------------------------------------------------------------
115# Output filename for elevation
116# this is a combination of all the data (utilisied in build_boundary)
117combined_name ='perth_combined_elevation'
118combined_smaller_name = 'perth_combined_elevation_smaller'
119
120#------------------------------------------------------------------------------
121# Directory Structure
122#------------------------------------------------------------------------------
123anuga_dir = home+state+sep+scenario+sep+'anuga'+sep
124topographies_in_dir = home+state+sep+scenario+sep+'elevation_final'+sep+'points'+sep
125topographies_dir = anuga_dir+'topographies'+sep
126polygons_dir = anuga_dir+'polygons'+sep
127tide_dir = anuga_dir+'tide_data'+sep
128boundaries_dir = anuga_dir+'boundaries'+ sep
129output_dir = anuga_dir+'outputs'+sep
130gauges_dir = anuga_dir+'gauges'+sep
131meshes_dir = anuga_dir+'meshes'+sep
132
133#------------------------------------------------------------------------------
134# Location of input and output data
135#------------------------------------------------------------------------------
136# where the input data sits
137onshore_in_dir_name = topographies_in_dir + onshore_name
138island_in_dir_name = topographies_in_dir + island_name
139island_in_dir_name1 = topographies_in_dir + island_name1
140island_in_dir_name2 = topographies_in_dir + island_name2
141island_in_dir_name3 = topographies_in_dir + island_name3
142coast_in_dir_name = topographies_in_dir + coast_name
143offshore_in_dir_name = topographies_in_dir + offshore_name
144offshore_in_dir_name1 = topographies_in_dir + offshore_name1
145offshore_in_dir_name2 = topographies_in_dir + offshore_name2
146offshore_in_dir_name3 = topographies_in_dir + offshore_name3
147
148# where the output data sits
149onshore_dir_name = topographies_dir + onshore_name
150island_dir_name = topographies_dir + island_name
151island_dir_name1 = topographies_dir + island_name1
152island_dir_name2 = topographies_dir + island_name2
153island_dir_name3 = topographies_dir + island_name3
154coast_dir_name = topographies_dir + coast_name
155offshore_dir_name = topographies_dir + offshore_name
156offshore_dir_name1 = topographies_dir + offshore_name1
157offshore_dir_name2 = topographies_dir + offshore_name2
158offshore_dir_name3 = topographies_dir + offshore_name3
159
160# where the combined elevation file sits
161combined_dir_name = topographies_dir + combined_name
162combined_smaller_name_dir = topographies_dir + combined_smaller_name
163
164# where the mesh sits (this is created during the run_perth.py)
165meshes_dir_name = meshes_dir + scenario_name+'.msh'
166
167# where the boundary ordering files sit (this is used within build_boundary.py)
168order_filename_dir = boundaries_dir + order_filename
169
170# where the landward points of boundary extent sit (this is used within run_perth.py)
171landward_dir = boundaries_dir + landward
172
173# where the event sts files sits (this is created during the build_boundary.py)
174boundaries_dir_event = boundaries_dir + str(event_number) + sep
175boundaries_dir_mux = muxhome
176
177# where the directory of the output filename sits
178output_build_time_dir = output_dir+build_time+dir_comment+sep   #used for build_perth.py
179output_run_time_dir = output_dir+run_time+dir_comment+sep       #used for run_perth.py
180output_run_time_dir_name = output_run_time_dir + scenario_name  #Used by post processing
181
182#w here the directory of the gauges sit
183gauges_dir_name = gauges_dir + gauge_name       #used for get_timeseries.py
184gauges_dir_name2 = gauges_dir + gauge_name2     #used for get_timeseries.py
185
186#------------------------------------------------------------------------------
187# Interior region definitions
188#------------------------------------------------------------------------------
189
190#Land, to set the initial stage/water to be offcoast only
191poly_mainland = read_polygon(polygons_dir+'initial_condition.csv')
192
193# Initial bounding polygon for data clipping
194poly_all = read_polygon(polygons_dir+'poly_all.csv')
195res_poly_all = 100000*res_factor
196
197# Area of Interest 1 (Fremantle)
198poly_aoi1 = read_polygon(polygons_dir+'CBD_coastal.csv')
199res_aoi1 = 500*res_factor
200
201# Area of Interest 2 (Rockingham)
202poly_aoi2 = read_polygon(polygons_dir+'rockingham_penguin.csv')
203res_aoi2 = 500*res_factor
204
205# Area of Interest 2 (garden Island)
206poly_aoi2a = read_polygon(polygons_dir+'garden.csv')
207res_aoi2a= 500*res_factor
208
209# Area of Interest 3 (geordie bay - record of tsunami impact)
210poly_aoi3 = read_polygon(polygons_dir+'geordie_bay.csv')
211res_aoi3 = 500*res_factor
212
213# Area of Interest 4 (sorrento - record of tsunami impact)
214poly_aoi4 = read_polygon(polygons_dir+'sorrento_gauge.csv')
215res_aoi4 = 500*res_factor
216
217# Area of Significance 1 (Garden Island and sand bank infront of Rockingham)
218poly_aos1 = read_polygon(polygons_dir+'garden_rockingham.csv')
219res_aos1 = 1000*res_factor
220
221# Area of Significance 2 (incorporate coastline of rottnest)
222poly_aos2 = read_polygon(polygons_dir+'rottnest_external.csv')
223res_aos2 = 1000*res_factor
224
225# Refined areas
226# Polygon designed to incorporate dredged area from Fremantle to
227# Rockingham as the steep incline was making the elevation go to 0
228poly_aos3 = read_polygon(polygons_dir+'DredgeArea.csv')
229res_aos3 = 1000*res_factor
230
231# Shallow water 1
232poly_sw1 = read_polygon(polygons_dir+'internal_h20mORd3km.csv')
233res_sw1 = 25000*res_factor
234
235# Deep water (land of Rottnest, ANUGA does not do donuts!)
236poly_dw1 = read_polygon(polygons_dir+'rottnest_internal.csv')
237res_dw1 = 100000*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_aoi2a,res_aoi2a],[poly_aoi3,res_aoi3]
242                     ,[poly_aoi4,res_aoi4],[poly_aos1,res_aos1]
243                     ,[poly_aos2,res_aos2],[poly_aos3,res_aos3]
244                     ,[poly_sw1,res_sw1], [poly_dw1,res_dw1]]
245
246   
247trigs_min = number_mesh_triangles(interior_regions, poly_all, 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#Geordie Bay extract ascii grid
256xminGeordie = 358000
257xmaxGeordie = 362000
258yminGeordie = 6458500
259ymaxGeordie = 6461000
260
261#Sorrento extract ascii grid
262xminSorrento = 379000
263xmaxSorrento = 382500
264yminSorrento = 6477000
265ymaxSorrento = 6480000
266
267#Fremantle extract ascii grid
268xminFremantle = 376000
269xmaxFremantle = 388000
270yminFremantle = 6449000
271ymaxFremantle = 6461000
272
273#Rockingham extract ascii grid
274xminRockingham = 373500
275xmaxRockingham = 385500
276yminRockingham = 6424000
277ymaxRockingham = 6433000
278
Note: See TracBrowser for help on using the repository browser.