source: trunk/anuga_work/production/australia_ph2/perth/project.py @ 7877

Last change on this file since 7877 was 7877, checked in by hudson, 14 years ago

Moved all development files into trunk.

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