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

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