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

Last change on this file since 5829 was 5829, checked in by kristy, 15 years ago

update

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