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

Last change on this file since 5569 was 5569, checked in by kristy, 11 years ago

updated scripts for polyline boundary

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.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
82
83#final topo name
84combined_name ='perth_combined_elevation'
85combined_smaller_name = 'perth_combined_elevation_smaller'
86
87anuga_dir = home+state+sep+scenario+sep+'anuga'+sep
88
89topographies_in_dir = home+state+sep+scenario+sep+'elevation_final'+sep+'points'+sep
90topographies_dir = anuga_dir+'topographies'+sep
91#topographies_time_dir = topographies_dir+build_time+sep
92
93# input topo file location
94onshore_in_dir_name = topographies_in_dir + onshore_name
95island_in_dir_name = topographies_in_dir + island_name
96island_in_dir_name1 = topographies_in_dir + island_name1
97island_in_dir_name2 = topographies_in_dir + island_name2
98island_in_dir_name3 = topographies_in_dir + island_name3
99
100coast_in_dir_name = topographies_in_dir + coast_name
101offshore_in_dir_name = topographies_in_dir + offshore_name
102offshore_in_dir_name1 = topographies_in_dir + offshore_name1
103offshore_in_dir_name2 = topographies_in_dir + offshore_name2
104
105onshore_dir_name = topographies_dir + onshore_name
106island_dir_name = topographies_dir + island_name
107island_dir_name1 = topographies_dir + island_name1
108island_dir_name2 = topographies_dir + island_name2
109island_dir_name3 = topographies_dir + island_name3
110
111coast_dir_name = topographies_dir + coast_name
112offshore_dir_name = topographies_dir + offshore_name
113offshore_dir_name1 = topographies_dir + offshore_name1
114offshore_dir_name2 = topographies_dir + offshore_name2
115
116#final topo files
117combined_dir_name = topographies_dir + combined_name
118#combined_time_dir_name = topographies_time_dir + combined_name
119combined_smaller_name_dir = topographies_dir + combined_smaller_name
120#combined_time_dir_final_name = topographies_time_dir + combined_final_name
121
122meshes_dir = anuga_dir+'meshes'+sep
123meshes_dir_name = meshes_dir + scenario_name
124
125polygons_dir = anuga_dir+'polygons'+sep
126tide_dir = anuga_dir+'tide_data'+sep
127
128
129#boundaries_source = '1'
130   
131if source=='polyline':
132    boundaries_name = 'perth_3103_28052008' #polyline gun
133    boundaries_in_dir = anuga_dir+'boundaries'+sep+'urs'+sep+'polyline'+sep+'1_10000'+sep
134
135if source=='test':
136    boundaries_name = 'other' #polyline
137    boundaries_in_dir = anuga_dir+'boundaries'+sep
138
139
140#boundaries locations
141boundaries_in_dir_name = boundaries_in_dir + boundaries_name
142boundaries_dir = anuga_dir+'boundaries'+sep
143boundaries_dir_name = boundaries_dir + scenario_name # what it creates???
144boundaries_dir_mux = muxhome
145#boundaries_time_dir = anuga_dir+'boundaries'+sep+build_time+sep
146#boundaries_time_dir_name = boundaries_time_dir + boundaries_name  #Used by post processing
147
148#output locations
149output_dir = anuga_dir+'outputs'+sep
150output_build_time_dir = anuga_dir+'outputs'+sep+build_time+dir_comment+sep
151output_run_time_dir = anuga_dir+'outputs'+sep+run_time+dir_comment+sep
152output_run_time_dir_name = output_run_time_dir + scenario_name  #Used by post processing
153
154#gauges
155gauge_name = 'perth.csv'
156
157gauges_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'gauges'+sep
158beach_gauges = gauges_dir + 'beach_gauges.csv'
159gauges_dir_name = gauges_dir + gauge_name
160
161buildings_filename = gauges_dir + 'Perth_resA.csv'
162buildings_filename_out = 'Perth_res_Project_modified.csv'
163
164
165
166###############################
167# Interior region definitions
168###############################
169
170#Initial bounding polygon for data clipping
171poly_all = read_polygon(polygons_dir+'poly_all.csv')
172res_poly_all = 100000*res_factor
173
174#Polygon designed by 20m contours, or 3km from the coastline
175poly_internal_20_3 = read_polygon(polygons_dir+'internal_h20mORd3km.csv')
176res_internal_20_3 = 25000*res_factor
177
178#Polygon designed to cut out the rottnest island land.
179poly_rottnest_in = read_polygon(polygons_dir+'rottnest_internal.csv')
180res_rottnest_in = 100000*res_factor
181
182#Polygon designed to incorporate Garden Island and sand bank infront of Rockingham
183poly_garden_rockingham = read_polygon(polygons_dir+'garden_rockingham.csv')
184res_garden_rockingham = 1000*res_factor
185
186#Polygon designed to incorporate coastline of rottnest
187poly_rottnest_ex = read_polygon(polygons_dir+'rottnest_external.csv')
188res_rottnest_ex = 1000*res_factor
189
190#Polygon designed to incorporate perth and Fremantle CBD
191poly_cbd = read_polygon(polygons_dir+'CBD_coastal.csv')
192res_cbd = 500*res_factor
193
194#Polygon designed to incorporate rockingham and penguin island
195poly_rockingham = read_polygon(polygons_dir+'rockingham_penguin.csv')
196res_rockingham = 500*res_factor
197
198#Polygon designed to incorporate bottom of Garden Island for image verification
199poly_garden = read_polygon(polygons_dir+'garden.csv')
200res_garden = 500*res_factor
201
202poly_geordie_bay = read_polygon(polygons_dir+'geordie_bay.csv')
203res_geordie_bay = 500*res_factor
204
205poly_sorrento_gauge = read_polygon(polygons_dir+'sorrento_gauge.csv')
206res_sorrento_gauge = 500*res_factor
207
208
209#assert zone == refzone
210
211interior_regions = [[poly_internal_20_3,res_internal_20_3],[poly_cbd,res_cbd]
212                     ,[poly_garden_rockingham,res_garden_rockingham]
213                     ,[poly_rockingham,res_rockingham],[poly_geordie_bay,res_geordie_bay]
214                     ,[poly_sorrento_gauge,res_sorrento_gauge],[poly_rottnest_in, res_rottnest_in]
215                     ,[poly_rottnest_ex, res_rottnest_ex], [poly_garden, res_garden]]
216
217   
218trigs_min = number_mesh_triangles(interior_regions, poly_all, res_poly_all)
219print 'min number triangles', trigs_min
220   
221
222poly_mainland = read_polygon(polygons_dir+'initial_condition.csv')
223
224###################################################################
225# Clipping regions for export to asc and regions for clipping data
226###################################################################
227
228
229#Geordie Bay extract ascii grid
230xminGeordie = 358000
231xmaxGeordie = 362000
232yminGeordie = 6458500
233ymaxGeordie = 6461000
234
235#Sorrento extract ascii grid
236xminSorrento = 379000
237xmaxSorrento = 382500
238yminSorrento = 6477000
239ymaxSorrento = 6480000
240
241#Fremantle extract ascii grid
242xminFremantle = 376000
243xmaxFremantle = 388000
244yminFremantle = 6449000
245ymaxFremantle = 6461000
246
247#Rockingham extract ascii grid
248xminRockingham = 373500
249xmaxRockingham = 385500
250yminRockingham = 6424000
251ymaxRockingham = 6433000
252
Note: See TracBrowser for help on using the repository browser.