source: anuga_work/production/australia_ph2/ceduna/project.py @ 6293

Last change on this file since 6293 was 6293, checked in by myall, 15 years ago
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
8import os
9from os.path import join
10from os import sep, getenv
11from time import localtime, strftime, gmtime
12from anuga.utilities.polygon import read_polygon, number_mesh_triangles
13from anuga.utilities.system_tools import get_user_name, get_host_name
14
15#------------------------------------------------------------------------------
16# Directory setup
17#------------------------------------------------------------------------------
18# Note: INUNDATIONHOME is the inundation directory, not the data directory.
19
20home = getenv('INUNDATIONHOME')+sep+'data'+sep # Absolute path for data folder
21muxhome = getenv('MUXHOME')
22user = get_user_name()
23host = get_host_name()
24
25# determines time for setting up output directories
26time = strftime('%Y%m%d_%H%M%S',localtime()) 
27gtime = strftime('%Y%m%d_%H%M%S',gmtime()) 
28build_time = time+'_build'
29run_time = time+'_run'
30
31# this section needs to be updated to reflect the modelled community.
32# Note, the user needs to set up the directory system accordingly
33state = 'australia_ph2'
34scenario_name = 'ceduna'
35
36#------------------------------------------------------------------------------
37# Initial Conditions
38#------------------------------------------------------------------------------
39# Model specific parameters. One or all can be changed each time the
40# run_scenario script is executed
41tide = 0 
42event_number = 27255 # Java 9.3 worst case for Perth
43alpha = 0.1             # smoothing parameter for mesh
44friction = 0.01           # manning's friction coefficient
45starttime = 0             
46finaltime = 80000         # final time for simulation
47
48setup = 'trial'  # Final can be replaced with trial or basic.
49               # Either will result in a coarser mesh that will allow a
50               # faster, but less accurate, simulation.
51
52if setup =='trial':
53    print'trial'
54    scale_factor=100
55    time_thinning=96
56    yieldstep=240
57if setup =='basic': 
58    print'basic'
59    scale_factor=4
60    time_thinning=12
61    yieldstep=120
62if setup =='final': 
63    print'final'
64    scale_factor=1
65    time_thinning=4
66    yieldstep=60
67
68
69#------------------------------------------------------------------------------
70# Output Filename
71#------------------------------------------------------------------------------
72# Important to distinguish each run - ensure str(user) is included!
73# Note, the user is free to include as many parameters as desired
74output_comment= ('_' + setup + '_' + str(tide)+ '_' + str(event_number) +
75                 '_' + str(user))
76
77#------------------------------------------------------------------------------
78# Input Data
79#------------------------------------------------------------------------------
80# ELEVATION DATA
81# Used in build_elevation.py
82# Format for ascii grids, as produced in ArcGIS + a projection file
83ascii_grid_filenames = ['grid250m'] # 250m grid 2005
84
85# Format for point is x,y,elevation (with header)
86##point_filenames = ['Busselton_Contour0.txt',     # Coastline
87##                   'Busselton_BeachSurvey.txt',    # Beach survey
88##                   'Busselton_NavyFinal.txt',  # Bathymetry
89##                   'Busselton_Chart.txt', # Bathymetry Charts
90##                   'Busselton_Digitised.txt', # Digitised Fairsheet
91##                   'Busselton_250m.txt', # 250m
92##                   'Bunbury_TIN.txt', # Bunbury aoi TIN'd in ArcGIS
93##                   'Busselton_TIN.txt', # Busselton aoi TIN'd in ArcGIS
94##                   'XYAHD_clip.txt'] # To extend boundary
95
96# BOUNDING POLYGON - for data clipping and estimate of triangles in mesh
97# Used in build_elevation.py
98# Format for points easting,northing (no header)
99bounding_polygon_filename = 'bounding_polygon.csv'
100
101# GAUGES - for creating timeseries at a specific point
102# Used in get_timeseries.py
103# Format easting,northing,name,elevation (with header)
104##gauges_filename = 'gauges.csv'
105
106# BOUNDING POLYGON
107# used in build_boundary.py and run_model.py respectively
108# NOTE: when files are put together the points must be in sequence
109# For ease go clockwise!
110# Check the run_model.py for boundary_tags
111
112# Thinned ordering file from Hazard Map (geographic)
113# Format is index,latitude,longitude (with header)
114urs_order_filename = 'urs_order.csv'
115
116# Landward bounding points
117# Format easting,northing (no header)
118landward_boundary_filename = 'landward_boundary.csv'
119
120#------------------------------------------------------------------------------
121# Output Elevation Data
122#------------------------------------------------------------------------------
123# Output filename for elevation
124# this is a combination of all the data generated in build_elevation.py
125combined_elevation_basename = scenario_name + '_combined_elevation'
126
127#------------------------------------------------------------------------------
128# Directory Structure
129#------------------------------------------------------------------------------
130anuga_folder = join(home, state, scenario_name, 'anuga')
131topographies_folder = join(anuga_folder, 'topographies')
132polygons_folder = join(anuga_folder, 'polygons')
133boundaries_folder = join(anuga_folder, 'boundaries')
134output_folder = join(anuga_folder, 'outputs')
135gauges_folder = join(anuga_folder,'gauges')
136meshes_folder = join(anuga_folder, 'meshes')
137
138#------------------------------------------------------------------------------
139# Location of input and output data
140#------------------------------------------------------------------------------
141
142# The absolute pathname of the all elevation, generated in build_elevation.py
143combined_elevation = join(topographies_folder, combined_elevation_basename)
144
145# The absolute pathname of the mesh, generated in run_model.py
146meshes = join(meshes_folder, scenario_name) + '.msh'
147
148# The absolute pathname for the urs order points, used within build_boundary.py
149urs_order = join(boundaries_folder, urs_order_filename)
150
151# The absolute pathname for the landward points of the bounding polygon,
152# Used within run_model.py)
153landward_boundary = join(boundaries_folder, landward_boundary_filename)
154
155# The absolute pathname for the .sts file, generated in build_boundary.py
156event_sts = join(boundaries_folder, str(event_number), scenario_name)
157
158# The absolute pathname for the output folder names
159# Used for build_elevation.py
160output_build = join(output_folder, build_time) + '_' + str(user) 
161# Used for run_model.py
162output_run = join(output_folder, run_time) + output_comment
163# Used by post processing
164output_run_time = join(output_run, scenario_name) 
165
166# The absolute pathname for the gauges file
167# Used for get_timeseries.py
168##gauges = join(gauges_folder, gauges_filename)       
169
170#------------------------------------------------------------------------------
171# Reading polygons and creating interior regions
172#------------------------------------------------------------------------------
173
174# Initial bounding polygon for data clipping
175bounding_polygon = read_polygon(join(polygons_folder,
176                                     bounding_polygon_filename))
177bounding_maxarea = 100000*scale_factor
178
179interior_regions = []
180
181# Estimate the number of triangles                     
182trigs_min = number_mesh_triangles(interior_regions,
183                                  bounding_polygon, bounding_maxarea)
184print 'min estimated number of triangles', trigs_min
185   
186
Note: See TracBrowser for help on using the repository browser.