source: anuga_work/production/australia_ph2/sydney/project.py @ 6855

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