source: anuga_work/production/australia_ph2/sydney/old_script/project_250m.py @ 6461

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

New scripts added to make tms file

File size: 7.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 = 'australia_ph2'
40scenario_name = 'sydney'
41scenario = 'sydney'
42
43# Model specific parameters. One or all can be changed each time the
44# run_scenario script is executed
45tide = 0                #0.6
46event_number = 7875   # linked to hazard map
47alpha = 0.1             # smoothing parameter for mesh
48friction=0.01           # manning's friction coefficient
49starttime=0             
50finaltime=80000         # final time for simulation
51
52interior_mesh = 'none' # Can have 'all' or 'none' for Phase 2 study
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)+'_250m_' + str(interior_mesh) +'_'+str(user)
80
81#------------------------------------------------------------------------------
82# Input Data
83#------------------------------------------------------------------------------
84
85# elevation data used in build_sydney.py
86# onshore data: format ascii grid with accompanying projection file
87#onshore_name = 'grid_250m_2005'
88onshore_name = 'sydney_elevation.txt'
89
90# gauges - used in get_timeseries.py
91gauge_name = 'sydney.csv'
92gauge_name2 = 'thinned_MGA50.csv'
93
94# BOUNDING POLYGON - used in build_boundary.py and run_sydney.py respectively
95# NOTE: when files are put together the points must be in sequence - for ease go clockwise!
96# Check the run_sydney.py for boundary_tags
97# thinned ordering file from Hazard Map: format is index,latitude,longitude (with title)
98order_filename = 'thinned_boundary_ordering.csv'
99#landward bounding points
100landward = 'landward_bounding_polygon.csv'
101
102#------------------------------------------------------------------------------
103# Output Elevation Data
104#------------------------------------------------------------------------------
105# Output filename for elevation
106# this is a combination of all the data (utilisied in build_boundary)
107combined_name ='sydney_combined_elevation_250m'
108
109#------------------------------------------------------------------------------
110# Directory Structure
111#------------------------------------------------------------------------------
112anuga_dir = home+state+sep+scenario+sep+'anuga'+sep
113topographies_in_dir = home+state+sep+scenario+sep+'elevation_final'+sep+'points'+sep
114topographies_dir = anuga_dir+'topographies'+sep
115polygons_dir = anuga_dir+'polygons'+sep
116tide_dir = anuga_dir+'tide_data'+sep
117boundaries_dir = anuga_dir+'boundaries'+ sep
118output_dir = anuga_dir+'outputs'+sep
119gauges_dir = anuga_dir+'gauges'+sep
120meshes_dir = anuga_dir+'meshes'+sep
121
122#------------------------------------------------------------------------------
123# Location of input and output data
124#------------------------------------------------------------------------------
125# where the input data sits
126onshore_in_dir_name = topographies_in_dir + onshore_name
127
128# where the output data sits
129onshore_dir_name = topographies_dir + onshore_name
130
131# where the combined elevation file sits
132combined_dir_name = topographies_dir + combined_name
133
134# where the mesh sits (this is created during the run_sydney.py)
135meshes_dir_name = meshes_dir + scenario_name+ interior_mesh +'.msh'
136
137# where the boundary ordering files sit (this is used within build_boundary.py)
138order_filename_dir = boundaries_dir + order_filename
139
140# where the landward points of boundary extent sit (this is used within run_sydney.py)
141landward_dir = boundaries_dir + landward
142
143# where the event sts files sits (this is created during the build_boundary.py)
144boundaries_dir_event = boundaries_dir + str(event_number) + sep
145boundaries_dir_mux = muxhome
146
147# where the directory of the output filename sits
148output_build_time_dir = output_dir+build_time+dir_comment+sep   #used for build_sydney.py
149output_run_time_dir = output_dir+run_time+dir_comment+sep       #used for run_sydney.py
150output_run_time_dir_name = output_run_time_dir + scenario_name  #Used by post processing
151
152#w here the directory of the gauges sit
153gauges_dir_name = gauges_dir + gauge_name       #used for get_timeseries.py
154gauges_dir_name2 = gauges_dir + gauge_name2     #used for get_timeseries.py
155
156#------------------------------------------------------------------------------
157# Interior region definitions
158#------------------------------------------------------------------------------
159
160#Land, to set the initial stage/water to be offcoast only
161poly_mainland = read_polygon(polygons_dir+'initial_conditions_mainland.csv')
162
163#Ocean
164#poly_ocean = read_polygon(polygons_dir+'initial_conditions_ocean.csv')
165
166#islands
167island1 = read_polygon(polygons_dir+'comerong_island.csv')
168
169island2 = read_polygon(polygons_dir+'montague_island.csv')
170
171# Initial bounding polygon for data clipping
172poly_all = read_polygon(polygons_dir+'poly_all.csv')
173res_poly_all = 100000*res_factor
174
175
176# Combined all regions, must check that all are included!
177
178if interior_mesh =='all':
179    print'Mesh = all'
180    interior_regions = [[poly_aoi1,res_aoi1],[poly_aos1,res_aos1]
181                     ,[poly_sw1,res_sw1]]
182
183if interior_mesh =='none': 
184    print'Mesh = none'
185    interior_regions = []
186     
187trigs_min = number_mesh_triangles(interior_regions, poly_all, res_poly_all)
188print 'min estimated number of triangles', trigs_min
189   
Note: See TracBrowser for help on using the repository browser.