source: anuga_work/production/australia_ph2/torres/project.py @ 7122

Last change on this file since 7122 was 7122, checked in by kristy, 15 years ago
File size: 10.3 KB
Line 
1"""
2This file contains all your file and directory definitions
3for elevation, meshes and outputs.
4"""
5
6import os
7from anuga.utilities.system_tools import get_user_name, get_host_name
8from time import localtime, strftime, gmtime
9from os.path import join, exists
10from anuga.lib.add_csv_header.add_csv_header import add_csv_header
11
12#-------------------------------------------------------------------------------
13# Directory setup
14#-------------------------------------------------------------------------------
15
16# this section needs to be updated to reflect the modelled community.
17# Note, the user needs to set up the directory system accordingly
18state = 'australia_ph2'
19scenario_name = 'torres'
20
21#-------------------------------------------------------------------------------
22# Initial Conditions
23#-------------------------------------------------------------------------------
24
25# Model specific parameters.
26# One or all can be changed each time the run_model script is executed
27
28central_meridian = 139.0 # Central meridian for projection (optional)
29zone = None
30##import sys
31##if len(sys.argv) > 1:
32##    event_number = int(sys.argv[1])
33##else:
34
35event_number = 71115 #64977    #71114    # the event number or the mux file name
36
37#event_number_list = [31975, 51390, 63735] # To piggy back multiple events
38
39tide = 0 #1.9                # difference between MSL and HAT
40alpha = 0.1             # smoothing parameter for mesh
41friction=0.01           # manning's friction coefficient
42starttime=0             # start time for simulation
43finaltime=80000 # final time for simulation
44setup = 'final'         # This can be one of three values
45                        #    trial - coarsest mesh, fast
46                        #    basic - coarse mesh
47                        #    final - fine mesh, slowest
48
49# index is only used when wave = Tb
50index = 1914            # index from the PTHA - Y2000 0.257m
51wave = 'Bf'             # Bf (sts wave) Tb (index wave)
52
53
54internal_polygon = False
55
56#-------------------------------------------------------------------------------
57# Output filename
58#
59# Your output filename should be unique between different runs on different data.
60# The list of items below will be used to create a file in your output directory.
61# Your user name and time+date will be automatically added.  For example,
62#     [setup, tide, event_number]
63# will result in a filename like
64#     20090212_091046_run_final_0_27283_rwilson
65#-------------------------------------------------------------------------------
66
67if internal_polygon:
68    internal_poly_comment = 'internal'
69else:
70    internal_poly_comment = ''
71
72output_comment = [setup, tide, event_number, index, wave, internal_poly_comment]
73
74#-------------------------------------------------------------------------------
75# Input Data
76#-------------------------------------------------------------------------------
77
78# ELEVATION DATA
79# Used in build_elevation.py
80# Format for ascii grids, as produced in ArcGIS + a projection file
81ascii_grid_filenames = ['grid250m_pro'] # 250m grid 2005
82
83# Format for points is x,y,elevation (with header)
84point_filenames = []
85##point_filenames = ['ahs100_0.txt',
86##                   'ahs100_1.txt',
87##                   'ahs100_2.txt',
88##                   'ahs100_3.txt',
89##                   'ahs100_4.txt',
90##                   'ahs100_5.txt',
91##                   'ahs100_6.txt',
92##                   'ahs100_7.txt',
93##                   'ahs100_8.txt',
94##                   'ahs100_9.txt',
95##                   'ahs100_10.txt',
96##                   'ahs100_11.txt',
97##                   'ahs100_12.txt',
98##                   'ahs100_13.txt'] # LADS data
99
100### Add csv header list to all files in point_filenames
101##headerlist = ['x', 'y', 'elevation']
102##for f in point_filenames:
103##    add_csv_header(join(topographies_folder, f), headerlist)
104
105# BOUNDING POLYGON - for data clipping and estimate of triangles in mesh
106# Used in build_elevation.py
107# Format for points: easting,northing (no header)
108bounding_polygon_filename = 'bounding_polygon.csv'
109bounding_polygon_maxarea = 125000
110
111# INTERIOR REGIONS -  for designing the mesh
112# Used in run_model.py
113# Format for points easting,northing (no header)                   
114interior_regions_data = []
115
116# add an internal polygon to force different mesh generation
117# used to test for discretisation error when building elevation
118# make sure file is in same folder as interior regions and bouding polygon;
119# format is same (2 column .csv; easting, northing; no header)
120if internal_polygon:
121    interior_regions_data.append(['internal_polygon.csv',
122                                  bounding_polygon_maxarea])
123
124# LAND - used to set the initial stage/water to be offcoast only
125# Used in run_model.py.  Format for points easting,northing (no header)
126land_initial_conditions_filename = []
127
128# GAUGES - for creating timeseries at a specific point
129# Used in get_timeseries.py. 
130# Format easting,northing,name,elevation (with header)
131gauges_filename = 'gauges.csv'
132
133# BUILDINGS EXPOSURE - for identifying inundated houses
134# Used in run_building_inundation.py
135# Format latitude,longitude etc (geographic)
136building_exposure_filename = '.csv' # from NEXIS
137
138# BOUNDING POLYGON - used in build_boundary.py and run_model.py respectively
139# NOTE: when files are put together the points must be in sequence
140# For ease go clockwise!
141# Check the run_model.py for boundary_tags
142
143# Thinned ordering file from Hazard Map (geographic)
144# Format is index,latitude,longitude (with header)
145urs_order_filename = 'urs_order.csv'
146
147# Landward bounding points
148# Format easting,northing (no header)
149landward_boundary_filename = 'landward_boundary.csv'
150
151# MUX input filename.
152# If a meta-file from EventSelection is used, set 'multi-mux' to True.
153# If a single MUX stem filename (*.grd) is used, set 'multi-mux' to False.
154##mux_input_filename = 'Java-0016-z.grd'
155##multi_mux = False
156mux_input_filename = 'event.list'
157multi_mux = True
158
159# Specify if share cache is to be used
160# Whatever is specified here will be relative to INUNDATION_HOME/.cache
161# If nothing is specified, local cache will be used.
162cachedir = '.python_cache_phII'
163
164
165################################################################################
166################################################################################
167####         NOTE: NOTHING WOULD NORMALLY CHANGE BELOW THIS POINT.          ####
168################################################################################
169################################################################################
170
171# Get system user and host names.
172# These values can be used to distinguish between two similar runs by two
173# different users or runs by the same user on two different machines.
174user = get_user_name()
175host = get_host_name()
176
177# Environment variable names.
178# The inundation directory, not the data directory.
179ENV_INUNDATIONHOME = 'INUNDATIONHOME'
180
181# Path to MUX data
182ENV_MUXHOME = 'MUXHOME'
183
184#-------------------------------------------------------------------------------
185# Output Elevation Data
186#-------------------------------------------------------------------------------
187
188# Output filename for elevation
189# this is a combination of all the data generated in build_elevation.py
190combined_elevation_basename = scenario_name + '_combined_elevation'
191
192#-------------------------------------------------------------------------------
193# Directory Structure
194#-------------------------------------------------------------------------------
195
196# determines time for setting up output directories
197time = strftime('%Y%m%d_%H%M%S', localtime()) 
198gtime = strftime('%Y%m%d_%H%M%S', gmtime()) 
199build_time = time + '_build'
200run_time = time + '_run_'
201
202# create paths generated from environment variables.
203home = join(os.getenv(ENV_INUNDATIONHOME), 'data') # Absolute path for data folder
204muxhome = os.getenv(ENV_MUXHOME)
205
206# Create absolute pathname for cache directory
207# and change caching to use it
208if 'cachedir' in dir():
209    cachedir = join(os.getenv(ENV_INUNDATIONHOME), '.cache', cachedir)
210    from anuga.caching import caching
211    caching.set_option('cachedir', cachedir) 
212   
213# check various directories/files that must exist
214anuga_folder = join(home, state, scenario_name, 'anuga')
215topographies_folder = join(anuga_folder, 'topographies')
216polygons_folder = join(anuga_folder, 'polygons')
217boundaries_folder = join(anuga_folder, 'boundaries')
218output_folder = join(anuga_folder, 'outputs')
219gauges_folder = join(anuga_folder, 'gauges')
220meshes_folder = join(anuga_folder, 'meshes')
221event_folder = join(boundaries_folder, str(event_number))
222
223# MUX data files
224# Directory containing the MUX data files to be used with EventSelection.
225mux_data_folder = join(muxhome, 'mux')
226
227#-------------------------------------------------------------------------------
228# Location of input and output data
229#-------------------------------------------------------------------------------
230
231# Convert the user output_comment to a string for run_model.py
232output_comment = ('_'.join([str(x) for x in output_comment if x != user])
233                  + '_' + user)
234
235# The absolute pathname of the all elevation, generated in build_elevation.py
236combined_elevation = join(topographies_folder, combined_elevation_basename)
237
238# The absolute pathname of the mesh, generated in run_model.py
239meshes = join(meshes_folder, scenario_name) + '.msh'
240
241# The pathname for the urs order points, used within build_urs_boundary.py
242urs_order = join(boundaries_folder, urs_order_filename)
243
244# The absolute pathname for the landward points of the bounding polygon,
245# Used within run_model.py)
246landward_boundary = join(boundaries_folder, landward_boundary_filename)
247
248# The absolute pathname for the .sts file, generated in build_boundary.py
249event_sts = join(event_folder, scenario_name)
250
251# The absolute pathname for the output folder names
252# Used for build_elevation.py
253output_build = join(output_folder, build_time) + '_' + str(user) 
254# Used for run_model.py
255output_run = join(output_folder, run_time) + output_comment
256# Used by post processing
257output_run_time = join(output_run, scenario_name) 
258
259# The absolute pathname for the gauges file
260# Used for get_timeseries.py
261gauges = join(gauges_folder, gauges_filename)       
262
263# The absolute pathname for the building file
264# Used for run_building_inundation.py
265building_exposure = join(gauges_folder, building_exposure_filename)
266
267# full path to where MUX files (or meta-files) live
268mux_input = join(event_folder, mux_input_filename)
269
270# sts gauge with desired index number - used for wave 'Tb'
271boundary_csv = join(event_folder, 'sts_gauge_' + str(index) + '.csv')
272
273
Note: See TracBrowser for help on using the repository browser.