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

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