source: anuga_work/production/geraldton/project.py @ 6842

Last change on this file since 6842 was 6342, checked in by myall, 16 years ago
File size: 10.0 KB
RevLine 
[5789]1"""Common filenames and locations for elevation, meshes and outputs.
2This script is the heart of all scripts in the folder
[5005]3"""
[5789]4#------------------------------------------------------------------------------
5# Import necessary modules
6#------------------------------------------------------------------------------
[5005]7
[5789]8from os import sep, environ, getenv, getcwd
[5005]9from os.path import expanduser
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
[5652]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
[5005]16
[5789]17#------------------------------------------------------------------------------
18# Directory setup
19#------------------------------------------------------------------------------
20# Note: INUNDATIONHOME is the inundation directory, not the data directory.
[5005]21
[5789]22home = getenv('INUNDATIONHOME') + sep +'data'+sep #Sandpit's parent diruser = get_user_name()
[5652]23muxhome = getenv('MUXHOME')
[5005]24user = get_user_name()
25host = get_host_name()
[5652]26
[5789]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()) 
[5005]30build_time = time+'_build'
31run_time = time+'_run'
32
[5789]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
[5005]39state = 'western_australia'
[5012]40scenario_name = 'geraldton'
41scenario = 'geraldton_tsunami_scenario'
[5005]42
[5789]43# Model specific parameters. One or all can be changed each time the
44# run_scenario script is executed
[6027]45tide = 0.6         #0.6
[5828]46#event_number = 27255 # Java 9.3 worst case for Perth
47event_number = 68693 # Sumatra 9.2
48#event_number = 27283  # Java 9.3 original
[5789]49alpha = 0.1             # smoothing parameter for mesh
50friction=0.01           # manning's friction coefficient
51starttime=0             
[6027]52finaltime=80000       # final time for simulation
[5652]53
[5789]54setup='final'  # Final can be replaced with trial or basic.
55               # Either will result in a coarser mesh that will allow a
56               # faster, but less accurate, simulation.
[5652]57
[6027]58if setup =='coarse':
59    print'coarse'
60    res_factor=10000000
61    time_thinning=48
62    yieldstep=240
[5005]63if setup =='trial':
64    print'trial'
65    res_factor=10
66    time_thinning=48
67    yieldstep=240
68if setup =='basic': 
69    print'basic'
70    res_factor=4
71    time_thinning=12
72    yieldstep=120
73if setup =='final': 
74    print'final'
75    res_factor=1
76    time_thinning=4
77    yieldstep=60
78
[5789]79#------------------------------------------------------------------------------
80# Output Filename
81#------------------------------------------------------------------------------
82# Important to distinguish each run - ensure str(user) is included!
83# Note, the user is free to include as many parameters as desired
84dir_comment='_'+setup+'_'+str(tide)+'_'+str(event_number)+'_'+ 'alpha' +str(alpha)+'_'+str(user)
[5005]85
[5789]86#------------------------------------------------------------------------------
87# Input Data
88#------------------------------------------------------------------------------
[5005]89
[5789]90# elevation data used in build_geraldton.py
91# onshore data: format ascii grid with accompanying projection file
92onshore_name = 'landgate_dem_clip' 
93# island: format ascii grid with accompanying projection file
94island_name = 'dted_srtm_islands' 
95# coastline: format x,y,elevation (with title)
96coast_name = 'XYcoastline_KVP.txt'
97# bathymetry: format x,y,elevation (with title)
98offshore_name = 'Geraldton_bathymetry.txt'
99offshore_name1 = 'DPI_Data.txt'
100offshore_name2 = 'grid250.txt'
101offshore_name3 = 'Top_bathymetry.txt'
[5005]102
[5789]103# gauges - used in get_timeseries.py
[6342]104gauge_name = 'MH_gauges.csv'  #'geraldton.csv'
[5789]105gauge_name2 = 'thinned_MGA50.csv'
[5005]106
[6027]107#buildings - used in run_building_inundation.py
108building = 'geraldton_res_clip'
109
110# barrier
111barrier = 'CBD.csv'
112barrier1 = 'wall.csv'
113
[5789]114# BOUNDING POLYGON - used in build_boundary.py and run_geraldton.py respectively
115# NOTE: when files are put together the points must be in sequence - for ease go clockwise!
116# Check the run_geraldton.py for boundary_tags
117# thinned ordering file from Hazard Map: format is index,latitude,longitude (with title)
[5796]118order_filename = 'thinned_boundary_ordering.csv'
[5789]119#landward bounding points
[5796]120landward = 'landward_bounding_polygon.csv'
[5652]121
[5789]122#------------------------------------------------------------------------------
123# Output Elevation Data
124#------------------------------------------------------------------------------
125# Output filename for elevation
126# this is a combination of all the data (utilisied in build_boundary)
[5150]127combined_name ='geraldton_combined_elevation'
[5789]128combined_smaller_name = 'geraldton_combined_elevation_smaller'
[5005]129
[5789]130#------------------------------------------------------------------------------
131# Directory Structure
132#------------------------------------------------------------------------------
[5005]133anuga_dir = home+state+sep+scenario+sep+'anuga'+sep
[5150]134topographies_in_dir = home+state+sep+scenario+sep+'elevation_final'+sep+'points'+sep
[5789]135topographies_dir = anuga_dir+'topographies'+sep
136polygons_dir = anuga_dir+'polygons'+sep
137tide_dir = anuga_dir+'tide_data'+sep
138boundaries_dir = anuga_dir+'boundaries'+ sep
139output_dir = anuga_dir+'outputs'+sep
140gauges_dir = anuga_dir+'gauges'+sep
141meshes_dir = anuga_dir+'meshes'+sep
[5005]142
[5789]143#------------------------------------------------------------------------------
144# Location of input and output data
145#------------------------------------------------------------------------------
146# where the input data sits
[5005]147onshore_in_dir_name = topographies_in_dir + onshore_name
[5012]148island_in_dir_name = topographies_in_dir + island_name
[5005]149coast_in_dir_name = topographies_in_dir + coast_name
150offshore_in_dir_name = topographies_in_dir + offshore_name
[5652]151offshore_in_dir_name1 = topographies_in_dir + offshore_name1
152offshore_in_dir_name2 = topographies_in_dir + offshore_name2
153offshore_in_dir_name3 = topographies_in_dir + offshore_name3
[5005]154
[5789]155# where the output data sits
[5005]156onshore_dir_name = topographies_dir + onshore_name
[5012]157island_dir_name = topographies_dir + island_name
[5005]158coast_dir_name = topographies_dir + coast_name
159offshore_dir_name = topographies_dir + offshore_name
[5652]160offshore_dir_name1 = topographies_dir + offshore_name1
161offshore_dir_name2 = topographies_dir + offshore_name2
162offshore_dir_name3 = topographies_dir + offshore_name3
[5005]163
[5789]164# where the combined elevation file sits
[5005]165combined_dir_name = topographies_dir + combined_name
[5789]166combined_smaller_name_dir = topographies_dir + combined_smaller_name
[5005]167
[5789]168# where the mesh sits (this is created during the run_geraldton.py)
169meshes_dir_name = meshes_dir + scenario_name+'.msh'
[6027]170barrier_dir_name = meshes_dir + barrier
171barrier_dir_name1 = meshes_dir + barrier1
[5005]172
[5789]173# where the boundary ordering files sit (this is used within build_boundary.py)
174order_filename_dir = boundaries_dir + order_filename
[5005]175
[5789]176# where the landward points of boundary extent sit (this is used within run_geraldton.py)
177landward_dir = boundaries_dir + landward
[5652]178
[5789]179# where the event sts files sits (this is created during the build_boundary.py)
180boundaries_dir_event = boundaries_dir + str(event_number) + sep
[5652]181boundaries_dir_mux = muxhome
[5005]182
[5789]183# where the directory of the output filename sits
184output_build_time_dir = output_dir+build_time+dir_comment+sep   #used for build_geraldton.py
185output_run_time_dir = output_dir+run_time+dir_comment+sep       #used for run_geraldton.py
[5005]186output_run_time_dir_name = output_run_time_dir + scenario_name  #Used by post processing
187
[6027]188# where the directory of the gauges sit
[5789]189gauges_dir_name = gauges_dir + gauge_name       #used for get_timeseries.py
190gauges_dir_name2 = gauges_dir + gauge_name2     #used for get_timeseries.py
[6027]191building_in_dir_name = gauges_dir + building + '.csv'    #used for run_building_inundation.py
[5652]192
[5789]193#------------------------------------------------------------------------------
194# Interior region definitions
195#------------------------------------------------------------------------------
[5005]196
[5789]197#Land, to set the initial stage/water to be offcoast only
198#Land and Ocean to clip data
199poly_mainland=read_polygon(polygons_dir +'land_initial_condition.csv')
200poly_ocean=read_polygon(polygons_dir +'ocean_initial_condition.csv')
[6027]201poly_buffer_20m=read_polygon(polygons_dir +'buffer_20m.csv')
[5005]202
[5789]203# Initial bounding polygon for data clipping
[5652]204poly_all = read_polygon(polygons_dir+'poly_all.csv')
[5012]205res_poly_all = 100000*res_factor
[5005]206
[5789]207# Area of Interest 1 (Geraldton)
208poly_aoi1 = read_polygon(polygons_dir+'CBD_500m.csv')
209res_aoi1 = 500*res_factor
[5012]210
[5789]211# Area of Significance 1 (Geraldton)
212poly_aos1 = read_polygon(polygons_dir+'CBD_1km.csv')
213res_aos1 = 800*res_factor
[5012]214
[5789]215# Area of Significance 2 (island1)
216poly_aos2 = read_polygon(polygons_dir+'island_wallabi_poly.csv')
217res_aos2 = 5000*res_factor
[5012]218
[5789]219# Area of Significance 3 (island2)
220poly_aos3 = read_polygon(polygons_dir+'island_dingiville_poly.csv')
221res_aos3 = 5000*res_factor
[5150]222
[5789]223# Area of Significance 4 (island3)
224poly_aos4 = read_polygon(polygons_dir+'island_pelsaert_poly.csv')
225res_aos4 = 5000*res_factor
[5150]226
[5789]227# Shallow water 1
228poly_sw1 = read_polygon(polygons_dir+'neg20_pos20.csv')
229res_sw1 = 25000*res_factor
[5012]230
[5789]231# Combined all regions, must check that all are included!
232interior_regions = [[poly_aoi1,res_aoi1],[poly_aos1,res_aos1]
233                     ,[poly_aos2,res_aos2],[poly_aos3,res_aos3]
234                     ,[poly_aos4,res_aos4],[poly_sw1,res_sw1]]
[5012]235
[5789]236   
[5005]237trigs_min = number_mesh_triangles(interior_regions, poly_all, res_poly_all)
[5789]238print 'min estimated number of triangles', trigs_min
239   
240#------------------------------------------------------------------------------
[5652]241# Clipping regions for export to asc and regions for clipping data
[5789]242# Final inundation maps should only be created in regions of the finest mesh
243#------------------------------------------------------------------------------
[5005]244
[5652]245# Geraldton CBD extract ascii grid
246xminCBD = 262700
247xmaxCBD = 267600
248yminCBD = 6811500
249ymaxCBD = 6816400
Note: See TracBrowser for help on using the repository browser.