source: anuga_work/production/carnarvon/project.py @ 5828

Last change on this file since 5828 was 5828, checked in by kristy, 15 years ago
File size: 8.9 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 = 'carnarvon'
41scenario = 'carnarvon_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 # Java 9.3 worst case for Perth
47event_number = 68693 # Sumatra 9.2
48#event_number = 27283  # Java 9.3 original
49alpha = 0.1             # smoothing parameter for mesh
50friction=0.01           # manning's friction coefficient
51starttime=0             
52finaltime=1000         # 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)+'_'+ 'alpha' +str(alpha)+'_'+str(user)
80
81#------------------------------------------------------------------------------
82# Input Data
83#------------------------------------------------------------------------------
84
85# elevation data used in build_carnarvon.py
86# onshore data: format ascii grid with accompanying projection file
87onshore_name = 'dem_onshore' 
88# coastline: format x,y,elevation (with title)
89coast_name = 'coastline.txt'
90# bathymetry: format x,y,elevation (with title)
91offshore_name = 'Shark_Bay_Clip.txt'
92offshore_name1 = 'XYAHD_Clip.txt'
93offshore_name2 = 'DPI_data.txt'
94
95# gauges - used in get_timeseries.py
96gauge_name = 'carnarvon.csv'
97gauge_name2 = 'thinned_MGA50.csv'
98
99# BOUNDING POLYGON - used in build_boundary.py and run_carnarvon.py respectively
100# NOTE: when files are put together the points must be in sequence - for ease go clockwise!
101# Check the run_carnarvon.py for boundary_tags
102# thinned ordering file from Hazard Map: format is index,latitude,longitude (with title)
103order_filename = 'thinned_boundary_ordering.csv'
104#landward bounding points
105landward = 'landward_bounding_polygon.csv'
106
107#------------------------------------------------------------------------------
108# Output Elevation Data
109#------------------------------------------------------------------------------
110# Output filename for elevation
111# this is a combination of all the data (utilisied in build_boundary)
112combined_name ='carnarvon_combined_elevation'
113combined_smaller_name = 'carnarvon_combined_elevation_smaller'
114
115#------------------------------------------------------------------------------
116# Directory Structure
117#------------------------------------------------------------------------------
118anuga_dir = home+state+sep+scenario+sep+'anuga'+sep
119topographies_in_dir = home+state+sep+scenario+sep+'elevation_final'+sep+'points'+sep
120topographies_dir = anuga_dir+'topographies'+sep
121polygons_dir = anuga_dir+'polygons'+sep
122tide_dir = anuga_dir+'tide_data'+sep
123boundaries_dir = anuga_dir+'boundaries'+ sep
124output_dir = anuga_dir+'outputs'+sep
125gauges_dir = anuga_dir+'gauges'+sep
126meshes_dir = anuga_dir+'meshes'+sep
127
128#------------------------------------------------------------------------------
129# Location of input and output data
130#------------------------------------------------------------------------------
131# where the input data sits
132onshore_in_dir_name = topographies_in_dir + onshore_name
133coast_in_dir_name = topographies_in_dir + coast_name
134offshore_in_dir_name = topographies_in_dir + offshore_name
135offshore_in_dir_name1 = topographies_in_dir + offshore_name1
136offshore_in_dir_name2 = topographies_in_dir + offshore_name2
137
138# where the output data sits
139onshore_dir_name = topographies_dir + onshore_name
140coast_dir_name = topographies_dir + coast_name
141offshore_dir_name = topographies_dir + offshore_name
142offshore_dir_name1 = topographies_dir + offshore_name1
143offshore_dir_name2 = topographies_dir + offshore_name2
144
145# where the combined elevation file sits
146combined_dir_name = topographies_dir + combined_name
147combined_smaller_name_dir = topographies_dir + combined_smaller_name
148
149# where the mesh sits (this is created during the run_carnarvon.py)
150meshes_dir_name = meshes_dir + scenario_name+'.msh'
151
152# where the boundary ordering files sit (this is used within build_boundary.py)
153order_filename_dir = boundaries_dir + order_filename
154
155# where the landward points of boundary extent sit (this is used within run_carnarvon.py)
156landward_dir = boundaries_dir + landward
157
158# where the event sts files sits (this is created during the build_boundary.py)
159boundaries_dir_event = boundaries_dir + str(event_number) + sep
160boundaries_dir_mux = muxhome
161
162# where the directory of the output filename sits
163output_build_time_dir = output_dir+build_time+dir_comment+sep   #used for build_carnarvon.py
164output_run_time_dir = output_dir+run_time+dir_comment+sep       #used for run_carnarvon.py
165output_run_time_dir_name = output_run_time_dir + scenario_name  #Used by post processing
166
167#w here the directory of the gauges sit
168gauges_dir_name = gauges_dir + gauge_name       #used for get_timeseries.py
169gauges_dir_name2 = gauges_dir + gauge_name2     #used for get_timeseries.py
170
171#------------------------------------------------------------------------------
172# Interior region definitions
173#------------------------------------------------------------------------------
174
175#Land, to set the initial stage/water to be offcoast only
176#Land and Ocean to clip data
177poly_mainland=read_polygon(polygons_dir +'land_initial_condition.csv')
178poly_island1=read_polygon(polygons_dir +'land_initial_condition_bernier.csv')
179poly_island2=read_polygon(polygons_dir +'land_initial_condition_dorne.csv')
180poly_ocean=read_polygon(polygons_dir +'ocean_initial_condition.csv')
181
182# Initial bounding polygon for data clipping
183poly_all = read_polygon(polygons_dir+'poly_all.csv')
184res_poly_all = 100000*res_factor
185
186# Area of Interest 1 (carnarvon)
187poly_aoi1 = read_polygon(polygons_dir+'Carnarvon5m.csv')
188res_aoi1 = 500*res_factor
189
190# Area of Significance 1 (carnarvon)
191poly_aos1 = read_polygon(polygons_dir+'Carnarvon10m.csv')
192res_aos1 = 1500*res_factor
193
194# Shallow water 1
195poly_sw1 = read_polygon(polygons_dir+'Carnarvon20m.csv')
196res_sw1 = 25000*res_factor
197
198# Shallow water 2
199poly_sw2 = read_polygon(polygons_dir+'Island20m.csv')
200res_sw2 = 50000*res_factor
201
202# Combined all regions, must check that all are included!
203interior_regions = [[poly_aoi1,res_aoi1],[poly_aos1,res_aos1]
204                     ,[poly_sw1,res_sw1],[poly_sw2,res_sw2]]
205
206   
207trigs_min = number_mesh_triangles(interior_regions, poly_all, res_poly_all)
208print 'min estimated number of triangles', trigs_min
209   
210#------------------------------------------------------------------------------
211# Clipping regions for export to asc and regions for clipping data
212# Final inundation maps should only be created in regions of the finest mesh
213#------------------------------------------------------------------------------
214
215# carnarvon CBD extract ascii grid
216##xminCBD =
217##xmaxCBD =
218##yminCBD =
219##ymaxCBD =
Note: See TracBrowser for help on using the repository browser.