# -*- coding: cp1252 -*- """Common filenames and locations for topographic data, meshes and outputs. """ from os import sep, environ, getenv, getcwd from os.path import expanduser import sys from time import localtime, strftime, gmtime from anuga.utilities.polygon import read_polygon, plot_polygons, is_inside_polygon, number_mesh_triangles #from anuga.coordinate_transforms.redfearn import degminsec2decimal_degrees, convert_points_from_latlon_to_utm from anuga.utilities.system_tools import get_user_name, get_host_name # file and system info #--------------------------------- #codename = 'project.py' home = getenv('INUNDATIONHOME') + sep +'data'+sep #Sandpit's parent diruser = get_user_name() user = get_user_name() host = get_host_name() # INUNDATIONHOME is the inundation directory, not the data directory. #time stuff time = strftime('%Y%m%d_%H%M%S',localtime()) #gets time for new dir gtime = strftime('%Y%m%d_%H%M%S',gmtime()) #gets time for new dir build_time = time+'_build' run_time = time+'_run' print 'gtime: ', gtime #Making assumptions about the location of scenario data state = 'western_australia' scenario_name = 'perth' scenario = 'perth_tsunami_scenario' tide = 0.6 alpha = 0.1 friction=0.01 starttime=0 finaltime=80000 export_cellsize=25 setup='final' source='exmouth' if setup =='trial': print'trial' res_factor=10 time_thinning=48 yieldstep=240 if setup =='basic': print'basic' res_factor=4 time_thinning=12 yieldstep=120 if setup =='final': print'final' res_factor=1 time_thinning=4 yieldstep=60 dir_comment='_'+setup+'_'+str(tide)+'_'+str(source)+'_'+str(user) # onshore data provided by WA DLI onshore_name = 'perth_dli_ext' # original #island island_name = 'rott_dli_ext' # original island_name1 = 'gard_dli_ext' island_name2 = 'carnac_island_dted' island_name3 = 'penguin_dted' # AHO + DPI data + colin French coastline coast_name = 'coastline' offshore_name = 'perth_bathymetry' #final topo name combined_name ='perth_combined_elevation' combined_smaller_name = 'perth_combined_elevation_smaller' anuga_dir = home+state+sep+scenario+sep+'anuga'+sep topographies_in_dir = home+state+sep+scenario+sep+'elevation_final'+sep+'points'+sep topographies_dir = anuga_dir+'topographies'+sep #topographies_time_dir = topographies_dir+build_time+sep # input topo file location onshore_in_dir_name = topographies_in_dir + onshore_name island_in_dir_name = topographies_in_dir + island_name island_in_dir_name1 = topographies_in_dir + island_name1 island_in_dir_name2 = topographies_in_dir + island_name2 island_in_dir_name3 = topographies_in_dir + island_name3 coast_in_dir_name = topographies_in_dir + coast_name offshore_in_dir_name = topographies_in_dir + offshore_name onshore_dir_name = topographies_dir + onshore_name island_dir_name = topographies_dir + island_name island_dir_name1 = topographies_dir + island_name1 island_dir_name2 = topographies_dir + island_name2 island_dir_name3 = topographies_dir + island_name3 coast_dir_name = topographies_dir + coast_name offshore_dir_name = topographies_dir + offshore_name #final topo files combined_dir_name = topographies_dir + combined_name #combined_time_dir_name = topographies_time_dir + combined_name combined_smaller_name_dir = topographies_dir + combined_smaller_name #combined_time_dir_final_name = topographies_time_dir + combined_final_name meshes_dir = anuga_dir+'meshes'+sep meshes_dir_name = meshes_dir + scenario_name polygons_dir = anuga_dir+'polygons'+sep tide_dir = anuga_dir+'tide_data'+sep #boundaries_source = '1' if source=='exmouth': boundaries_name = 'perth_3103_28052008' #exmouth gun boundaries_in_dir = anuga_dir+'boundaries'+sep+'urs'+sep+'exmouth'+sep+'1_10000'+sep if source=='test': boundaries_name = 'other' #exmouth gun boundaries_in_dir = anuga_dir+'boundaries'+sep #boundaries locations boundaries_in_dir_name = boundaries_in_dir + boundaries_name boundaries_dir = anuga_dir+'boundaries'+sep boundaries_dir_name = boundaries_dir + scenario_name #boundaries_time_dir = anuga_dir+'boundaries'+sep+build_time+sep #boundaries_time_dir_name = boundaries_time_dir + boundaries_name #Used by post processing #output locations output_dir = anuga_dir+'outputs'+sep output_build_time_dir = anuga_dir+'outputs'+sep+build_time+dir_comment+sep output_run_time_dir = anuga_dir+'outputs'+sep+run_time+dir_comment+sep output_run_time_dir_name = output_run_time_dir + scenario_name #Used by post processing #gauges gauge_name = 'perth.csv' gauges_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'gauges'+sep beach_gauges = gauges_dir + 'beach_gauges.csv' gauges_dir_name = gauges_dir + gauge_name buildings_filename = gauges_dir + 'Perth_resA.csv' buildings_filename_out = 'Perth_res_Project_modified.csv' ############################### # Domain definitions ############################### from anuga.utilities.polygon import read_polygon, plot_polygons, polygon_area, is_inside_polygon poly_all = read_polygon(polygons_dir+'bounding_area.csv') res_poly_all = 100000*res_factor #refzone = 50 ############################### # Interior region definitions ############################### #Polygon designed by 20m contours, or 3km from the coastline poly_internal_20_3 = read_polygon(polygons_dir+'internal_h20mORd3km.csv') res_internal_20_3 = 25000*res_factor #Polygon designed to incorporate Garden Island and sand bank infront of Rockingham poly_garden_rockingham = read_polygon(polygons_dir+'garden_rockingham.csv') res_garden_rockingham = 1500*res_factor #Polygon designed to incorporate coastline of rottnest poly_rottnest_ex = read_polygon(polygons_dir+'rottnest_external.csv') res_rottnest_ex = 1000*res_factor #Polygon designed to cut out the rottnest island land. poly_rottnest_in = read_polygon(polygons_dir+'rottnest_internal.csv') res_rottnest_in = 25000*res_factor #Polygon designed to incorporate perth and Fremantle CBD poly_cbd = read_polygon(polygons_dir+'CBD_coastal.csv') res_cbd = 500*res_factor #Polygon designed to incorporate rockingham and penguin island poly_penguin = read_polygon(polygons_dir+'rockingham_penguin.csv') res_penguin = 500*res_factor poly_geordie_bay = read_polygon(polygons_dir+'Geordie_Bay.csv') res_geordie_bay = 500*res_factor poly_sorrento_gauge = read_polygon(polygons_dir+'Sorrento_gauge.csv') res_sorrento_gauge = 500*res_factor #assert zone == refzone interior_regions = [[poly_internal_20_3,res_internal_20_3],[poly_cbd,res_cbd] ,[poly_garden_rockingham,res_garden_rockingham] ,[poly_penguin,res_penguin],[poly_geordie_bay,res_geordie_bay] ,[poly_sorrento_gauge,res_sorrento_gauge],[poly_rottnest_in, res_rottnest_in] ,[poly_rottnest_ex, res_rottnest_ex]] boundary_tags={'back': [0,1,2], 'side': [3,7],'ocean': [4, 5, 6]} trigs_min = number_mesh_triangles(interior_regions, poly_all, res_poly_all) print 'min number triangles', trigs_min poly_mainland = read_polygon(polygons_dir+'Initial_Condition.csv') ################################################################### # Clipping regions for export to asc and regions for clipping data ################################################################### #Geordie Bay extract ascii grid xminGeordie = 358000 xmaxGeordie = 362000 yminGeordie = 6458500 ymaxGeordie = 6461000 #Sorrento extract ascii grid xminSorrento = 379000 xmaxSorrento = 382500 yminSorrento = 6477000 ymaxSorrento = 6480000 #Fremantle extract ascii grid xminFremantle = 376000 xmaxFremantle = 388000 yminFremantle = 6449000 ymaxFremantle = 6461000 #Rockingham extract ascii grid xminRockingham = 373500 xmaxRockingham = 385500 yminRockingham = 6424000 ymaxRockingham = 6433000