"""Common filenames and locations for elevation, meshes and outputs. This script is the heart of all scripts in the folder """ #------------------------------------------------------------------------------ # Import necessary modules #------------------------------------------------------------------------------ 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.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 #------------------------------------------------------------------------------ # Directory setup #------------------------------------------------------------------------------ # Note: INUNDATIONHOME is the inundation directory, not the data directory. home = getenv('INUNDATIONHOME') + sep +'data'+sep #Sandpit's parent diruser = get_user_name() muxhome = getenv('MUXHOME') user = get_user_name() host = get_host_name() # determines time for setting up output directories time = strftime('%Y%m%d_%H%M%S',localtime()) gtime = strftime('%Y%m%d_%H%M%S',gmtime()) build_time = time+'_build' run_time = time+'_run' #------------------------------------------------------------------------------ # Initial Conditions #------------------------------------------------------------------------------ # this section needs to be updated to reflect the modelled community. # Note, the user needs to set up the directory system accordingly state = 'western_australia' scenario_name = 'perth' scenario = 'perth_tsunami_scenario' # Model specific parameters. One or all can be changed each time the # run_scenario script is executed tide = 0.6 #0.6 event_number = 27255 # Java 9.3 worst case for Perth #event_number = 68693 # Sumatra 9.2 #event_number = 27283 # Java 9.3 original alpha = 0.1 # smoothing parameter for mesh friction=0.01 # manning's friction coefficient starttime=0 finaltime=80000 # final time for simulation setup='final' # Final can be replaced with trial or basic. # Either will result in a coarser mesh that will allow a # faster, but less accurate, simulation. 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 #------------------------------------------------------------------------------ # Output Filename #------------------------------------------------------------------------------ # Important to distinguish each run - ensure str(user) is included! # Note, the user is free to include as many parameters as desired dir_comment='_'+setup+'_'+str(tide)+'_'+str(event_number)+'_'+ 'Rottnest_'+str(user) #------------------------------------------------------------------------------ # Input Data #------------------------------------------------------------------------------ # elevation data used in build_perth.py # onshore data: format ascii grid with accompanying projection file onshore_name = 'perth_dli_ext' # island: format ascii grid with accompanying projection file island_name = 'rott_dli_ext' island_name1 = 'gard_dli_ext' island_name2 = 'carnac_island_dli_ext' island_name3 = 'penguin_dli_ext' # coastline: format x,y,elevation (with title) coast_name = 'coastline_perthP.txt' # bathymetry: format x,y,elevation (with title) offshore_name = 'Perth.txt' offshore_name1 = 'Perth_Chart.txt' offshore_name2 = 'Fremantle_north.txt' offshore_name3 = 'port_swanriver.txt' # gauges - used in get_timeseries.py ##gauge_name = 'perth.csv' gauge_name = 'MH_gauges2.csv' #buildings - used in run_building_inundation.py building = 'perth_res_combined' # BOUNDING POLYGON - used in build_boundary.py and run_perth.py respectively # NOTE: when files are put together the points must be in sequence - for ease go clockwise! # Check the run_perth.py for boundary_tags # thinned ordering file from Hazard Map: format is index,latitude,longitude (with title) order_filename = 'thinned_boundary_ordering.csv' #landward bounding points landward = 'landward_bounding_polygon.csv' #------------------------------------------------------------------------------ # Output Elevation Data #------------------------------------------------------------------------------ # Output filename for elevation # this is a combination of all the data (utilisied in build_boundary) combined_name ='perth_combined_elevation' combined_smaller_name = 'perth_combined_elevation_smaller' #------------------------------------------------------------------------------ # Directory Structure #------------------------------------------------------------------------------ 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 polygons_dir = anuga_dir+'polygons'+sep tide_dir = anuga_dir+'tide_data'+sep boundaries_dir = anuga_dir+'boundaries'+ sep output_dir = anuga_dir+'outputs'+sep gauges_dir = anuga_dir+'gauges'+sep meshes_dir = anuga_dir+'meshes'+sep #------------------------------------------------------------------------------ # Location of input and output data #------------------------------------------------------------------------------ # where the input data sits 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 offshore_in_dir_name3 = topographies_in_dir + offshore_name3 # where the output data sits 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 offshore_dir_name3 = topographies_dir + offshore_name3 # where the combined elevation file sits combined_dir_name = topographies_dir + combined_name combined_smaller_name_dir = topographies_dir + combined_smaller_name # where the mesh sits (this is created during the run_perth.py) meshes_dir_name = meshes_dir + scenario_name+'_rottnest.msh' # where the boundary ordering files sit (this is used within build_boundary.py) order_filename_dir = boundaries_dir + order_filename # where the landward points of boundary extent sit (this is used within run_perth.py) landward_dir = boundaries_dir + landward # where the event sts files sits (this is created during the build_boundary.py) boundaries_dir_event = boundaries_dir + str(event_number) + sep boundaries_dir_mux = muxhome # where the directory of the output filename sits output_build_time_dir = output_dir+build_time+dir_comment+sep #used for build_perth.py output_run_time_dir = output_dir+run_time+dir_comment+sep #used for run_perth.py output_run_time_dir_name = output_run_time_dir + scenario_name #Used by post processing #w here the directory of the gauges sit gauges_dir_name = gauges_dir + gauge_name #used for get_timeseries.py building_in_dir_name = gauges_dir + building + '.csv' #used for run_building_inundation.py #------------------------------------------------------------------------------ # Interior region definitions #------------------------------------------------------------------------------ #Land, to set the initial stage/water to be offcoast only poly_mainland_N = read_polygon(polygons_dir+'initial_conditions_N.csv') #Land, to set the initial stage/water to be offcoast only poly_mainland_S = read_polygon(polygons_dir+'initial_conditions_S.csv') #Island, to set the initial stage/water to be offcoast only poly_island1 = read_polygon(polygons_dir+'initial_conditions_rottnest.csv') #Island, to set the initial stage/water to be offcoast only poly_island2 = read_polygon(polygons_dir+'initial_conditions_garden.csv') # Initial bounding polygon for data clipping poly_all = read_polygon(polygons_dir+'poly_all.csv') res_poly_all = 100000*res_factor ### Area of Interest 1 (Fremantle, increase to reach Perth) ##poly_aoi1 = read_polygon(polygons_dir+'CBD_increase.csv') ##res_aoi1 = 500*res_factor ### Area of Interest 1 (Fremantle) ##poly_aoi1 = read_polygon(polygons_dir+'CBD_coastal.csv') ##res_aoi1 = 500*res_factor ## ### Area of Interest 2 (Rockingham) ##poly_aoi2 = read_polygon(polygons_dir+'rockingham_penguin_increase.csv') ##res_aoi2 = 500*res_factor ## ### Area of Interest 2 (Rockingham) ##poly_aoi2 = read_polygon(polygons_dir+'rockingham_penguin.csv') ##res_aoi2 = 500*res_factor ## ### Area of Interest 2 (garden Island) ##poly_aoi2a = read_polygon(polygons_dir+'garden.csv') ##res_aoi2a= 500*res_factor ## ### Area of Interest 3 (geordie bay - record of tsunami impact) ##poly_aoi3 = read_polygon(polygons_dir+'geordie_bay.csv') ##res_aoi3 = 500*res_factor ## ### Area of Interest 4 (sorrento - record of tsunami impact) ##poly_aoi4 = read_polygon(polygons_dir+'sorrento_gauge.csv') ##res_aoi4 = 500*res_factor ## ### Area of Significance 1 (Garden Island and sand bank infront of Rockingham) ##poly_aos1 = read_polygon(polygons_dir+'garden_rockingham_increase.csv') ##res_aos1 = 1000*res_factor # Area of Significance 2 (incorporate coastline of rottnest) poly_aos2 = read_polygon(polygons_dir+'rottnest_external.csv') res_aos2 = 500*res_factor ### Refined areas ### Polygon designed to incorporate dredged area from Fremantle to ### Rockingham as the steep incline was making the elevation go to 0 ##poly_aos3 = read_polygon(polygons_dir+'DredgeArea.csv') ##res_aos3 = 1000*res_factor ## ### Shallow water 1 ##poly_sw1 = read_polygon(polygons_dir+'internal_h20mORd3km.csv') ##res_sw1 = 25000*res_factor ### Shallow water 1 poly_sw1 = read_polygon(polygons_dir+'rottnest_20m.csv') res_sw1 = 1000*res_factor # Deep water (land of Rottnest, ANUGA does not do donuts!) poly_dw1 = read_polygon(polygons_dir+'rottnest_internal.csv') res_dw1 = 100000*res_factor # Combined all regions, must check that all are included! ##interior_regions = [[poly_aoi2,res_aoi2], [poly_aos1,res_aos1] ## ,[poly_aos2,res_aos2],[poly_aos3,res_aos3] ## ,[poly_sw1,res_sw1], [poly_dw1,res_dw1]] #For Rottnest zoom in interior_regions = [[poly_aos2,res_aos2],[poly_sw1,res_sw1] ,[poly_dw1,res_dw1]] ##interior_regions = [[poly_aoi1,res_aoi1],[poly_aoi2,res_aoi2] ## ,[poly_aoi2a,res_aoi2a],[poly_aoi3,res_aoi3] ## ,[poly_aoi4,res_aoi4],[poly_aos1,res_aos1] ## ,[poly_aos2,res_aos2],[poly_aos3,res_aos3] ## ,[poly_sw1,res_sw1], [poly_dw1,res_dw1]] trigs_min = number_mesh_triangles(interior_regions, poly_all, res_poly_all) print 'min estimated number of triangles', trigs_min #------------------------------------------------------------------------------ # Clipping regions for export to asc and regions for clipping data # Final inundation maps should only be created in regions of the finest mesh #------------------------------------------------------------------------------ #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 #Fremantle and Perth extract ascii grid xminPerth = 376000 xmaxPerth = 396000 yminPerth = 6449000 ymaxPerth = 6467000 #Rottnest xminRottnest = 352700 xmaxRottnest = 364800 yminRottnest = 6455000 ymaxRottnest = 6460500