# -*- 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 = 'sw_pacific' scenario_name = 'Tonga_slide' scenario = 'tonga' tide = 0 alpha = 0.1 friction=0.01 starttime=10000 midtime=21600 finaltime=10000 export_cellsize=50 setup='trial' source='test' 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(scenario_name)+'_'+str(user) # onshore data 5m countour onshore_name = 'topography_tongatapu' # original' # AHO + DPI data + colin French coastline #coast_name = 'waterline' Singlebeam_name = 'Tongatapu_SB_5m grid' Multibeam_name = 'Tongatapu_MB_30m grid' Chart_name= 'Tongatapu_Chart' Derived_bath_name= 'Derived_Bathy' added_data_name='joining_eastIsland_toreef' #final topo name combined_name ='Tongatapu_combined_elevation' combined_smaller_name = 'Tongatapu_combined_elevation_smaller' anuga_dir = home+state+sep+scenario+sep+'anuga'+sep topographies_in_dir = home+sep+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 Singlebeam_in_dir_name = topographies_in_dir + Singlebeam_name Multibeam_in_dir_name = topographies_in_dir + Multibeam_name Chart_in_dir_name = topographies_in_dir + Chart_name Derived_bath_in_dir_name = topographies_in_dir + Derived_bath_name added_data_in_dir_name = topographies_in_dir + added_data_name onshore_dir_name = topographies_dir + onshore_name Singlebeam_dir_name = topographies_dir + Singlebeam_name Multibeam_dir_name = topographies_dir + Multibeam_name Chart_dir_name = topographies_dir + Chart_name Derived_bath_dir_name = topographies_dir + Derived_bath_name added_data_dir_name = topographies_dir + added_data_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 =='dampier': boundaries_name = 'broome_3854_17042007' #Dampier gun boundaries_in_dir = anuga_dir+'boundaries'+sep+sep+'dampier'+sep+'1_10000'+sep if source=='onslow': boundaries_name = 'broome_3859_16052007' #onslow_hedland_broome gun boundaries_in_dir = anuga_dir+'boundaries'+sep+sep+'onslow_hedland_broome'+sep+'1_10000'+sep if source=='exmouth': boundaries_name = 'broome_3103_18052007' #exmouth gun boundaries_in_dir = anuga_dir+'boundaries'+sep+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 + scenario_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 = anuga_dir+'gauges'+sep #gauges_dir_name = gauges_dir + gauge_name #buildings_filename = gauges_dir + 'Perth_res_Project.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+'extent.txt') res_poly_all = 40000*res_factor #refzone = 50 ############################### # Interior region definitions ############################### poly_tongatapu = read_polygon(polygons_dir+'finres.txt') poly_island1 = read_polygon(polygons_dir+'island1.txt') poly_island2 = read_polygon(polygons_dir+'island2.txt') poly_island3 = read_polygon(polygons_dir+'island3.txt') poly_island4 = read_polygon(polygons_dir+'island4.txt') poly_island5= read_polygon(polygons_dir+'island5.txt') poly_island6= read_polygon(polygons_dir+'island6.txt') poly_island7= read_polygon(polygons_dir+'island7.txt') poly_island8= read_polygon(polygons_dir+'island8.txt') poly_island9= read_polygon(polygons_dir+'island9.txt') poly_island10= read_polygon(polygons_dir+'island10.txt') poly_island11= read_polygon(polygons_dir+'island11.txt') poly_island12= read_polygon(polygons_dir+'island12.txt') poly_island13= read_polygon(polygons_dir+'island13.txt') islands_res = 5000 tongatapu_res = 5000 interior_regions = [[poly_tongatapu, tongatapu_res], [poly_island1, islands_res], [poly_island2, islands_res], [poly_island3, islands_res], [poly_island4, islands_res], [poly_island5, islands_res], [poly_island6, islands_res], [poly_island7, islands_res], [poly_island8, islands_res], [poly_island9, islands_res], [poly_island10, islands_res], [poly_island11, islands_res], [poly_island12, islands_res], [poly_island13, islands_res]] boundary_tags={'ocean_east':[0], 'ocean_north':[1], 'ocean_west':[2,3], 'land':[4,5,6,7,8,9,10,11,12,13,14], 'ocean_southeast':[15,16]} trigs_min = number_mesh_triangles(interior_regions, poly_all, res_poly_all) print 'min number triangles', trigs_min ################################################################### # Clipping regions for export to asc and regions for clipping data ################################################################### # exporting asc grid eastingmin = 670500 eastingmax = 712750 northingmin = 7646000 northingmax = 7677000 slide_origin = [701290, 7665750] # move onto the continental shelf, depth = 500 slide_depth = 207.