source: anuga_work/production/geraldton/project.py @ 5789

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

Updated all scripts to coincide with Perth format

File size: 9.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 = 'geraldton'
41scenario = 'geraldton_tsunami_scenario'
42
43# Model specific parameters. One or all can be changed each time the
44# run_scenario script is executed
45tide = 0                #0.6
46#event_number = 27255   # linked to hazard map
47event_number = 27283
48alpha = 0.1             # smoothing parameter for mesh
49friction=0.01           # manning's friction coefficient
50starttime=0             
51finaltime=80000         # final time for simulation
52
53setup='final'  # Final can be replaced with trial or basic.
54               # Either will result in a coarser mesh that will allow a
55               # faster, but less accurate, simulation.
56
57if setup =='trial':
58    print'trial'
59    res_factor=10
60    time_thinning=48
61    yieldstep=240
62if setup =='basic': 
63    print'basic'
64    res_factor=4
65    time_thinning=12
66    yieldstep=120
67if setup =='final': 
68    print'final'
69    res_factor=1
70    time_thinning=4
71    yieldstep=60
72
73#------------------------------------------------------------------------------
74# Output Filename
75#------------------------------------------------------------------------------
76# Important to distinguish each run - ensure str(user) is included!
77# Note, the user is free to include as many parameters as desired
78dir_comment='_'+setup+'_'+str(tide)+'_'+str(event_number)+'_'+ 'alpha' +str(alpha)+'_'+str(user)
79
80#------------------------------------------------------------------------------
81# Input Data
82#------------------------------------------------------------------------------
83
84# elevation data used in build_geraldton.py
85# onshore data: format ascii grid with accompanying projection file
86onshore_name = 'landgate_dem_clip' 
87# island: format ascii grid with accompanying projection file
88island_name = 'dted_srtm_islands' 
89# coastline: format x,y,elevation (with title)
90coast_name = 'XYcoastline_KVP.txt'
91# bathymetry: format x,y,elevation (with title)
92offshore_name = 'Geraldton_bathymetry.txt'
93offshore_name1 = 'DPI_Data.txt'
94offshore_name2 = 'grid250.txt'
95offshore_name3 = 'Top_bathymetry.txt'
96
97# gauges - used in get_timeseries.py
98gauge_name = 'geraldton.csv'
99gauge_name2 = 'thinned_MGA50.csv'
100
101# BOUNDING POLYGON - used in build_boundary.py and run_geraldton.py respectively
102# NOTE: when files are put together the points must be in sequence - for ease go clockwise!
103# Check the run_geraldton.py for boundary_tags
104# thinned ordering file from Hazard Map: format is index,latitude,longitude (with title)
105order_filename = 'thinned_boundary_ordering.txt'
106#landward bounding points
107landward = 'landward_bounding_polygon.txt'
108
109#------------------------------------------------------------------------------
110# Output Elevation Data
111#------------------------------------------------------------------------------
112# Output filename for elevation
113# this is a combination of all the data (utilisied in build_boundary)
114combined_name ='geraldton_combined_elevation'
115combined_smaller_name = 'geraldton_combined_elevation_smaller'
116
117#------------------------------------------------------------------------------
118# Directory Structure
119#------------------------------------------------------------------------------
120anuga_dir = home+state+sep+scenario+sep+'anuga'+sep
121topographies_in_dir = home+state+sep+scenario+sep+'elevation_final'+sep+'points'+sep
122topographies_dir = anuga_dir+'topographies'+sep
123polygons_dir = anuga_dir+'polygons'+sep
124tide_dir = anuga_dir+'tide_data'+sep
125boundaries_dir = anuga_dir+'boundaries'+ sep
126output_dir = anuga_dir+'outputs'+sep
127gauges_dir = anuga_dir+'gauges'+sep
128meshes_dir = anuga_dir+'meshes'+sep
129
130#------------------------------------------------------------------------------
131# Location of input and output data
132#------------------------------------------------------------------------------
133# where the input data sits
134onshore_in_dir_name = topographies_in_dir + onshore_name
135island_in_dir_name = topographies_in_dir + island_name
136coast_in_dir_name = topographies_in_dir + coast_name
137offshore_in_dir_name = topographies_in_dir + offshore_name
138offshore_in_dir_name1 = topographies_in_dir + offshore_name1
139offshore_in_dir_name2 = topographies_in_dir + offshore_name2
140offshore_in_dir_name3 = topographies_in_dir + offshore_name3
141
142# where the output data sits
143onshore_dir_name = topographies_dir + onshore_name
144island_dir_name = topographies_dir + island_name
145coast_dir_name = topographies_dir + coast_name
146offshore_dir_name = topographies_dir + offshore_name
147offshore_dir_name1 = topographies_dir + offshore_name1
148offshore_dir_name2 = topographies_dir + offshore_name2
149offshore_dir_name3 = topographies_dir + offshore_name3
150
151# where the combined elevation file sits
152combined_dir_name = topographies_dir + combined_name
153combined_smaller_name_dir = topographies_dir + combined_smaller_name
154
155# where the mesh sits (this is created during the run_geraldton.py)
156meshes_dir_name = meshes_dir + scenario_name+'.msh'
157
158# where the boundary ordering files sit (this is used within build_boundary.py)
159order_filename_dir = boundaries_dir + order_filename
160
161# where the landward points of boundary extent sit (this is used within run_geraldton.py)
162landward_dir = boundaries_dir + landward
163
164# where the event sts files sits (this is created during the build_boundary.py)
165boundaries_dir_event = boundaries_dir + str(event_number) + sep
166boundaries_dir_mux = muxhome
167
168# where the directory of the output filename sits
169output_build_time_dir = output_dir+build_time+dir_comment+sep   #used for build_geraldton.py
170output_run_time_dir = output_dir+run_time+dir_comment+sep       #used for run_geraldton.py
171output_run_time_dir_name = output_run_time_dir + scenario_name  #Used by post processing
172
173#w here the directory of the gauges sit
174gauges_dir_name = gauges_dir + gauge_name       #used for get_timeseries.py
175gauges_dir_name2 = gauges_dir + gauge_name2     #used for get_timeseries.py
176
177#------------------------------------------------------------------------------
178# Interior region definitions
179#------------------------------------------------------------------------------
180
181#Land, to set the initial stage/water to be offcoast only
182#Land and Ocean to clip data
183poly_mainland=read_polygon(polygons_dir +'land_initial_condition.csv')
184poly_ocean=read_polygon(polygons_dir +'ocean_initial_condition.csv')
185
186# Initial bounding polygon for data clipping
187poly_all = read_polygon(polygons_dir+'poly_all.csv')
188res_poly_all = 100000*res_factor
189
190# Area of Interest 1 (Geraldton)
191poly_aoi1 = read_polygon(polygons_dir+'CBD_500m.csv')
192res_aoi1 = 500*res_factor
193
194# Area of Significance 1 (Geraldton)
195poly_aos1 = read_polygon(polygons_dir+'CBD_1km.csv')
196res_aos1 = 800*res_factor
197
198# Area of Significance 2 (island1)
199poly_aos2 = read_polygon(polygons_dir+'island_wallabi_poly.csv')
200res_aos2 = 5000*res_factor
201
202# Area of Significance 3 (island2)
203poly_aos3 = read_polygon(polygons_dir+'island_dingiville_poly.csv')
204res_aos3 = 5000*res_factor
205
206# Area of Significance 4 (island3)
207poly_aos4 = read_polygon(polygons_dir+'island_pelsaert_poly.csv')
208res_aos4 = 5000*res_factor
209
210# Shallow water 1
211poly_sw1 = read_polygon(polygons_dir+'neg20_pos20.csv')
212res_sw1 = 25000*res_factor
213
214# Combined all regions, must check that all are included!
215interior_regions = [[poly_aoi1,res_aoi1],[poly_aos1,res_aos1]
216                     ,[poly_aos2,res_aos2],[poly_aos3,res_aos3]
217                     ,[poly_aos4,res_aos4],[poly_sw1,res_sw1]]
218
219   
220trigs_min = number_mesh_triangles(interior_regions, poly_all, res_poly_all)
221print 'min estimated number of triangles', trigs_min
222   
223#------------------------------------------------------------------------------
224# Clipping regions for export to asc and regions for clipping data
225# Final inundation maps should only be created in regions of the finest mesh
226#------------------------------------------------------------------------------
227
228# Geraldton CBD extract ascii grid
229xminCBD = 262700
230xmaxCBD = 267600
231yminCBD = 6811500
232ymaxCBD = 6816400
Note: See TracBrowser for help on using the repository browser.