source: anuga_work/production/onslow_2006/project_grad.py @ 4853

Last change on this file since 4853 was 4853, checked in by sexton, 16 years ago

reflecting updated function in other files

File size: 5.7 KB
Line 
1"""Common filenames and locations for topographic data, meshes and outputs.
2
3All filenames are given without extension
4"""
5
6from os import sep, environ, getenv, getcwd, umask
7from os.path import expanduser, basename, join
8from anuga.utilities.polygon import read_polygon, plot_polygons_points, polygon_area, is_inside_polygon, number_mesh_triangles
9import sys
10from anuga.coordinate_transforms.redfearn import degminsec2decimal_degrees
11from time import localtime, strftime, gmtime
12from anuga.utilities.system_tools import get_user_name, get_host_name
13
14codename = 'project_grad.py' # FIXME can be obtained automatically as __file__
15
16home = join(getenv('INUNDATIONHOME'), 'data') # Location of Data   
17user = get_user_name()
18host = get_host_name()
19#needed when running using mpirun, mpirun doesn't inherit umask from .bashrc
20umask(002)
21
22#Making assumptions about the location of scenario data
23state = 'western_australia'
24scenario_name = 'onslow'
25scenario = 'onslow_tsunami_scenario_2006'
26
27#time stuff
28time = strftime('%Y%m%d_%H%M%S',gmtime()) #gets time for new dir
29build_time = time+'_build'
30run_time = time+'_run'
31
32#tide = 0.0 # MSL
33tide = 1.5 # HAT
34#tide = -1.5 # LAT
35
36#Maybe will try to make project a class to allow these parameters to be passed in.
37alpha = 0.1
38friction = 0.01
39finaltime = 40000
40starttime = 3600 # Action starts around 9000
41#setup='final'
42setup = 'trial'
43which_data = 'original'
44#which_data = 'revised'
45boundary_event = 'onslow'
46
47boundary_event = 'exmouth'
48#boundary_event = 'onslow'
49#boundary_event = 'dampier'
50
51if setup =='trial':
52    print'trial'
53    res_factor=10
54    time_thinning=48
55    yieldstep=240
56if setup =='basic': 
57    print'basic'
58    res_factor=4
59    time_thinning=12
60    yieldstep=120
61if setup =='final': 
62    print'final'
63    res_factor=1.0
64    time_thinning=4
65    yieldstep=60
66
67anuga_dir = join(home, state, scenario, 'anuga')
68
69topographies_in_dir = join(anuga_dir, 'topographies')
70
71topographies_dir = join(anuga_dir, 'topographies') # Output dir for ANUGA
72
73if boundary_event =='dampier':
74    boundaries_name = 'onslow_3854_17042007' #Dampier gun
75    boundaries_in_dir = join(anuga_dir,'boundaries','urs','dampier','1_10000')
76
77if boundary_event=='onslow':
78    boundaries_name = 'onslow_3859_16052007' #onslow_hedland_broome gun
79    boundaries_in_dir = join(anuga_dir,'boundaries','urs','onslow_hedland_broome','1_10000')
80   
81if boundary_event=='exmouth':
82    boundaries_name = 'onslow_3103_18052007' #exmouth gun
83    boundaries_in_dir = join(anuga_dir,'boundaries','urs','exmouth','1_10000')
84
85dir_comment='_'+setup+'_'+str(tide)+'_'+\
86             str(user)+'_'+boundary_event+'_'+which_data
87
88
89# elevation data filenames
90
91if which_data == 'original':
92    ascii_grid_filenames = ['onslow_onshore_20m_dli', 'onslow_islands_dted2']
93    point_filenames = ['onslow_offshore_points', 'onslow_coast']
94
95if which_data == 'revised':
96    ascii_grid_filenames = ['revised_onshore_20m_dli', 'onslow_islands_dted2']
97    point_filenames = ['onslow_offshore_points', 'revised_coastline',
98                       'beach_survey', 'ONS16FINAL', 'ONS17FINAL', 'ONS18FINAL' ]
99
100# final topo name
101combined_name ='onslow_combined_elevation_grad'
102combined_small_name = 'onslow_combined_elevation_grad'
103
104
105# Convert topo file locations into absolute pathnames
106for filename_list in [ascii_grid_filenames, point_filenames]:
107    for i, filename in enumerate(filename_list):
108        filename_list[i] = join(topographies_in_dir, filename)
109
110#final topo files
111combined_dir_name = join(topographies_dir, combined_name)
112combined_small_dir_name = join(topographies_dir, combined_small_name)
113
114mesh_dir = join(anuga_dir, 'meshes')
115mesh_name = join(mesh_dir, scenario_name)
116
117polygons_dir = join(anuga_dir, 'polygons') # Created with ArcGIS (csv files)
118tide_dir = join(anuga_dir, 'tide_data')
119
120#output locations
121output_dir = join(anuga_dir, 'outputs')+sep
122output_build_time_dir = output_dir+build_time+sep
123output_run_time_dir = output_dir +run_time+dir_comment+sep
124output_run_time_dir_name = output_run_time_dir + scenario_name  #Used by post processing
125
126#gauges
127gauges_dir = join(anuga_dir,'gauges')
128gauge_name = 'gauge_location_onslow.csv'
129gauges_dir_name = gauges_dir + gauge_name
130
131#buildings_filename = gauges_dir + 'Onslow_res_Project.csv'
132#buildings_filename_out = 'Onslow_res_Project_modified.csv'
133
134# for ferret2sww
135south = degminsec2decimal_degrees(-20,30,0)
136north = degminsec2decimal_degrees(-17,10,0)
137west = degminsec2decimal_degrees(117,00,0)
138east = degminsec2decimal_degrees(120,00,0)
139
140# region to export (used from export_results.py)
141e_min_area = 300000   # Eastings min
142e_max_area = 310000
143n_min_area = 7600000
144n_max_area = 7610000
145               
146#FIXME (Ole): It is bad to read in polygons in project.py. If a file does not exist
147#project.py cannot be imported
148
149# Bounding polygon
150bounding_polygon = read_polygon(join(polygons_dir, 'domain.csv'))
151res_bounding_polygon = 500000*res_factor
152
153# Interior regions
154interior_regions_and_resolutions = {
155    'inner_region': 5000,
156    'region_50m': 50000,
157    'onslow_v2': 500}
158
159# Domain
160boundary_tags = {'back': [4, 5],   
161                 'side': [3, 6],
162                 'ocean': [0, 1, 2]}
163
164interior_regions = [] # Consider using dictionary for mesh interface.
165for area_name in interior_regions_and_resolutions.keys():
166    file_name = join(polygons_dir, area_name + '.csv')
167   
168    print 'Reading polygon from', file_name
169    polygon = read_polygon(file_name)
170    base_resolution = interior_regions_and_resolutions[area_name]
171   
172    interior_regions.append([polygon, base_resolution*res_factor])
173
174trigs_min = number_mesh_triangles(interior_regions,
175                                  bounding_polygon,
176                                  res_bounding_polygon)
177
178onshore_polygon = read_polygon(join(home, state, scenario,'elevation_final','points',
179                                    'InitialCondition_points.csv'))
Note: See TracBrowser for help on using the repository browser.