source: anuga_work/production/australia_ph2/broome/project.py @ 6346

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