source: anuga_work/production/dampier_2008/project.py @ 6026

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

Had to run boundary script, have not set up the rest of the pythons scripts yet

File size: 12.2 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
47#event_number = 68693 # Sumatra 9.2
48event_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)+'_'+ 'Rockingham_'+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#buildings - used in run_building_inundation.py
106building = 'perth_res_combined.csv'
107
108
109# BOUNDING POLYGON - used in build_boundary.py and run_perth.py respectively
110# NOTE: when files are put together the points must be in sequence - for ease go clockwise!
111# Check the run_perth.py for boundary_tags
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)
122combined_name ='perth_combined_elevation'
123combined_smaller_name = 'perth_combined_elevation_smaller'
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
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
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
156island_dir_name1 = topographies_dir + island_name1
157island_dir_name2 = topographies_dir + island_name2
158island_dir_name3 = topographies_dir + island_name3
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
169# where the mesh sits (this is created during the run_perth.py)
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
175# where the landward points of boundary extent sit (this is used within run_perth.py)
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
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
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
188gauges_dir_name = gauges_dir + gauge_name       #used for get_timeseries.py
189gauges_dir_name2 = gauges_dir + gauge_name2     #used for get_timeseries.py
190building_in_dir_name = gauges_dir + building    #used for run_building_inundation.py
191
192#------------------------------------------------------------------------------
193# Interior region definitions
194#------------------------------------------------------------------------------
195
196#Land, to set the initial stage/water to be offcoast only
197poly_mainland_N = read_polygon(polygons_dir+'initial_conditions_N.csv')
198
199#Land, to set the initial stage/water to be offcoast only
200poly_mainland_S = read_polygon(polygons_dir+'initial_conditions_S.csv')
201
202#Island, to set the initial stage/water to be offcoast only
203poly_island1 = read_polygon(polygons_dir+'initial_conditions_rottnest.csv')
204
205#Island, to set the initial stage/water to be offcoast only
206poly_island2 = read_polygon(polygons_dir+'initial_conditions_garden.csv')
207
208# Initial bounding polygon for data clipping
209poly_all = read_polygon(polygons_dir+'poly_all.csv')
210res_poly_all = 100000*res_factor
211
212### Area of Interest 1 (Fremantle, increase to reach Perth)
213##poly_aoi1 = read_polygon(polygons_dir+'CBD_increase.csv')
214##res_aoi1 = 500*res_factor
215
216### Area of Interest 1 (Fremantle)
217##poly_aoi1 = read_polygon(polygons_dir+'CBD_coastal.csv')
218##res_aoi1 = 500*res_factor
219##
220# Area of Interest 2 (Rockingham)
221poly_aoi2 = read_polygon(polygons_dir+'rockingham_penguin_increase.csv')
222res_aoi2 = 500*res_factor
223
224### Area of Interest 2 (Rockingham)
225##poly_aoi2 = read_polygon(polygons_dir+'rockingham_penguin.csv')
226##res_aoi2 = 500*res_factor
227##
228### Area of Interest 2 (garden Island)
229##poly_aoi2a = read_polygon(polygons_dir+'garden.csv')
230##res_aoi2a= 500*res_factor
231##
232### Area of Interest 3 (geordie bay - record of tsunami impact)
233##poly_aoi3 = read_polygon(polygons_dir+'geordie_bay.csv')
234##res_aoi3 = 500*res_factor
235##
236### Area of Interest 4 (sorrento - record of tsunami impact)
237##poly_aoi4 = read_polygon(polygons_dir+'sorrento_gauge.csv')
238##res_aoi4 = 500*res_factor
239
240# Area of Significance 1 (Garden Island and sand bank infront of Rockingham)
241poly_aos1 = read_polygon(polygons_dir+'garden_rockingham_increase.csv')
242res_aos1 = 1000*res_factor
243
244# Area of Significance 2 (incorporate coastline of rottnest)
245poly_aos2 = read_polygon(polygons_dir+'rottnest_external.csv')
246res_aos2 = 1000*res_factor
247
248# Refined areas
249# Polygon designed to incorporate dredged area from Fremantle to
250# Rockingham as the steep incline was making the elevation go to 0
251poly_aos3 = read_polygon(polygons_dir+'DredgeArea.csv')
252res_aos3 = 1000*res_factor
253
254# Shallow water 1
255poly_sw1 = read_polygon(polygons_dir+'internal_h20mORd3km.csv')
256res_sw1 = 25000*res_factor
257
258# Deep water (land of Rottnest, ANUGA does not do donuts!)
259poly_dw1 = read_polygon(polygons_dir+'rottnest_internal.csv')
260res_dw1 = 100000*res_factor
261
262# Combined all regions, must check that all are included!
263interior_regions = [[poly_aoi2,res_aoi2], [poly_aos1,res_aos1]
264                     ,[poly_aos2,res_aos2],[poly_aos3,res_aos3]
265                     ,[poly_sw1,res_sw1], [poly_dw1,res_dw1]]
266
267##interior_regions = [[poly_aoi1,res_aoi1],[poly_aoi2,res_aoi2]
268##                     ,[poly_aoi2a,res_aoi2a],[poly_aoi3,res_aoi3]
269##                     ,[poly_aoi4,res_aoi4],[poly_aos1,res_aos1]
270##                     ,[poly_aos2,res_aos2],[poly_aos3,res_aos3]
271##                     ,[poly_sw1,res_sw1], [poly_dw1,res_dw1]]
272
273   
274trigs_min = number_mesh_triangles(interior_regions, poly_all, res_poly_all)
275print 'min estimated number of triangles', trigs_min
276   
277#------------------------------------------------------------------------------
278# Clipping regions for export to asc and regions for clipping data
279# Final inundation maps should only be created in regions of the finest mesh
280#------------------------------------------------------------------------------
281
282#Geordie Bay extract ascii grid
283xminGeordie = 358000
284xmaxGeordie = 362000
285yminGeordie = 6458500
286ymaxGeordie = 6461000
287
288#Sorrento extract ascii grid
289xminSorrento = 379000
290xmaxSorrento = 382500
291yminSorrento = 6477000
292ymaxSorrento = 6480000
293
294#Fremantle extract ascii grid
295xminFremantle = 376000
296xmaxFremantle = 388000
297yminFremantle = 6449000
298ymaxFremantle = 6461000
299
300#Rockingham extract ascii grid
301xminRockingham = 373500
302xmaxRockingham = 385500
303yminRockingham = 6424000
304ymaxRockingham = 6433000
305
306#Fremantle and Perth extract ascii grid
307xminPerth = 376000
308xmaxPerth = 396000
309yminPerth = 6449000
310ymaxPerth = 6467000
311
Note: See TracBrowser for help on using the repository browser.