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

Last change on this file since 5626 was 5626, checked in by kristy, 16 years ago

Updated

File size: 8.6 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
[5569]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
[3908]14
[4077]15# file and system info
16#---------------------------------
[5111]17#codename = 'project.py'
[3908]18
[5111]19home = getenv('INUNDATIONHOME') + sep +'data'+sep #Sandpit's parent diruser = get_user_name()
[5467]20muxhome = getenv('MUXHOME')
[4077]21user = get_user_name()
[5111]22host = get_host_name()
[3908]23
24# INUNDATIONHOME is the inundation directory, not the data directory.
25
[4080]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
[3908]33#Making assumptions about the location of scenario data
34state = 'western_australia'
[5592]35#scenario_name = 'perth_44unitsources'
[4077]36scenario_name = 'perth'
[5111]37scenario = 'perth_tsunami_scenario'
[3908]38
[5607]39
[5581]40tide = 0.0 #0.6
[5111]41
[5607]42alpha = 0.1
[5111]43friction=0.01
[5415]44starttime=0
[5558]45finaltime=80000 
[5415]46export_cellsize=25
[5569]47setup='final'
[5558]48source='polyline'
[5111]49
50if setup =='trial':
51    print'trial'
52    res_factor=10
53    time_thinning=48
54    yieldstep=240
55if setup =='basic': 
56    print'basic'
57    res_factor=4
58    time_thinning=12
59    yieldstep=120
60if setup =='final': 
61    print'final'
62    res_factor=1
63    time_thinning=4
64    yieldstep=60
65
[5558]66dir_comment='_'+setup+'_'+str(tide)+'_'+str(source)+'_'+ 'alpha' +str(alpha)+'_'+str(user)
[5111]67
[3908]68# onshore data provided by WA DLI
[4077]69onshore_name = 'perth_dli_ext' # original
70#island
71island_name = 'rott_dli_ext' # original
72island_name1 = 'gard_dli_ext'
[5491]73island_name2 = 'carnac_island_dli_ext'
[5489]74island_name3 = 'penguin_dli_ext'
[3908]75
[4147]76# AHO + DPI data + colin French coastline
[5523]77coast_name = 'coastline_perthP'
[5499]78offshore_name = 'Perth_Clip'
[5523]79offshore_name1 = 'Perth_Chart'
80offshore_name2 = 'Fremantle_north'
[3908]81
[5357]82
[4077]83#final topo name
84combined_name ='perth_combined_elevation'
[4091]85combined_smaller_name = 'perth_combined_elevation_smaller'
[3908]86
[5111]87anuga_dir = home+state+sep+scenario+sep+'anuga'+sep
[4091]88
[5360]89topographies_in_dir = home+state+sep+scenario+sep+'elevation_final'+sep+'points'+sep
[5111]90topographies_dir = anuga_dir+'topographies'+sep
[5122]91#topographies_time_dir = topographies_dir+build_time+sep
[3908]92
[4147]93# input topo file location
[4080]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
[5523]102offshore_in_dir_name1 = topographies_in_dir + offshore_name1
103offshore_in_dir_name2 = topographies_in_dir + offshore_name2
[4080]104
[4077]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
[4080]109island_dir_name3 = topographies_dir + island_name3
[3908]110
[4077]111coast_dir_name = topographies_dir + coast_name
112offshore_dir_name = topographies_dir + offshore_name
[5523]113offshore_dir_name1 = topographies_dir + offshore_name1
114offshore_dir_name2 = topographies_dir + offshore_name2
[4077]115
116#final topo files
117combined_dir_name = topographies_dir + combined_name
[5122]118#combined_time_dir_name = topographies_time_dir + combined_name
[4091]119combined_smaller_name_dir = topographies_dir + combined_smaller_name
[4080]120#combined_time_dir_final_name = topographies_time_dir + combined_final_name
[4077]121
[5111]122meshes_dir = anuga_dir+'meshes'+sep
123meshes_dir_name = meshes_dir + scenario_name
[4077]124
[5111]125polygons_dir = anuga_dir+'polygons'+sep
126tide_dir = anuga_dir+'tide_data'+sep
[3908]127
128
[5111]129#boundaries_source = '1'
130   
[5558]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
[5111]134
135if source=='test':
[5558]136    boundaries_name = 'other' #polyline
[5111]137    boundaries_in_dir = anuga_dir+'boundaries'+sep
138
139
[4077]140#boundaries locations
[5387]141boundaries_in_dir_name = boundaries_in_dir + boundaries_name
[5111]142boundaries_dir = anuga_dir+'boundaries'+sep
[5467]143boundaries_dir_name = boundaries_dir + scenario_name # what it creates???
144boundaries_dir_mux = muxhome
[5111]145#boundaries_time_dir = anuga_dir+'boundaries'+sep+build_time+sep
[4077]146#boundaries_time_dir_name = boundaries_time_dir + boundaries_name  #Used by post processing
[3908]147
[4077]148#output locations
[5111]149output_dir = anuga_dir+'outputs'+sep
[5122]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
[4077]152output_run_time_dir_name = output_run_time_dir + scenario_name  #Used by post processing
153
[5607]154
155vertex_filename = output_run_time_dir + 'mesh_vertex.csv'
156
[4077]157#gauges
158gauge_name = 'perth.csv'
[5626]159gauge_name2 = 'thinned_MGA50+1.csv'
[5415]160
161gauges_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'gauges'+sep
162beach_gauges = gauges_dir + 'beach_gauges.csv'
[4077]163gauges_dir_name = gauges_dir + gauge_name
[5592]164gauges_dir_name2 = gauges_dir + gauge_name2
[4077]165
[5381]166buildings_filename = gauges_dir + 'Perth_resA.csv'
[4477]167buildings_filename_out = 'Perth_res_Project_modified.csv'
[4077]168
[5569]169
170
[3908]171###############################
[5569]172# Interior region definitions
[3908]173###############################
174
[5569]175#Initial bounding polygon for data clipping
[5489]176poly_all = read_polygon(polygons_dir+'poly_all.csv')
[5111]177res_poly_all = 100000*res_factor
[3908]178
[5357]179#Polygon designed by 20m contours, or 3km from the coastline
[5360]180poly_internal_20_3 = read_polygon(polygons_dir+'internal_h20mORd3km.csv')
[5432]181res_internal_20_3 = 25000*res_factor
[4077]182
[5489]183#Polygon designed to cut out the rottnest island land.
184poly_rottnest_in = read_polygon(polygons_dir+'rottnest_internal.csv')
[5523]185res_rottnest_in = 100000*res_factor
[5489]186
[5357]187#Polygon designed to incorporate Garden Island and sand bank infront of Rockingham
188poly_garden_rockingham = read_polygon(polygons_dir+'garden_rockingham.csv')
[5523]189res_garden_rockingham = 1000*res_factor
[5357]190
191#Polygon designed to incorporate coastline of rottnest
[5360]192poly_rottnest_ex = read_polygon(polygons_dir+'rottnest_external.csv')
193res_rottnest_ex = 1000*res_factor
[5357]194
195#Polygon designed to incorporate perth and Fremantle CBD
196poly_cbd = read_polygon(polygons_dir+'CBD_coastal.csv')
[5111]197res_cbd = 500*res_factor
[4077]198
[5357]199#Polygon designed to incorporate rockingham and penguin island
[5489]200poly_rockingham = read_polygon(polygons_dir+'rockingham_penguin.csv')
201res_rockingham = 500*res_factor
[5111]202
[5489]203#Polygon designed to incorporate bottom of Garden Island for image verification
204poly_garden = read_polygon(polygons_dir+'garden.csv')
205res_garden = 500*res_factor
206
207poly_geordie_bay = read_polygon(polygons_dir+'geordie_bay.csv')
[5111]208res_geordie_bay = 500*res_factor
209
[5489]210poly_sorrento_gauge = read_polygon(polygons_dir+'sorrento_gauge.csv')
[5111]211res_sorrento_gauge = 500*res_factor
[5489]212
[5626]213#Polygon designed to incorporate Dredge Area from Fremantle to
214#Rockingham the steep incline was making the mesh go to 0
215poly_dredge = read_polygon(polygons_dir+'DredgeArea.csv')
216res_dredge = 1000*res_factor
[5489]217
[4080]218#assert zone == refzone
[4077]219
[5357]220interior_regions = [[poly_internal_20_3,res_internal_20_3],[poly_cbd,res_cbd]
221                     ,[poly_garden_rockingham,res_garden_rockingham]
[5489]222                     ,[poly_rockingham,res_rockingham],[poly_geordie_bay,res_geordie_bay]
[5360]223                     ,[poly_sorrento_gauge,res_sorrento_gauge],[poly_rottnest_in, res_rottnest_in]
[5626]224                     ,[poly_rottnest_ex, res_rottnest_ex], [poly_garden, res_garden]
225                     ,[poly_dredge, res_dredge]]
[4077]226
[5569]227   
[4133]228trigs_min = number_mesh_triangles(interior_regions, poly_all, res_poly_all)
[4091]229print 'min number triangles', trigs_min
[5569]230   
[4081]231
[5489]232poly_mainland = read_polygon(polygons_dir+'initial_condition.csv')
[5386]233
[3908]234###################################################################
235# Clipping regions for export to asc and regions for clipping data
236###################################################################
[4091]237
[3908]238
[5408]239#Geordie Bay extract ascii grid
[5446]240xminGeordie = 358000
241xmaxGeordie = 362000
242yminGeordie = 6458500
243ymaxGeordie = 6461000
[3908]244
[5408]245#Sorrento extract ascii grid
[5446]246xminSorrento = 379000
247xmaxSorrento = 382500
248yminSorrento = 6477000
249ymaxSorrento = 6480000
[3908]250
[5446]251#Fremantle extract ascii grid
252xminFremantle = 376000
253xmaxFremantle = 388000
254yminFremantle = 6449000
255ymaxFremantle = 6461000
[5408]256
257#Rockingham extract ascii grid
[5446]258xminRockingham = 373500
259xmaxRockingham = 385500
260yminRockingham = 6424000
261ymaxRockingham = 6433000
[5408]262
Note: See TracBrowser for help on using the repository browser.