# -*- coding: cp1252 -*- """Common filenames and locations for topographic data, meshes and outputs. Also includes origin for slump scenario. """ from os import sep, environ, getenv, getcwd,umask from os.path import expanduser, basename from anuga.utilities.polygon import read_polygon, plot_polygons, polygon_area, is_inside_polygon, number_mesh_triangles import sys from anuga.coordinate_transforms.redfearn import degminsec2decimal_degrees from time import localtime, strftime, gmtime from anuga.utilities.system_tools import get_user_name, get_host_name codename = 'project.py' home = getenv('INUNDATIONHOME') + sep +'data'+sep #Sandpit's parent dir user = get_user_name() host = get_host_name() #needed when running using mpirun, mpirun doesn't inherit umask from .bashrc umask(002) #Making assumptions about the location of scenario data state = 'western_australia' scenario_name = 'broome' scenario = 'broome_tsunami_scenario_2006' #time stuff time = strftime('%Y%m%d_%H%M%S',gmtime()) #gets time for new dir build_time = time+'_build' run_time = time+'_run' #tide = -5.3 #tide = 0 tide = 4.9 #Maybe will try to make project a class to allow these parameters to be passed in. alpha = 0.1 friction=0.01 starttime=3600 finaltime=25000 setup='trial' source='dampier' 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 from 30m DTED level 2 #onshore_name = 'Broome_topography_DLI' # original onshore_name = 'town_topo_10m' # original onshore_name1 = 'other_topo_250m' # original # offshore offshore_name = 'Broome_Bathymetry' #offshore_name1 = 'inferred_north' #offshore_name2 = 'inferred_south' offshore_name1 = 'north_250m' offshore_name2 = 'south_250m' offshore_name3 = 'cable_250m' coast_name = 'Broome_coastline' #final topo name combined_name ='broome_combined_elevation' combined_name1 ='broome_combined_elevation1' combined_name_unclipped1 ='broome_combined_elevation_unclipped1' combined_small_name = 'broome_combined_elevation_z51_reduced' anuga_dir = home+state+sep+scenario+sep+'anuga'+sep topographies_in_dir = home+state+sep+scenario+sep+'elevation_final'+sep+'points'+sep+'Feb07'+sep topographies_dir = anuga_dir+'topographies'+sep # input topo file location onshore_in_dir_name = topographies_in_dir + onshore_name onshore_in_dir_name1 = topographies_in_dir + onshore_name1 coast_in_dir_name = topographies_in_dir + coast_name offshore_in_dir_name = topographies_in_dir + offshore_name offshore_in_dir_name1 = topographies_in_dir + offshore_name1 offshore_in_dir_name2 = topographies_in_dir + offshore_name2 offshore_in_dir_name3 = topographies_in_dir + offshore_name3 onshore_dir_name = topographies_dir + onshore_name onshore_dir_name1 = topographies_dir + onshore_name1 coast_dir_name = topographies_dir + coast_name offshore_dir_name = topographies_dir + offshore_name offshore_dir_name1 = topographies_dir + offshore_name1 offshore_dir_name2 = topographies_dir + offshore_name2 offshore_dir_name3 = topographies_dir + offshore_name3 #final topo files combined_dir_name = topographies_dir + combined_name combined_dir_name_unclipped1 = topographies_dir + combined_name_unclipped1 combined_dir_name1 = topographies_dir + combined_name1 combined_small_name_dir = topographies_dir + combined_small_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 if source =='dampier': boundaries_name = 'broome_3854_17042007' #Dampier gun boundaries_in_dir = anuga_dir+'boundaries'+sep+'urs'+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+'urs'+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+'urs'+sep+'exmouth'+sep+'1_10000'+sep boundaries_in_dir_name = boundaries_in_dir + boundaries_name boundaries_dir = anuga_dir+'boundaries'+sep boundaries_dir_name = boundaries_dir + boundaries_name #output locations output_dir = anuga_dir+'outputs'+sep output_build_time_dir = output_dir+build_time+'_'+source+sep output_run_time_dir = output_dir +run_time+dir_comment+sep #output_run_time_dir = output_dir +'20070703_062312_run_final_4.9_dampier_nbartzis'+sep output_run_time_dir_name = output_run_time_dir + scenario_name #Used by post processing #gauges gauge_name = 'broome_gauges.csv' gauges_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'gauges'+sep gauges_dir_name = gauges_dir + gauge_name community_filename = gauges_dir + 'CHINS_v2.csv' community_broome = gauges_dir + 'community_broome.csv' buildings_filename = gauges_dir + 'Broome_res_Project.csv' buildings_filename_out = output_run_time_dir+'Broome_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_small.csv') # to test update of plot_polygons - now allows points and polygon to be # plotted together #point = read_polygon(polygons_dir+'neg20_coast_contour_pts.csv') #p2 = read_polygon(polygons_dir+'broome_north_coast_inside_extent.csv') #label=None #plot_polygons([poly_all,point,p2],['line','point','outside'],figname='test',label=label) #plot_polygons([poly_all,point],figname='test') #poly_all = read_polygon(polygons_dir+'extent.csv') res_poly_all = 150000*res_factor ############################### # Interior region definitions ############################### poly_0 = read_polygon(polygons_dir+'neg20_coast_contour_pts.csv') res_0 = 20000*res_factor poly_1 = read_polygon(polygons_dir+'broome_north_coast_inside_extent.csv') res_1 = 5000*res_factor #poly_2 = read_polygon(polygons_dir+'broome_south_coast_inside_extent.csv') poly_2 = read_polygon(polygons_dir+'broome_south_coast_not_town_pts_new.csv') res_2 = 5000*res_factor #poly_3 = read_polygon(polygons_dir+'Broome_town_pts.csv') poly_3 = read_polygon(polygons_dir+'broome_town_new_ptsa.csv') res_3 = 2000*res_factor #poly_4 = read_polygon(polygons_dir+'Broome_inner_town_pts.csv') poly_4 = read_polygon(polygons_dir+'broome_inner_town_new_ptsa.csv') res_4 = 500*res_factor interior_regions = [[poly_0,res_0],[poly_1,res_1],[poly_2,res_2] ,[poly_3,res_3],[poly_4,res_4]] boundary_tags={'back': [1, 2], 'side': [0,3], 'ocean': [4]} 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 ################################################################### # exporting asc grid eastingmin = 412000.0 eastingmax = 423000.0 northingmin = 8007000.0 northingmax = 8022000.0 # exporting asc grid for speed #eastingmin = 412900.0 #eastingmax = 422700.0 #northingmin = 8008555.0 #northingmax = 8021350.0