source: anuga_work/production/australia_ph2/cooktown/project.py @ 6767

Last change on this file since 6767 was 6756, checked in by myall, 16 years ago

standardising scripts and adding run_multiple_events.py

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 = 'cooktown'
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 = 147.0 # Central meridian for projection (optional)
29#zone = 55
30import sys
31if len(sys.argv) > 1:
32    event_number = int(sys.argv[1])
33else:   
34    event_number = 31977    # the event number or the mux file name
35
36event_number_list = [31977, 51469, 63735] # 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=1000   #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 = 2065            # 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 = []
81
82# Format for points is x,y,elevation (with header)
83point_filenames = ['ahs100_0.txt',
84                   'ahs100_1.txt',
85                   'ahs100_2.txt',
86                   'ahs100_3.txt',
87                   'ahs100_4.txt',
88                   'ahs100_5.txt',
89                   'ahs100_6.txt',
90                   'ahs100_7.txt',
91                   'ahs100_8.txt',
92                   'ahs100_9.txt',
93                   'ahs100_10.txt',
94                   'ahs100_11.txt',
95                   'ahs100_12.txt',
96                   'ahs100_13.txt'] # LADS data
97
98### Add csv header list to all files in point_filenames
99##headerlist = ['x', 'y', 'elevation']
100##for f in point_filenames:
101##    add_csv_header(join(topographies_folder, f), headerlist)
102
103# BOUNDING POLYGON - for data clipping and estimate of triangles in mesh
104# Used in build_elevation.py
105# Format for points: easting,northing (no header)
106bounding_polygon_filename = 'bounding_polygon.csv'
107bounding_polygon_maxarea = 125000
108
109# INTERIOR REGIONS -  for designing the mesh
110# Used in run_model.py
111# Format for points easting,northing (no header)                   
112interior_regions_data = []
113
114# add an internal polygon to force different mesh generation
115# used to test for discretisation error when building elevation
116# make sure file is in same folder as interior regions and bouding polygon;
117# format is same (2 column .csv; easting, northing; no header)
118if internal_polygon:
119    interior_regions_data.append(['internal_polygon.csv',
120                                  bounding_polygon_maxarea])
121
122# LAND - used to set the initial stage/water to be offcoast only
123# Used in run_model.py.  Format for points easting,northing (no header)
124land_initial_conditions_filename = []
125
126# GAUGES - for creating timeseries at a specific point
127# Used in get_timeseries.py. 
128# Format easting,northing,name,elevation (with header)
129gauges_filename = 'gauges.csv'
130
131# BUILDINGS EXPOSURE - for identifying inundated houses
132# Used in run_building_inundation.py
133# Format latitude,longitude etc (geographic)
134building_exposure_filename = '.csv' # from NEXIS
135
136# BOUNDING POLYGON - used in build_boundary.py and run_model.py respectively
137# NOTE: when files are put together the points must be in sequence
138# For ease go clockwise!
139# Check the run_model.py for boundary_tags
140
141# Thinned ordering file from Hazard Map (geographic)
142# Format is index,latitude,longitude (with header)
143urs_order_filename = 'urs_order_simple.csv'
144
145# Landward bounding points
146# Format easting,northing (no header)
147landward_boundary_filename = 'landward_boundary.csv'
148
149# MUX input filename.
150# If a meta-file from EventSelection is used, set 'multi-mux' to True.
151# If a single MUX stem filename (*.grd) is used, set 'multi-mux' to False.
152##mux_input_filename = 'Java-0016-z.grd'
153##multi_mux = False
154mux_input_filename = 'event.list'
155multi_mux = True
156
157# Specify if share cache is to be used
158# Whatever is specified here will be relative to INUNDATION_HOME/.cache
159# If nothing is specified, local cache will be used.
160cachedir = '.python_cache_phII'
161
162
163################################################################################
164################################################################################
165####         NOTE: NOTHING WOULD NORMALLY CHANGE BELOW THIS POINT.          ####
166################################################################################
167################################################################################
168
169# Get system user and host names.
170# These values can be used to distinguish between two similar runs by two
171# different users or runs by the same user on two different machines.
172user = get_user_name()
173host = get_host_name()
174
175# Environment variable names.
176# The inundation directory, not the data directory.
177ENV_INUNDATIONHOME = 'INUNDATIONHOME'
178
179# Path to MUX data
180ENV_MUXHOME = 'MUXHOME'
181
182#-------------------------------------------------------------------------------
183# Output Elevation Data
184#-------------------------------------------------------------------------------
185
186# Output filename for elevation
187# this is a combination of all the data generated in build_elevation.py
188combined_elevation_basename = scenario_name + '_combined_elevation'
189
190#-------------------------------------------------------------------------------
191# Directory Structure
192#-------------------------------------------------------------------------------
193
194# determines time for setting up output directories
195time = strftime('%Y%m%d_%H%M%S', localtime()) 
196gtime = strftime('%Y%m%d_%H%M%S', gmtime()) 
197build_time = time + '_build'
198run_time = time + '_run_'
199
200# create paths generated from environment variables.
201home = join(os.getenv(ENV_INUNDATIONHOME), 'data') # Absolute path for data folder
202muxhome = os.getenv(ENV_MUXHOME)
203
204# Create absolute pathname for cache directory
205# and change caching to use it
206if 'cachedir' in dir():
207    cachedir = join(os.getenv(ENV_INUNDATIONHOME), '.cache', cachedir)
208    from anuga.caching import caching
209    caching.set_option('cachedir', cachedir) 
210   
211# check various directories/files that must exist
212anuga_folder = join(home, state, scenario_name, 'anuga')
213topographies_folder = join(anuga_folder, 'topographies')
214polygons_folder = join(anuga_folder, 'polygons')
215boundaries_folder = join(anuga_folder, 'boundaries')
216output_folder = join(anuga_folder, 'outputs')
217gauges_folder = join(anuga_folder, 'gauges')
218meshes_folder = join(anuga_folder, 'meshes')
219event_folder = join(boundaries_folder, str(event_number))
220
221# MUX data files
222# Directory containing the MUX data files to be used with EventSelection.
223mux_data_folder = join(muxhome, 'mux')
224
225#-------------------------------------------------------------------------------
226# Location of input and output data
227#-------------------------------------------------------------------------------
228
229# Convert the user output_comment to a string for run_model.py
230output_comment = ('_'.join([str(x) for x in output_comment if x != user])
231                  + '_' + user)
232
233# The absolute pathname of the all elevation, generated in build_elevation.py
234combined_elevation = join(topographies_folder, combined_elevation_basename)
235
236# The absolute pathname of the mesh, generated in run_model.py
237meshes = join(meshes_folder, scenario_name) + '.msh'
238
239# The pathname for the urs order points, used within build_urs_boundary.py
240urs_order = join(boundaries_folder, urs_order_filename)
241
242# The absolute pathname for the landward points of the bounding polygon,
243# Used within run_model.py)
244landward_boundary = join(boundaries_folder, landward_boundary_filename)
245
246# The absolute pathname for the .sts file, generated in build_boundary.py
247event_sts = join(event_folder, scenario_name)
248
249# The absolute pathname for the output folder names
250# Used for build_elevation.py
251output_build = join(output_folder, build_time) + '_' + str(user) 
252# Used for run_model.py
253output_run = join(output_folder, run_time) + output_comment
254# Used by post processing
255output_run_time = join(output_run, scenario_name) 
256
257# The absolute pathname for the gauges file
258# Used for get_timeseries.py
259gauges = join(gauges_folder, gauges_filename)       
260
261# The absolute pathname for the building file
262# Used for run_building_inundation.py
263building_exposure = join(gauges_folder, building_exposure_filename)
264
265# full path to where MUX files (or meta-files) live
266mux_input = join(event_folder, mux_input_filename)
267
268# sts gauge with desired index number - used for wave 'Tb'
269boundary_csv = join(event_folder, 'sts_gauge_' + str(index) + '.csv')
270
271
Note: See TracBrowser for help on using the repository browser.