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

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