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

Last change on this file since 5759 was 5759, checked in by kristy, 16 years ago

Cleaned up all of Perth Files

File size: 10.4 KB
Line 
1"""Common filenames and locations for topographic data, meshes and outputs.
2Simplified and Commented by Kristy Van Putten
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##time stuff
28time = strftime('%Y%m%d_%H%M%S',localtime()) #gets time for new dir
29gtime = strftime('%Y%m%d_%H%M%S',gmtime()) #gets time for new dir
30build_time = time+'_build'
31run_time = time+'_run'
32print 'gtime: ', gtime
33
34#------------------------------------------------------------------------------
35# Initial Conditions
36#------------------------------------------------------------------------------
37
38##Changed to reflect the modeled community (also sets up the directory system)
39state = 'western_australia'
40scenario_name = 'perth'
41scenario = 'perth_tsunami_scenario'
42##One or all can be changed each time the run_scenario script is excuted
43tide = 0.6
44event_number = 27255
45#event_number = 27283
46alpha = 0.1
47friction=0.01
48starttime=0
49finaltime=80000 
50
51setup='final'  ## Can replace with trial or basic, this action will thin the mesh
52               ## so that the run script will take less time (hence less acurate)
53
54if setup =='trial':
55    print'trial'
56    res_factor=10
57    time_thinning=48
58    yieldstep=240
59if setup =='basic': 
60    print'basic'
61    res_factor=4
62    time_thinning=12
63    yieldstep=120
64if setup =='final': 
65    print'final'
66    res_factor=1
67    time_thinning=4
68    yieldstep=60
69
70#------------------------------------------------------------------------------
71# Output Filename
72#------------------------------------------------------------------------------
73##Important to distiquish each run
74dir_comment='_'+setup+'_'+str(tide)+'_'+str(event_number)+'_'+ 'alpha' +str(alpha)+'_'+str(user)
75
76#------------------------------------------------------------------------------
77# INPUT DATA
78#------------------------------------------------------------------------------
79
80##ELEVATION DATA## - used in build_perth.py
81## onshore data: format ascii grid with accompaning projection file
82onshore_name = 'perth_dli_ext' 
83## island: format ascii grid with accompaning projection file
84island_name = 'rott_dli_ext' 
85island_name1 = 'gard_dli_ext'
86island_name2 = 'carnac_island_dli_ext'
87island_name3 = 'penguin_dli_ext'
88## coastline: format x,y,elevation (with title)
89coast_name = 'coastline_perthP.txt'
90## bathymetry: format x,y,elevation (with title)
91offshore_name = 'Perth.txt'
92offshore_name1 = 'Perth_Chart.txt'
93offshore_name2 = 'Fremantle_north.txt'
94offshore_name3 = 'port_swanriver.txt'
95
96##GAUGES## - used in get_timeseries.py
97gauge_name = 'perth.csv'
98gauge_name2 = 'thinned_MGA50.csv'
99
100##BOUNDING POLYGON## -used in build_boundary.py and run_perth.py respectively
101#NOTE: when files are put together must be in sequence - for ease go clockwise!
102#Check the run_perth.py for boundary_tags
103##thinned ordering file from Hazard Map: format index,latitude,longitude (with title)
104order_filename = 'thinned_boundary_ordering.txt'
105##landward bounding points
106landward = 'landward_bounding_polygon.txt'
107
108#------------------------------------------------------------------------------
109# OUTPUT ELEVATION DATA
110#------------------------------------------------------------------------------
111##Output filename for elevation
112## its a combination of all the data put together (utilisied in build_boundary)
113combined_name ='perth_combined_elevation'
114combined_smaller_name = 'perth_combined_elevation_smaller'
115
116#------------------------------------------------------------------------------
117# Directory Structure
118#------------------------------------------------------------------------------
119anuga_dir = home+state+sep+scenario+sep+'anuga'+sep
120topographies_in_dir = home+state+sep+scenario+sep+'elevation_final'+sep+'points'+sep
121topographies_dir = anuga_dir+'topographies'+sep
122polygons_dir = anuga_dir+'polygons'+sep
123tide_dir = anuga_dir+'tide_data'+sep
124boundaries_dir = anuga_dir+'boundaries'+ sep
125output_dir = anuga_dir+'outputs'+sep
126gauges_dir = anuga_dir+'gauges'+sep
127meshes_dir = anuga_dir+'meshes'+sep
128
129#------------------------------------------------------------------------------
130# Location of input and output Data
131#------------------------------------------------------------------------------
132##where the input data sits
133onshore_in_dir_name = topographies_in_dir + onshore_name
134island_in_dir_name = topographies_in_dir + island_name
135island_in_dir_name1 = topographies_in_dir + island_name1
136island_in_dir_name2 = topographies_in_dir + island_name2
137island_in_dir_name3 = topographies_in_dir + island_name3
138coast_in_dir_name = topographies_in_dir + coast_name
139offshore_in_dir_name = topographies_in_dir + offshore_name
140offshore_in_dir_name1 = topographies_in_dir + offshore_name1
141offshore_in_dir_name2 = topographies_in_dir + offshore_name2
142offshore_in_dir_name3 = topographies_in_dir + offshore_name3
143
144##where the output data sits
145onshore_dir_name = topographies_dir + onshore_name
146island_dir_name = topographies_dir + island_name
147island_dir_name1 = topographies_dir + island_name1
148island_dir_name2 = topographies_dir + island_name2
149island_dir_name3 = topographies_dir + island_name3
150coast_dir_name = topographies_dir + coast_name
151offshore_dir_name = topographies_dir + offshore_name
152offshore_dir_name1 = topographies_dir + offshore_name1
153offshore_dir_name2 = topographies_dir + offshore_name2
154offshore_dir_name3 = topographies_dir + offshore_name3
155
156##where the combined file sits
157combined_dir_name = topographies_dir + combined_name
158combined_smaller_name_dir = topographies_dir + combined_smaller_name
159
160##where the mesh sits (this is created during the run_perth.py)
161meshes_dir_name = meshes_dir + scenario_name+'.msh'
162
163#where the boundary order files sit (this is used within build_boundary.py)
164order_filename_dir = boundaries_dir + order_filename
165
166#where the landward points of boundary extent sit (this is used within run_perth.py)
167landward_dir = boundaries_dir + landward
168
169#where the event sts files sits (this is created during the build_boundary.py)
170boundaries_dir_event = boundaries_dir + str(event_number) + sep
171boundaries_dir_mux = muxhome
172
173#where the directory of the output filename sits
174output_build_time_dir = output_dir+build_time+dir_comment+sep #used for build_perth.py
175output_run_time_dir = output_dir+run_time+dir_comment+sep #used for run_perth.py
176output_run_time_dir_name = output_run_time_dir + scenario_name  #Used by post processing
177
178#where the directory of the gauges sit
179gauges_dir_name = gauges_dir + gauge_name #used for get_timeseries.py
180gauges_dir_name2 = gauges_dir + gauge_name2 #used for get_timeseries.py
181
182#------------------------------------------------------------------------------
183# Interior region definitions
184#------------------------------------------------------------------------------
185
186#Land, to set the stage/water to be offcoast only
187poly_mainland = read_polygon(polygons_dir+'initial_condition.csv')
188
189#Initial bounding polygon for data clipping
190poly_all = read_polygon(polygons_dir+'poly_all.csv')
191res_poly_all = 100000*res_factor
192
193#Area of Interest 1 (Fremantle)
194poly_aoi1 = read_polygon(polygons_dir+'CBD_coastal.csv')
195res_aoi1 = 500*res_factor
196
197#Area of Interest 2 (Rockingham)
198poly_aoi2 = read_polygon(polygons_dir+'rockingham_penguin.csv')
199res_aoi2 = 500*res_factor
200
201#Area of Interest 2 (garden Island)
202poly_aoi2a = read_polygon(polygons_dir+'garden.csv')
203res_aoi2a= 500*res_factor
204
205#Area of Interest 3 (geordie bay - record of tsunami impact)
206poly_aoi3 = read_polygon(polygons_dir+'geordie_bay.csv')
207res_aoi3 = 500*res_factor
208
209#Area of Interest 4 (sorrento - record of tsunami impact)
210poly_aoi4 = read_polygon(polygons_dir+'sorrento_gauge.csv')
211res_aoi4 = 500*res_factor
212
213#Area of Significance 1 (Garden Island and sand bank infront of Rockingham)
214poly_aos1 = read_polygon(polygons_dir+'garden_rockingham.csv')
215res_aos1 = 1000*res_factor
216
217#Area of Significance 2 (incorporate coastline of rottnest)
218poly_aos2 = read_polygon(polygons_dir+'rottnest_external.csv')
219res_aos2 = 1000*res_factor
220
221#Refined areas
222#Polygon designed to incorporate Dredge Area from Fremantle to
223#Rockingham the steep incline was making the mesh go to 0
224poly_aos3 = read_polygon(polygons_dir+'DredgeArea.csv')
225res_aos3 = 1000*res_factor
226
227#Shallow water 1
228poly_sw1 = read_polygon(polygons_dir+'internal_h20mORd3km.csv')
229res_sw1 = 25000*res_factor
230
231#Deep water (land of Rottnest, ANUGA does not do donuts!)
232poly_dw1 = read_polygon(polygons_dir+'rottnest_internal.csv')
233res_dw1 = 100000*res_factor
234
235# Combined all regions, must check that all are included!
236interior_regions = [[poly_aoi1,res_aoi1],[poly_aoi2,res_aoi2]
237                     ,[poly_aoi2a,res_aoi2a],[poly_aoi3,res_aoi3]
238                     ,[poly_aoi4,res_aoi4],[poly_aos1,res_aos1]
239                     ,[poly_aos2,res_aos2],[poly_aos3,res_aos3]
240                     ,[poly_sw1,res_sw1], [poly_dw1,res_dw1]]
241
242   
243trigs_min = number_mesh_triangles(interior_regions, poly_all, res_poly_all)
244print 'min estimated number of triangles', trigs_min
245   
246
247#------------------------------------------------------------------------------
248# Clipping regions for export to asc and regions for clipping data
249#------------------------------------------------------------------------------
250
251#Geordie Bay extract ascii grid
252xminGeordie = 358000
253xmaxGeordie = 362000
254yminGeordie = 6458500
255ymaxGeordie = 6461000
256
257#Sorrento extract ascii grid
258xminSorrento = 379000
259xmaxSorrento = 382500
260yminSorrento = 6477000
261ymaxSorrento = 6480000
262
263#Fremantle extract ascii grid
264xminFremantle = 376000
265xmaxFremantle = 388000
266yminFremantle = 6449000
267ymaxFremantle = 6461000
268
269#Rockingham extract ascii grid
270xminRockingham = 373500
271xmaxRockingham = 385500
272yminRockingham = 6424000
273ymaxRockingham = 6433000
274
Note: See TracBrowser for help on using the repository browser.