source: anuga_work/production/patong/project.py @ 6203

Last change on this file since 6203 was 6203, checked in by kristy, 16 years ago
File size: 9.1 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
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()
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#------------------------------------------------------------------------------
33# Initial Conditions
34#------------------------------------------------------------------------------
35
36# this section needs to be updated to reflect the modelled community.
37# Note, the user needs to set up the directory system accordingly
38state = 'thailand'
39scenario_name = 'patong'
40scenario = 'patong_tsunami_scenario'
41
42# Model specific parameters. One or all can be changed each time the
43# run_scenario script is executed
44tide = 0.8               #0.8
45alpha = 0.1             # smoothing parameter for mesh
46friction=0.01           # manning's friction coefficient
47starttime=0             
48finaltime=15000         # final time for simulation 15000
49
50setup='final'  # Final can be replaced with trial or basic.
51               # Either will result in a coarser mesh that will allow a
52               # faster, but less accurate, simulation.
53
54if setup =='trial':
55    print'trial'
56    res_factor=10
57    time_thinning=48
58    yieldstep=240
59if setup =='basic': 
60    print'basic'
61    res_factor=4
62    time_thinning=12
63    yieldstep=120
64if setup =='final': 
65    print'final'
66    res_factor=1
67    time_thinning=4
68    #time_thinning=48   
69    yieldstep=60
70
71#------------------------------------------------------------------------------
72# Output Filename
73#------------------------------------------------------------------------------
74# Important to distinguish each run - ensure str(user) is included!
75# Note, the user is free to include as many parameters as desired
76dir_comment='_'+setup+'_'+str(tide)+'_poly_'+str(user)
77
78#------------------------------------------------------------------------------
79# Input Data
80#------------------------------------------------------------------------------
81
82# elevation data used in build_patong.py
83# four textfiles, with different resolutions
84elevation1 = 'patong_10m_grid_msl_Project.txt' 
85elevation2 = 'patong_10m_small_grid_for_anuga_sub_Project.txt'
86elevation3 = 'patong_bay_1s_grid_Project.txt'
87elevation4 = 'andaman_3s_grid_Clip_Project.txt'
88
89# gauges - used in get_timeseries.py
90gauge_name = 'patong.csv'
91
92# BOUNDING POLYGON - used in build_boundary.py and run_patong.py respectively
93# NOTE: when files are put together the points must be in sequence - for ease go clockwise!
94# Check the run_patong.py for boundary_tags
95# thinned ordering file from Hazard Map: format is index,latitude,longitude (with title)
96order_filename = 'thinned_boundary_ordering.csv'
97#landward bounding points
98landward = 'landward_bounding_polygon.csv'
99
100#------------------------------------------------------------------------------
101# Output Elevation Data
102#------------------------------------------------------------------------------
103# Output filename for elevation
104# this is a combination of all the data (utilisied in build_boundary)
105combined_name ='patong_combined_elevation'
106combined_smaller_name = 'patong_combined_elevation_smaller'
107
108#------------------------------------------------------------------------------
109# Directory Structure
110#------------------------------------------------------------------------------
111anuga_dir = home+state+sep+scenario+sep+'anuga'+sep
112topographies_in_dir = home+state+sep+scenario+sep+'elevation_final'+sep+'points'+sep
113topographies_dir = anuga_dir+'topographies'+sep
114polygons_dir = anuga_dir+'polygons'+sep
115tide_dir = anuga_dir+'tide_data'+sep
116boundaries_dir = anuga_dir+'boundaries'+ sep
117output_dir = anuga_dir+'outputs'+sep
118gauges_dir = anuga_dir+'gauges'+sep
119meshes_dir = anuga_dir+'meshes'+sep
120
121#------------------------------------------------------------------------------
122# Location of input and output data
123#------------------------------------------------------------------------------
124# where the input data sits
125elevation_in_dir_name1 = topographies_in_dir + elevation1
126elevation_in_dir_name2 = topographies_in_dir + elevation2
127elevation_in_dir_name3 = topographies_in_dir + elevation3
128elevation_in_dir_name4 = topographies_in_dir + elevation4
129
130# where the output data sits
131elevation_dir_name1 = topographies_dir + elevation1
132elevation_dir_name2 = topographies_dir + elevation2
133elevation_dir_name3 = topographies_dir + elevation3
134elevation_dir_name4 = topographies_dir + elevation4
135
136
137# where the combined elevation file sits
138combined_dir_name = topographies_dir + combined_name + '_data'
139combined_smaller_name_dir = topographies_dir + combined_smaller_name
140
141# where the mesh sits (this is created during the run_patong.py)
142meshes_dir_name = meshes_dir + scenario_name+'_poly.msh'
143
144# where the boundary ordering files sit (this is used within build_boundary.py)
145order_filename_dir = boundaries_dir + order_filename
146
147# where the landward points of boundary extent sit (this is used within run_patong.py)
148landward_dir = boundaries_dir + landward
149
150# where the directory of the output filename sits
151output_build_time_dir = output_dir+build_time+dir_comment+sep   #used for build_patong.py
152output_run_time_dir = output_dir+run_time+dir_comment+sep       #used for run_patong.py
153output_run_time_dir_name = output_run_time_dir + scenario_name  #Used by post processing
154
155# where the directory of the gauges sit
156gauges_dir_name = gauges_dir + gauge_name       #used for get_timeseries.py
157
158#------------------------------------------------------------------------------
159# Interior region definitions
160#------------------------------------------------------------------------------
161
162# extents of elevation datasets
163extent_elev_dir1 = read_polygon(polygons_dir + 'patong_10m.txt')
164extent_elev_dir2 = read_polygon(polygons_dir + 'saddle_10m.txt')
165extent_elev_dir3 = read_polygon(polygons_dir + 'patong_1s.txt')
166extent_elev_dir4 = read_polygon(polygons_dir + 'patong_10m_aos.txt')
167
168#Land, to set the initial stage/water to be offcoast only
169poly_mainland = read_polygon(polygons_dir+'initial_conditions.csv')
170
171# Initial bounding polygon for data clipping
172poly_all = read_polygon(polygons_dir+'poly_all.csv')
173res_poly_all = 10000*res_factor
174
175# Area of Interest 1 elevation from -10m to 20m
176poly_aoi1 = read_polygon(polygons_dir+'aoi.csv')
177res_aoi1 = 800*res_factor
178
179# Area of Significance 1 elevation from -20m to a 200m buffer of the 20m contour
180poly_aos1 = read_polygon(polygons_dir+'aos.csv')
181res_aos1 = 1000*res_factor
182
183# Area of Shallow water and coastal land that needs a finer res than 1000000
184poly_sw = read_polygon(polygons_dir+'sw.csv')
185res_sw = 2000*res_factor
186
187
188# Area of buildings
189building_main = read_polygon(polygons_dir+'building_main.csv')
190building_main_small = read_polygon(polygons_dir+'building_main_small.csv')
191building_main_south = read_polygon(polygons_dir+'building_main_south.csv')
192building_saddle = read_polygon(polygons_dir+'building_saddle.csv')
193bld_res = 50*res_factor
194
195
196
197
198# Combined all regions, must check that all are included!
199interior_regions = [[poly_aoi1,res_aoi1],
200                    [poly_aos1,res_aos1],
201                    [poly_sw,res_sw],
202                    [building_main, bld_res],
203                    [building_main_small, bld_res],                   
204                    [building_main_south, bld_res],
205                    [building_saddle, bld_res]]
206                 
207   
208trigs_min = number_mesh_triangles(interior_regions, poly_all, res_poly_all)
209print 'min estimated number of triangles', trigs_min
210
211#------------------------------------------------------------------------------
212# Building polygons
213#------------------------------------------------------------------------------
214
215building_polygon_file = polygons_dir+'buildings.csv'
216
217#------------------------------------------------------------------------------
218# Clipping regions for export to asc and regions for clipping data
219# Final inundation maps should only be created in regions of the finest mesh
220#------------------------------------------------------------------------------
221
222#CBD extract ascii grid - cooridnates from patong_1s extent
223xminCBD = 417445.1119
224xmaxCBD = 425601.7881
225yminCBD = 870663.4547
226ymaxCBD = 876965.3856
227
228
Note: See TracBrowser for help on using the repository browser.