""" This file contains all your file and directory definitions for elevation, meshes and outputs. """ import os from anuga.utilities.system_tools import get_user_name, get_host_name from time import localtime, strftime, gmtime from os.path import join, exists from anuga.lib.add_csv_header.add_csv_header import add_csv_header #------------------------------------------------------------------------------- # Directory setup #------------------------------------------------------------------------------- # this section needs to be updated to reflect the modelled community. # Note, the user needs to set up the directory system accordingly state = 'australia_ph2' scenario_name = 'melbourne' #------------------------------------------------------------------------------- # Initial Conditions #------------------------------------------------------------------------------- # Model specific parameters. # One or all can be changed each time the run_model script is executed import sys if len(sys.argv) > 1: event_number = int(sys.argv[1]) else: event_number = 58348 # the event number or the mux file name event_side = 'east' #'east' if event_side == 'west': index = 1979 # index from the PTHA - Y2000 0.257m event_number_list = [58348, 64288, 68793] # To piggy back multiple events elif event_side == 'east': index = 2649 event_number_list = [31853, 51449, 58115] # To piggy back multiple events central_meridian = 146.0 # Central meridian for projection (optional) zone = None tide = 0 # difference between MSL and HAT alpha = 0.1 # smoothing parameter for mesh friction=0.01 # manning's friction coefficient starttime=0 # start time for simulation finaltime=60000 # final time for simulation setup = 'final' # This can be one of three values # trial - coarsest mesh, fast # basic - coarse mesh # final - fine mesh, slowest # index is only used when wave = Tb wave = 'Tb' # Bf (sts wave) Tb (index wave) internal_polygon = False #------------------------------------------------------------------------------- # Output filename # # Your output filename should be unique between different runs on different data. # The list of items below will be used to create a file in your output directory. # Your user name and time+date will be automatically added. For example, # [setup, tide, event_number] # will result in a filename like # 20090212_091046_run_final_0_27283_rwilson #------------------------------------------------------------------------------- if internal_polygon: internal_poly_comment = 'internal' else: internal_poly_comment = '' output_comment = [setup, tide, event_number, index, wave, event_side, internal_poly_comment] #------------------------------------------------------------------------------- # Input Data #------------------------------------------------------------------------------- # ELEVATION DATA # Used in build_elevation.py # Format for ascii grids, as produced in ArcGIS + a projection file ascii_grid_filenames = ['grid_250m_simple'] # Format for points is x,y,elevation (with header) point_filenames = [] # ### Add csv header list to all files in point_filenames ##headerlist = ['x', 'y', 'elevation'] ##for f in point_filenames: ## add_csv_header(join(topographies_folder, f), headerlist) # BOUNDING POLYGON - for data clipping and estimate of triangles in mesh # Used in build_elevation.py # Format for points: easting,northing (no header) bounding_polygon_filename = 'bounding_polygon.csv' bounding_polygon_maxarea = 125000 # INTERIOR REGIONS - for designing the mesh # Used in run_model.py # Format for points easting,northing (no header) interior_regions_data = [] # add an internal polygon to force different mesh generation # used to test for discretisation error when building elevation # make sure file is in same folder as interior regions and bouding polygon; # format is same (2 column .csv; easting, northing; no header) if internal_polygon: interior_regions_data.append(['internal_polygon.csv', bounding_polygon_maxarea]) # LAND - used to set the initial stage/water to be offcoast only # Used in run_model.py. Format for points easting,northing (no header) land_initial_conditions_filename = [] # GAUGES - for creating timeseries at a specific point # Used in get_timeseries.py. # Format easting,northing,name,elevation (with header) gauges_filename = 'gauges.csv' # BUILDINGS EXPOSURE - for identifying inundated houses # Used in run_building_inundation.py # Format latitude,longitude etc (geographic) building_exposure_filename = '.csv' # from NEXIS # BOUNDING POLYGON - used in build_boundary.py and run_model.py respectively # NOTE: when files are put together the points must be in sequence # For ease go clockwise! # Check the run_model.py for boundary_tags # Thinned ordering file from Hazard Map (geographic) # Format is index,latitude,longitude (with header) urs_order_filename_W = 'urs_order_west_simple.csv' urs_order_filename_E ='urs_order_east_simple.csv' ##urs_order_filename = 'urs_order_both.csv' # east is first, then west # Landward bounding points # Format easting,northing (no header) landward_boundary_filename_N = 'landward_boundary_north_simple.csv' landward_boundary_filename_S = 'landward_boundary_south_simple.csv' # MUX input filename. # If a meta-file from EventSelection is used, set 'multi-mux' to True. # If a single MUX stem filename (*.grd) is used, set 'multi-mux' to False. ##mux_input_filename = 'Java-0016-z.grd' ##multi_mux = False mux_input_filename = 'event.list' multi_mux = True # Specify if share cache is to be used # Whatever is specified here will be relative to INUNDATION_HOME/.cache # If nothing is specified, local cache will be used. cachedir = '.python_cache_phII' ################################################################################ ################################################################################ #### NOTE: NOTHING WOULD NORMALLY CHANGE BELOW THIS POINT. #### ################################################################################ ################################################################################ # Get system user and host names. # These values can be used to distinguish between two similar runs by two # different users or runs by the same user on two different machines. user = get_user_name() host = get_host_name() # Environment variable names. # The inundation directory, not the data directory. ENV_INUNDATIONHOME = 'INUNDATIONHOME' # Path to MUX data ENV_MUXHOME = 'MUXHOME' #------------------------------------------------------------------------------- # Output Elevation Data #------------------------------------------------------------------------------- # Output filename for elevation # this is a combination of all the data generated in build_elevation.py combined_elevation_basename = scenario_name + '_combined_elevation' #------------------------------------------------------------------------------- # Directory Structure #------------------------------------------------------------------------------- # 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_' # create paths generated from environment variables. home = join(os.getenv(ENV_INUNDATIONHOME), 'data') # Absolute path for data folder muxhome = os.getenv(ENV_MUXHOME) # Create absolute pathname for cache directory # and change caching to use it if 'cachedir' in dir(): cachedir = join(os.getenv(ENV_INUNDATIONHOME), '.cache', cachedir) from anuga.caching import caching caching.set_option('cachedir', cachedir) # check various directories/files that must exist anuga_folder = join(home, state, scenario_name, 'anuga') topographies_folder = join(anuga_folder, 'topographies') polygons_folder = join(anuga_folder, 'polygons') boundaries_folder = join(anuga_folder, 'boundaries') output_folder = join(anuga_folder, 'outputs') gauges_folder = join(anuga_folder, 'gauges') meshes_folder = join(anuga_folder, 'meshes') event_folder = join(boundaries_folder, str(event_number)) # MUX data files # Directory containing the MUX data files to be used with EventSelection. mux_data_folder = join(muxhome, 'mux') #------------------------------------------------------------------------------- # Location of input and output data #------------------------------------------------------------------------------- # Convert the user output_comment to a string for run_model.py output_comment = ('_'.join([str(x) for x in output_comment if x != user]) + '_' + user) # The absolute pathname of the all elevation, generated in build_elevation.py combined_elevation = join(topographies_folder, combined_elevation_basename) # The absolute pathname of the mesh, generated in run_model.py meshes = join(meshes_folder, scenario_name) + '.msh' # The pathname for the urs order points, used within build_urs_boundary.py urs_order_east = join(boundaries_folder, urs_order_filename_E) urs_order_west = join(boundaries_folder, urs_order_filename_W) # The absolute pathname for the landward points of the bounding polygon, # Used within run_model.py) landward_boundary_N = join(boundaries_folder, landward_boundary_filename_N) landward_boundary_S = join(boundaries_folder, landward_boundary_filename_S) # The absolute pathname for the .sts file, generated in build_boundary.py event_sts_east = join(event_folder, scenario_name) + '_east' event_sts_west = join(event_folder, scenario_name) + '_west' # The absolute pathname for the output folder names # Used for build_elevation.py output_build = join(output_folder, build_time) + '_' + str(user) # Used for run_model.py output_run = join(output_folder, run_time) + output_comment # Used by post processing output_run_time = join(output_run, scenario_name) # The absolute pathname for the gauges file # Used for get_timeseries.py gauges = join(gauges_folder, gauges_filename) # The absolute pathname for the building file # Used for run_building_inundation.py building_exposure = join(gauges_folder, building_exposure_filename) # full path to where MUX files (or meta-files) live mux_input = join(event_folder, mux_input_filename) # sts gauge with desired index number - used for wave 'Tb' boundary_csv = join(event_folder, 'sts_gauge_' + str(index) + '.csv')