"""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 = 'exmouth' scenario = 'exmouth_tsunami_scenario' #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 = -1.4 #tide = 0 tide = 1.4 #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='final' #source='onslow' #source='dampier' 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 if setup =='store': print'store' res_factor=10 time_thinning=48 yieldstep=240 dir_comment='_'+setup+'_'+str(tide)+'_'+str(source)+'_'+str(user) onshore_name = 'DLI' onshore_name1 = 'DTED' # offshore offshore_name = 'Exmouth_bathymetry' #offshore_name1 = 'inferred_north' #offshore_name2 = 'inferred_south' coast_name = 'Exmouth_coastline' #final topo name combined_name ='exmouth_combined_elevation' #combined_name1 ='exmouth_combined_elevation1' #combined_name_unclipped1 ='exmouth_combined_elevation_unclipped1' combined_small_name = 'exmouth_combined_elevation_small' 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 # input topo file location onshore_in_dir_name = topographies_in_dir + onshore_name onshore1_in_dir_name = 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 onshore_dir_name = topographies_dir + onshore_name onshore1_dir_name = 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 #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_dir_name = 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 = 'exmouth_3854_17042007' #Dampier gun boundaries_in_dir = anuga_dir+'boundaries'+sep+'urs'+sep+'dampier'+sep+'1_10000'+sep if source=='onslow': boundaries_name = 'exmouth_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 = 'exmouth_3103_18052007' #exmouth gun boundaries_in_dir = anuga_dir+'boundaries'+sep+'urs'+sep+'exmouth'+sep+'1_10000'+sep #boundaries locations boundaries_source = '' #boundaries_in_dir = anuga_dir+'boundaries'+sep boundaries_in_dir_name = boundaries_in_dir + boundaries_name #output locations output_dir = anuga_dir+'outputs'+sep output_build_time_dir = output_dir+build_time+sep output_run_time_dir = output_dir +run_time+dir_comment+sep #output_run_time_dir = output_dir +'20070619_042140_run_final_0_onslow_nbartzis'+sep output_run_time_dir_name = output_run_time_dir + scenario_name #Used by post processing #gauges beach_gauges = 'beach_gauges.csv' gauge_name = 'exmouth_gauges.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 community_filename = gauges_dir + 'CHINS_v2.csv' community_exmouth = gauges_dir + 'community_exmouth.csv' buildings_filename = gauges_dir +'Exmouth_res_Project.csv' buildings_filename_out = output_run_time_dir +'Exmouth_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_more_points.csv') print 'Area of bounding polygon', polygon_area(poly_all)/1000000.0 res_poly_all = 150000*res_factor ############################### # Interior region definitions ############################### poly_coast = read_polygon(polygons_dir+'coast_new_pts.csv') #poly_coast = read_polygon(polygons_dir+'pts_coast.csv') res_coast = 10000*res_factor #poly_coast1 = read_polygon(polygons_dir+'pts_coast1.csv') #res_0 = 20000*res_factor poly_coast2 = read_polygon(polygons_dir+'coast2_new_pts.csv') #poly_coast2 = read_polygon(polygons_dir+'pts_coast2.csv') #res_0 = 20000*res_factor poly_coast3 = read_polygon(polygons_dir+'pts_coast3.csv') #res_0 = 20000*res_factor poly_exmouth = read_polygon(polygons_dir+'exmouth_new_pts.csv') #poly_exmouth = read_polygon(polygons_dir+'pts_exmouth.csv') res_exmouth = 500*res_factor poly_exmouth_south = read_polygon(polygons_dir+'exmouth_south_pts.csv') #res_exmouth = 500*res_factor poly_carpark1 = read_polygon(polygons_dir+'carpark1_pts.csv') #res_exmouth = 500*res_factor poly_carpark2 = read_polygon(polygons_dir+'carpark2_pts.csv') #res_exmouth = 500*res_factor poly_carpark3 = read_polygon(polygons_dir+'carpark3_pts.csv') #res_exmouth = 500*res_factor poly_nth_defence = read_polygon(polygons_dir+'pts_nth_defence.csv') res_nth_defence = 5000*res_factor poly_middle = read_polygon(polygons_dir+'middle_new_pts.csv') #poly_middle = read_polygon(polygons_dir+'pts_middle.csv') res_middle = 30000*res_factor poly_airport = read_polygon(polygons_dir+'pts_airport.csv') res_airport = 5000*res_factor interior_regions = [[poly_coast,res_coast],[poly_coast2,res_coast] ,[poly_coast3,res_coast],[poly_middle,res_middle],[poly_exmouth,res_exmouth] ,[poly_exmouth_south,res_exmouth],[poly_carpark1,res_exmouth],[poly_carpark2,res_exmouth] ,[poly_carpark3,res_exmouth],[poly_nth_defence,res_nth_defence],[poly_airport,res_airport]] 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 - Exmouth town area eastingmin = 200663 eastingmax = 207500 northingmax = 7574000 northingmin = 7564500 # exporting asc grid - carparks etc on NW peninsula e_min_area = 192700 e_max_area = 203755 n_max_area = 7587330 n_min_area = 7579460