source: anuga_work/production/australia_ph2/sydney/comparisons/project_250m.py @ 6498

Last change on this file since 6498 was 6498, checked in by jgriffin, 14 years ago

changed event number; added Arc_asc2raster_GDA94z56.py

File size: 7.6 KB
Line 
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
8from os import sep, environ, getenv, getcwd
9from os.path import expanduser, join
10import sys
11from time import localtime, strftime, gmtime
12from anuga.utilities.polygon import read_polygon, plot_polygons, is_inside_polygon, number_mesh_triangles
13from anuga.utilities.system_tools import get_user_name, get_host_name
14from anuga.shallow_water.data_manager import urs2sts,create_sts_boundary
15from anuga.utilities.polygon import read_polygon, plot_polygons, polygon_area, is_inside_polygon
16
17#------------------------------------------------------------------------------
18# Directory setup
19#------------------------------------------------------------------------------
20# Note: INUNDATIONHOME is the inundation directory, not the data directory.
21
22home = getenv('INUNDATIONHOME') + sep +'data'+sep #Sandpit's parent diruser = get_user_name()
23muxhome = getenv('MUXHOME')
24user = get_user_name()
25host = get_host_name()
26
27# determines time for setting up output directories
28time = strftime('%Y%m%d_%H%M%S',localtime()) 
29gtime = strftime('%Y%m%d_%H%M%S',gmtime()) 
30build_time = time+'_build'
31run_time = time+'_run'
32
33#------------------------------------------------------------------------------
34# Initial Conditions
35#------------------------------------------------------------------------------
36
37# this section needs to be updated to reflect the modelled community.
38# Note, the user needs to set up the directory system accordingly
39state = 'australia_ph2'
40scenario_name = 'sydney'
41scenario = 'sydney'
42area = 'large' #'small_b10'
43
44# Model specific parameters. One or all can be changed each time the
45# run_scenario script is executed
46tide = 0                #0.6
47event_number = 7875   # linked to hazard map
48alpha = 0.1             # smoothing parameter for mesh
49friction=0.01           # manning's friction coefficient
50starttime=0             
51finaltime=80000         # final time for simulation
52
53interior_mesh = 'none' # Can have 'all' or 'none' for Phase 2 study
54
55setup='final'  # Final can be replaced with trial or basic.
56               # Either will result in a coarser mesh that will allow a
57               # faster, but less accurate, simulation.
58
59if setup =='trial':
60    print'trial'
61    res_factor=10
62    time_thinning=48
63    yieldstep=240
64if setup =='basic': 
65    print'basic'
66    res_factor=4
67    time_thinning=12
68    yieldstep=120
69if setup =='final': 
70    print'final'
71    res_factor=1
72    time_thinning=4
73    yieldstep=60
74
75#------------------------------------------------------------------------------
76# Output Filename
77#------------------------------------------------------------------------------
78# Important to distinguish each run - ensure str(user) is included!
79# Note, the user is free to include as many parameters as desired
80dir_comment='_'+setup+'_'+str(tide)+'_250m_' + str(area)+'_'+str(user)
81
82#------------------------------------------------------------------------------
83# Input Data
84#------------------------------------------------------------------------------
85
86# elevation data used in build_sydney.py
87# onshore data: format ascii grid with accompanying projection file
88#onshore_name = 'grid_250m_2005'
89onshore_name = 'sydney_elevation.txt'
90
91# gauges - used in get_timeseries.py
92gauge_name = 'sydney.csv'
93gauge_name2 = 'thinned_MGA50.csv'
94
95# BOUNDING POLYGON - used in build_boundary.py and run_sydney.py respectively
96# NOTE: when files are put together the points must be in sequence - for ease go clockwise!
97# Check the run_sydney.py for boundary_tags
98# thinned ordering file from Hazard Map: format is index,latitude,longitude (with title)
99order_filename = 'thinned_boundary_ordering.csv'
100#landward bounding points
101landward = 'landward_bounding_polygon.csv'
102
103# INTERIOR REGIONS -  for designing the mesh
104# Used in run_model.py
105# Format for points easting,northing (no header)                   
106interior_regions_data = [['coast_3km_buffer_' + area + '.csv', 50000]]
107
108#------------------------------------------------------------------------------
109# Output Elevation Data
110#------------------------------------------------------------------------------
111# Output filename for elevation
112# this is a combination of all the data (utilisied in build_boundary)
113combined_name ='sydney_combined_elevation_250m'+area
114
115#------------------------------------------------------------------------------
116# Directory Structure
117#------------------------------------------------------------------------------
118anuga_dir = home+state+sep+scenario+sep+'anuga'+sep
119topographies_in_dir = home+state+sep+scenario+sep+'elevation_final'+sep+'points'+sep
120topographies_dir = anuga_dir+'topographies'+sep
121polygons_dir = anuga_dir+'polygons'+sep
122tide_dir = anuga_dir+'tide_data'+sep
123boundaries_dir = anuga_dir+'boundaries'+ sep
124output_dir = anuga_dir+'outputs'+sep
125gauges_dir = anuga_dir+'gauges'+sep
126meshes_dir = anuga_dir+'meshes'+sep
127
128#------------------------------------------------------------------------------
129# Location of input and output data
130#------------------------------------------------------------------------------
131# where the input data sits
132onshore_in_dir_name = topographies_in_dir + onshore_name
133
134# where the output data sits
135onshore_dir_name = topographies_dir + onshore_name
136
137# where the combined elevation file sits
138combined_dir_name = topographies_dir + combined_name
139
140# where the mesh sits (this is created during the run_sydney.py)
141meshes_dir_name = meshes_dir + scenario_name+ '_' + area + '.msh'
142
143# where the boundary ordering files sit (this is used within build_boundary.py)
144order_filename_dir = boundaries_dir + order_filename
145
146# where the landward points of boundary extent sit (this is used within run_sydney.py)
147landward_dir = boundaries_dir + landward
148
149# where the event sts files sits (this is created during the build_boundary.py)
150boundaries_dir_event = boundaries_dir + str(event_number) + sep
151boundaries_dir_mux = muxhome
152
153# where the directory of the output filename sits
154output_build_time_dir = output_dir+build_time+dir_comment+sep   #used for build_sydney.py
155output_run_time_dir = output_dir+run_time+dir_comment+sep       #used for run_sydney.py
156output_run_time_dir_name = output_run_time_dir + scenario_name  #Used by post processing
157
158#w here the directory of the gauges sit
159gauges_dir_name = gauges_dir + gauge_name       #used for get_timeseries.py
160gauges_dir_name2 = gauges_dir + gauge_name2     #used for get_timeseries.py
161
162#------------------------------------------------------------------------------
163# Interior region definitions
164#------------------------------------------------------------------------------
165
166#Land, to set the initial stage/water to be offcoast only
167poly_mainland = read_polygon(polygons_dir+'initial_condition_extend.csv')
168
169#Ocean
170#poly_ocean = read_polygon(polygons_dir+'initial_conditions_ocean.csv')
171
172#islands
173island1 = read_polygon(polygons_dir+'initial_condition_comerong_island.csv')
174
175island2 = read_polygon(polygons_dir+'initial_condition_montague_island.csv')
176
177# Initial bounding polygon for data clipping
178poly_all = read_polygon(polygons_dir+'poly_all_' + area + '.csv')
179res_poly_all = 100000*res_factor
180
181
182# Combined all regions, must check that all are included!
183
184interior_regions = []
185for filename, maxarea in interior_regions_data:
186    polygon = read_polygon(join(polygons_dir, filename))
187    interior_regions.append([polygon, maxarea*res_factor])
188     
189trigs_min = number_mesh_triangles(interior_regions, poly_all, res_poly_all)
190print 'min estimated number of triangles', trigs_min
191   
Note: See TracBrowser for help on using the repository browser.