source: anuga_work/production/perth/project.py @ 5581

Last change on this file since 5581 was 5581, checked in by sexton, 14 years ago

fix script to get gauges from sts file and test run_perth with tide=0

File size: 8.1 KB
Line 
1# -*- coding: cp1252 -*-
2"""Common filenames and locations for topographic data, meshes and outputs.
3"""
4
5from os import sep, environ, getenv, getcwd
6from os.path import expanduser
7import sys
8from time import localtime, strftime, gmtime
9from anuga.utilities.polygon import read_polygon, plot_polygons, is_inside_polygon, number_mesh_triangles
10#from anuga.coordinate_transforms.redfearn import degminsec2decimal_degrees, convert_points_from_latlon_to_utm
11from anuga.utilities.system_tools import get_user_name, get_host_name
12from anuga.shallow_water.data_manager import urs2sts,create_sts_boundary
13from anuga.utilities.polygon import read_polygon, plot_polygons, polygon_area, is_inside_polygon
14
15# file and system info
16#---------------------------------
17#codename = 'project.py'
18
19home = getenv('INUNDATIONHOME') + sep +'data'+sep #Sandpit's parent diruser = get_user_name()
20muxhome = getenv('MUXHOME')
21user = get_user_name()
22host = get_host_name()
23
24# INUNDATIONHOME is the inundation directory, not the data directory.
25
26#time stuff
27time = strftime('%Y%m%d_%H%M%S',localtime()) #gets time for new dir
28gtime = strftime('%Y%m%d_%H%M%S',gmtime()) #gets time for new dir
29build_time = time+'_build'
30run_time = time+'_run'
31print 'gtime: ', gtime
32
33#Making assumptions about the location of scenario data
34state = 'western_australia'
35scenario_name = 'perth'
36scenario = 'perth_tsunami_scenario'
37
38tide = 0.0 #0.6
39
40alpha = 0.1
41friction=0.01
42starttime=0
43finaltime=80000 
44export_cellsize=25
45setup='final'
46source='polyline'
47
48if setup =='trial':
49    print'trial'
50    res_factor=10
51    time_thinning=48
52    yieldstep=240
53if setup =='basic': 
54    print'basic'
55    res_factor=4
56    time_thinning=12
57    yieldstep=120
58if setup =='final': 
59    print'final'
60    res_factor=1
61    time_thinning=4
62    yieldstep=60
63
64dir_comment='_'+setup+'_'+str(tide)+'_'+str(source)+'_'+ 'alpha' +str(alpha)+'_'+str(user)
65
66# onshore data provided by WA DLI
67onshore_name = 'perth_dli_ext' # original
68#island
69island_name = 'rott_dli_ext' # original
70island_name1 = 'gard_dli_ext'
71island_name2 = 'carnac_island_dli_ext'
72island_name3 = 'penguin_dli_ext'
73
74# AHO + DPI data + colin French coastline
75coast_name = 'coastline_perthP'
76offshore_name = 'Perth_Clip'
77offshore_name1 = 'Perth_Chart'
78offshore_name2 = 'Fremantle_north'
79
80
81#final topo name
82combined_name ='perth_combined_elevation'
83combined_smaller_name = 'perth_combined_elevation_smaller'
84
85anuga_dir = home+state+sep+scenario+sep+'anuga'+sep
86
87topographies_in_dir = home+state+sep+scenario+sep+'elevation_final'+sep+'points'+sep
88topographies_dir = anuga_dir+'topographies'+sep
89#topographies_time_dir = topographies_dir+build_time+sep
90
91# input topo file location
92onshore_in_dir_name = topographies_in_dir + onshore_name
93island_in_dir_name = topographies_in_dir + island_name
94island_in_dir_name1 = topographies_in_dir + island_name1
95island_in_dir_name2 = topographies_in_dir + island_name2
96island_in_dir_name3 = topographies_in_dir + island_name3
97
98coast_in_dir_name = topographies_in_dir + coast_name
99offshore_in_dir_name = topographies_in_dir + offshore_name
100offshore_in_dir_name1 = topographies_in_dir + offshore_name1
101offshore_in_dir_name2 = topographies_in_dir + offshore_name2
102
103onshore_dir_name = topographies_dir + onshore_name
104island_dir_name = topographies_dir + island_name
105island_dir_name1 = topographies_dir + island_name1
106island_dir_name2 = topographies_dir + island_name2
107island_dir_name3 = topographies_dir + island_name3
108
109coast_dir_name = topographies_dir + coast_name
110offshore_dir_name = topographies_dir + offshore_name
111offshore_dir_name1 = topographies_dir + offshore_name1
112offshore_dir_name2 = topographies_dir + offshore_name2
113
114#final topo files
115combined_dir_name = topographies_dir + combined_name
116#combined_time_dir_name = topographies_time_dir + combined_name
117combined_smaller_name_dir = topographies_dir + combined_smaller_name
118#combined_time_dir_final_name = topographies_time_dir + combined_final_name
119
120meshes_dir = anuga_dir+'meshes'+sep
121meshes_dir_name = meshes_dir + scenario_name
122
123polygons_dir = anuga_dir+'polygons'+sep
124tide_dir = anuga_dir+'tide_data'+sep
125
126
127#boundaries_source = '1'
128   
129if source=='polyline':
130    boundaries_name = 'perth_3103_28052008' #polyline gun
131    boundaries_in_dir = anuga_dir+'boundaries'+sep+'urs'+sep+'polyline'+sep+'1_10000'+sep
132
133if source=='test':
134    boundaries_name = 'other' #polyline
135    boundaries_in_dir = anuga_dir+'boundaries'+sep
136
137
138#boundaries locations
139boundaries_in_dir_name = boundaries_in_dir + boundaries_name
140boundaries_dir = anuga_dir+'boundaries'+sep
141boundaries_dir_name = boundaries_dir + scenario_name # what it creates???
142boundaries_dir_mux = muxhome
143#boundaries_time_dir = anuga_dir+'boundaries'+sep+build_time+sep
144#boundaries_time_dir_name = boundaries_time_dir + boundaries_name  #Used by post processing
145
146#output locations
147output_dir = anuga_dir+'outputs'+sep
148output_build_time_dir = anuga_dir+'outputs'+sep+build_time+dir_comment+sep
149output_run_time_dir = anuga_dir+'outputs'+sep+run_time+dir_comment+sep
150output_run_time_dir_name = output_run_time_dir + scenario_name  #Used by post processing
151
152#gauges
153gauge_name = 'perth.csv'
154
155gauges_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'gauges'+sep
156beach_gauges = gauges_dir + 'beach_gauges.csv'
157gauges_dir_name = gauges_dir + gauge_name
158
159buildings_filename = gauges_dir + 'Perth_resA.csv'
160buildings_filename_out = 'Perth_res_Project_modified.csv'
161
162
163
164###############################
165# Interior region definitions
166###############################
167
168#Initial bounding polygon for data clipping
169poly_all = read_polygon(polygons_dir+'poly_all.csv')
170res_poly_all = 100000*res_factor
171
172#Polygon designed by 20m contours, or 3km from the coastline
173poly_internal_20_3 = read_polygon(polygons_dir+'internal_h20mORd3km.csv')
174res_internal_20_3 = 25000*res_factor
175
176#Polygon designed to cut out the rottnest island land.
177poly_rottnest_in = read_polygon(polygons_dir+'rottnest_internal.csv')
178res_rottnest_in = 100000*res_factor
179
180#Polygon designed to incorporate Garden Island and sand bank infront of Rockingham
181poly_garden_rockingham = read_polygon(polygons_dir+'garden_rockingham.csv')
182res_garden_rockingham = 1000*res_factor
183
184#Polygon designed to incorporate coastline of rottnest
185poly_rottnest_ex = read_polygon(polygons_dir+'rottnest_external.csv')
186res_rottnest_ex = 1000*res_factor
187
188#Polygon designed to incorporate perth and Fremantle CBD
189poly_cbd = read_polygon(polygons_dir+'CBD_coastal.csv')
190res_cbd = 500*res_factor
191
192#Polygon designed to incorporate rockingham and penguin island
193poly_rockingham = read_polygon(polygons_dir+'rockingham_penguin.csv')
194res_rockingham = 500*res_factor
195
196#Polygon designed to incorporate bottom of Garden Island for image verification
197poly_garden = read_polygon(polygons_dir+'garden.csv')
198res_garden = 500*res_factor
199
200poly_geordie_bay = read_polygon(polygons_dir+'geordie_bay.csv')
201res_geordie_bay = 500*res_factor
202
203poly_sorrento_gauge = read_polygon(polygons_dir+'sorrento_gauge.csv')
204res_sorrento_gauge = 500*res_factor
205
206
207#assert zone == refzone
208
209interior_regions = [[poly_internal_20_3,res_internal_20_3],[poly_cbd,res_cbd]
210                     ,[poly_garden_rockingham,res_garden_rockingham]
211                     ,[poly_rockingham,res_rockingham],[poly_geordie_bay,res_geordie_bay]
212                     ,[poly_sorrento_gauge,res_sorrento_gauge],[poly_rottnest_in, res_rottnest_in]
213                     ,[poly_rottnest_ex, res_rottnest_ex], [poly_garden, res_garden]]
214
215   
216trigs_min = number_mesh_triangles(interior_regions, poly_all, res_poly_all)
217print 'min number triangles', trigs_min
218   
219
220poly_mainland = read_polygon(polygons_dir+'initial_condition.csv')
221
222###################################################################
223# Clipping regions for export to asc and regions for clipping data
224###################################################################
225
226
227#Geordie Bay extract ascii grid
228xminGeordie = 358000
229xmaxGeordie = 362000
230yminGeordie = 6458500
231ymaxGeordie = 6461000
232
233#Sorrento extract ascii grid
234xminSorrento = 379000
235xmaxSorrento = 382500
236yminSorrento = 6477000
237ymaxSorrento = 6480000
238
239#Fremantle extract ascii grid
240xminFremantle = 376000
241xmaxFremantle = 388000
242yminFremantle = 6449000
243ymaxFremantle = 6461000
244
245#Rockingham extract ascii grid
246xminRockingham = 373500
247xmaxRockingham = 385500
248yminRockingham = 6424000
249ymaxRockingham = 6433000
250
Note: See TracBrowser for help on using the repository browser.