source: anuga_work/production/perth/project_250m.py @ 5782

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

To run model with the 250m DEM

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