# -*- 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 from anuga.shallow_water.data_manager import urs2sts,create_sts_boundary from anuga.utilities.polygon import read_polygon, plot_polygons, polygon_area, is_inside_polygon # file and system info #--------------------------------- #codename = 'project.py' home = getenv('INUNDATIONHOME') + sep +'data'+sep #Sandpit's parent diruser = get_user_name() muxhome = getenv('MUXHOME') 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_44unitsources' scenario_name = 'perth' scenario = 'perth_tsunami_scenario' tide = 0.0 #0.6 alpha = 0.1 friction=0.01 starttime=0 finaltime=80000 export_cellsize=25 setup='final' source='polyline' 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)+'_'+ 'alpha' +str(alpha)+'_'+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_dli_ext' island_name3 = 'penguin_dli_ext' # AHO + DPI data + colin French coastline coast_name = 'coastline_perthP' offshore_name = 'Perth_Clip' offshore_name1 = 'Perth_Chart' offshore_name2 = 'Fremantle_north' #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 # 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 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 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 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_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=='polyline': boundaries_name = 'perth_3103_28052008' #polyline gun boundaries_in_dir = anuga_dir+'boundaries'+sep+'urs'+sep+'polyline'+sep+'1_10000'+sep if source=='test': boundaries_name = 'other' #polyline 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 # what it creates??? boundaries_dir_mux = muxhome #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 vertex_filename = output_run_time_dir + 'mesh_vertex.csv' #gauges gauge_name = 'perth.csv' gauge_name2 = 'thinned_MGA50.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 gauges_dir_name2 = gauges_dir + gauge_name2 buildings_filename = gauges_dir + 'Perth_resA.csv' buildings_filename_out = 'Perth_res_Project_modified.csv' ############################### # Interior region definitions ############################### #Initial bounding polygon for data clipping poly_all = read_polygon(polygons_dir+'poly_all.csv') res_poly_all = 100000*res_factor #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 cut out the rottnest island land. poly_rottnest_in = read_polygon(polygons_dir+'rottnest_internal.csv') res_rottnest_in = 100000*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 = 1000*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 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_rockingham = read_polygon(polygons_dir+'rockingham_penguin.csv') res_rockingham = 500*res_factor #Polygon designed to incorporate bottom of Garden Island for image verification poly_garden = read_polygon(polygons_dir+'garden.csv') res_garden = 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 #Polygon designed to incorporate Dredge Area from Fremantle to #Rockingham the steep incline was making the mesh go to 0 poly_dredge = read_polygon(polygons_dir+'DredgeArea.csv') res_dredge = 1000*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_rockingham,res_rockingham],[poly_geordie_bay,res_geordie_bay] ,[poly_sorrento_gauge,res_sorrento_gauge],[poly_rottnest_in, res_rottnest_in] ,[poly_rottnest_ex, res_rottnest_ex], [poly_garden, res_garden] ,[poly_dredge, res_dredge]] 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