[6461] | 1 | """ |
---|
| 2 | This file contains all your file and directory definitions |
---|
| 3 | for elevation, meshes and outputs. |
---|
| 4 | """ |
---|
| 5 | |
---|
| 6 | import os |
---|
| 7 | from anuga.utilities.system_tools import get_user_name, get_host_name |
---|
| 8 | from time import localtime, strftime, gmtime |
---|
| 9 | from os.path import join, exists |
---|
| 10 | |
---|
| 11 | |
---|
| 12 | #------------------------------------------------------------------------------- |
---|
| 13 | # Directory setup |
---|
| 14 | #------------------------------------------------------------------------------- |
---|
| 15 | |
---|
| 16 | # this section needs to be updated to reflect the modelled community. |
---|
| 17 | # Note, the user needs to set up the directory system accordingly |
---|
| 18 | state = 'australia_ph2' |
---|
| 19 | scenario_name = 'darwin' |
---|
| 20 | scenario_folder = scenario_name |
---|
| 21 | |
---|
| 22 | #------------------------------------------------------------------------------- |
---|
| 23 | # Initial Conditions |
---|
| 24 | #------------------------------------------------------------------------------- |
---|
| 25 | |
---|
| 26 | # Model specific parameters. |
---|
| 27 | # One or all can be changed each time the run_model script is executed |
---|
| 28 | tide = 0 # difference between MSL and HAT |
---|
| 29 | zone = 52 # specify zone of model |
---|
| 30 | event_number = 17890 # the event number or the mux file name |
---|
| 31 | alpha = 0.1 # smoothing parameter for mesh |
---|
| 32 | friction=0.01 # manning's friction coefficient |
---|
| 33 | starttime=0 # start time for simulation |
---|
| 34 | finaltime=1000 # final time for simulation |
---|
| 35 | |
---|
| 36 | # index is only used when wave = Tb |
---|
| 37 | index = 1203 # index from the PTHA |
---|
| 38 | wave = 'Tb' # Bf (sts wave) Tb (index wave) |
---|
| 39 | |
---|
| 40 | setup = 'trial' # This can be one of three values |
---|
| 41 | # trial - coarsest mesh, fast |
---|
| 42 | # basic - coarse mesh |
---|
| 43 | # final - fine mesh, slowest |
---|
| 44 | |
---|
| 45 | #------------------------------------------------------------------------------- |
---|
| 46 | # Output filename |
---|
| 47 | # |
---|
| 48 | # Your output filename should be unique between different runs on different data. |
---|
| 49 | # The list of items below will be used to create a file in your output directory. |
---|
| 50 | # Your user name and time+date will be automatically added. For example, |
---|
| 51 | # [setup, tide, event_number] |
---|
| 52 | # will result in a filename like |
---|
| 53 | # 20090212_091046_run_final_0_27283_rwilson |
---|
| 54 | #------------------------------------------------------------------------------- |
---|
| 55 | |
---|
| 56 | output_comment = [setup, tide, event_number, index, wave] |
---|
| 57 | |
---|
| 58 | #------------------------------------------------------------------------------- |
---|
| 59 | # Input Data |
---|
| 60 | #------------------------------------------------------------------------------- |
---|
| 61 | |
---|
| 62 | # ELEVATION DATA |
---|
| 63 | # Used in build_elevation.py |
---|
| 64 | # Format for ascii grids, as produced in ArcGIS + a projection file |
---|
| 65 | ascii_grid_filenames = [] # 250m grid 2005 |
---|
| 66 | |
---|
| 67 | # Format for point is x,y,elevation (with header) |
---|
| 68 | point_filenames = ['darwin_grid250m.txt', |
---|
| 69 | 'derby_grid250m.txt'] # 250m grid 2005 |
---|
| 70 | |
---|
| 71 | ### Add csv header list to all files in point_filenames |
---|
| 72 | ##headerlist = ['x', 'y', 'elevation'] |
---|
| 73 | ##for f in point_filenames: |
---|
| 74 | ## add_csv_header(join(topographies_folder, f), headerlist) |
---|
| 75 | |
---|
| 76 | # BOUNDING POLYGON - for data clipping and estimate of triangles in mesh |
---|
| 77 | # Used in build_elevation.py |
---|
| 78 | # Format for points easting,northing (no header) |
---|
| 79 | bounding_polygon_filename = 'bounding_polygon.csv' |
---|
| 80 | bounding_polygon_maxarea = 100000 |
---|
| 81 | |
---|
| 82 | # INTERIOR REGIONS - for designing the mesh |
---|
| 83 | # Used in run_model.py |
---|
| 84 | # Format for points easting,northing (no header) |
---|
| 85 | interior_regions_data = [] |
---|
| 86 | |
---|
| 87 | # LAND - used to set the initial stage/water to be offcoast only |
---|
| 88 | # Used in run_model.py. Format for points easting,northing (no header) |
---|
| 89 | land_initial_conditions_filename = [] |
---|
| 90 | |
---|
| 91 | # GAUGES - for creating timeseries at a specific point |
---|
| 92 | # Used in get_timeseries.py. |
---|
| 93 | # Format easting,northing,name,elevation (with header) |
---|
| 94 | gauges_filename = 'gauges.csv' |
---|
| 95 | |
---|
| 96 | # BUILDINGS EXPOSURE - for identifying inundated houses |
---|
| 97 | # Used in run_building_inundation.py |
---|
| 98 | # Format latitude,longitude etc (geographic) |
---|
| 99 | building_exposure_filename = 'busselton_res_clip.csv' # from NEXIS |
---|
| 100 | |
---|
| 101 | # BOUNDING POLYGON - used in build_boundary.py and run_model.py respectively |
---|
| 102 | # NOTE: when files are put together the points must be in sequence |
---|
| 103 | # For ease go clockwise! |
---|
| 104 | # Check the run_model.py for boundary_tags |
---|
| 105 | |
---|
| 106 | # Thinned ordering file from Hazard Map (geographic) |
---|
| 107 | # Format is index,latitude,longitude (with header) |
---|
| 108 | urs_order_filename = 'urs_order.csv' |
---|
| 109 | |
---|
| 110 | # Landward bounding points |
---|
| 111 | # Format easting,northing (no header) |
---|
| 112 | landward_boundary_filename = 'landward_boundary.csv' |
---|
| 113 | |
---|
| 114 | # MUX input filename. |
---|
| 115 | # If a meta-file from EventSelection is used, set 'multi-mux' to True. |
---|
| 116 | # If a single MUX stem filename (*.grd) is used, set 'multi-mux' to False. |
---|
| 117 | ##mux_input_filename = event_number # to be found in event_folder |
---|
| 118 | # (ie boundaries/event_number/) |
---|
| 119 | ##multi_mux = False |
---|
| 120 | mux_input_filename = 'event.list' |
---|
| 121 | multi_mux = True |
---|
| 122 | |
---|
| 123 | |
---|
| 124 | ################################################################################ |
---|
| 125 | ################################################################################ |
---|
| 126 | #### NOTE: NOTHING WOULD NORMALLY CHANGE BELOW THIS POINT. #### |
---|
| 127 | ################################################################################ |
---|
| 128 | ################################################################################ |
---|
| 129 | |
---|
| 130 | # Get system user and host names. |
---|
| 131 | # These values can be used to distinguish between two similar runs by two |
---|
| 132 | # different users or runs by the same user on two different machines. |
---|
| 133 | user = get_user_name() |
---|
| 134 | host = get_host_name() |
---|
| 135 | |
---|
| 136 | # Environment variable names. |
---|
| 137 | # The inundation directory, not the data directory. |
---|
| 138 | ENV_INUNDATIONHOME = 'INUNDATIONHOME' |
---|
| 139 | |
---|
| 140 | # Path to MUX data |
---|
| 141 | ENV_MUXHOME = 'MUXHOME' |
---|
| 142 | |
---|
| 143 | #------------------------------------------------------------------------------- |
---|
| 144 | # Output Elevation Data |
---|
| 145 | #------------------------------------------------------------------------------- |
---|
| 146 | |
---|
| 147 | # Output filename for elevation |
---|
| 148 | # this is a combination of all the data generated in build_elevation.py |
---|
| 149 | combined_elevation_basename = scenario_name + '_combined_elevation' |
---|
| 150 | |
---|
| 151 | #------------------------------------------------------------------------------- |
---|
| 152 | # Directory Structure |
---|
| 153 | #------------------------------------------------------------------------------- |
---|
| 154 | |
---|
| 155 | # determines time for setting up output directories |
---|
| 156 | time = strftime('%Y%m%d_%H%M%S', localtime()) |
---|
| 157 | gtime = strftime('%Y%m%d_%H%M%S', gmtime()) |
---|
| 158 | build_time = time + '_build' |
---|
| 159 | run_time = time + '_run_' |
---|
| 160 | |
---|
| 161 | # create paths generated from environment variables. |
---|
| 162 | home = join(os.getenv(ENV_INUNDATIONHOME), 'data') # Absolute path for data folder |
---|
| 163 | muxhome = os.getenv(ENV_MUXHOME) |
---|
| 164 | |
---|
| 165 | # check various directories/files that must exist |
---|
| 166 | anuga_folder = join(home, state, scenario_folder, 'anuga') |
---|
| 167 | topographies_folder = join(anuga_folder, 'topographies') |
---|
| 168 | polygons_folder = join(anuga_folder, 'polygons') |
---|
| 169 | boundaries_folder = join(anuga_folder, 'boundaries') |
---|
| 170 | output_folder = join(anuga_folder, 'outputs') |
---|
| 171 | gauges_folder = join(anuga_folder, 'gauges') |
---|
| 172 | meshes_folder = join(anuga_folder, 'meshes') |
---|
| 173 | event_folder = join(boundaries_folder, str(event_number)) |
---|
| 174 | |
---|
| 175 | # MUX data files |
---|
| 176 | # Directory containing the MUX data files to be used with EventSelection. |
---|
| 177 | mux_data_folder = join(muxhome, 'mux') |
---|
| 178 | |
---|
| 179 | #------------------------------------------------------------------------------- |
---|
| 180 | # Location of input and output data |
---|
| 181 | #------------------------------------------------------------------------------- |
---|
| 182 | |
---|
| 183 | # Convert the user output_comment to a string for run_model.py |
---|
| 184 | output_comment = ('_'.join([str(x) for x in output_comment if x != user]) |
---|
| 185 | + '_' + user) |
---|
| 186 | |
---|
| 187 | # The absolute pathname of the all elevation, generated in build_elevation.py |
---|
| 188 | combined_elevation = join(topographies_folder, combined_elevation_basename) |
---|
| 189 | |
---|
| 190 | # The absolute pathname of the mesh, generated in run_model.py |
---|
| 191 | meshes = join(meshes_folder, scenario_name) + '.msh' |
---|
| 192 | |
---|
| 193 | # The pathname for the urs order points, used within build_urs_boundary.py |
---|
| 194 | urs_order = join(boundaries_folder, urs_order_filename) |
---|
| 195 | |
---|
| 196 | # The absolute pathname for the landward points of the bounding polygon, |
---|
| 197 | # Used within run_model.py) |
---|
| 198 | landward_boundary = join(boundaries_folder, landward_boundary_filename) |
---|
| 199 | |
---|
| 200 | # The absolute pathname for the .sts file, generated in build_boundary.py |
---|
| 201 | event_sts = join(event_folder, scenario_name) |
---|
| 202 | |
---|
| 203 | # The absolute pathname for the output folder names |
---|
| 204 | # Used for build_elevation.py |
---|
| 205 | output_build = join(output_folder, build_time) + '_' + str(user) |
---|
| 206 | # Used for run_model.py |
---|
| 207 | output_run = join(output_folder, run_time) + output_comment |
---|
| 208 | # Used by post processing |
---|
| 209 | output_run_time = join(output_run, scenario_name) |
---|
| 210 | |
---|
| 211 | # The absolute pathname for the gauges file |
---|
| 212 | # Used for get_timeseries.py |
---|
| 213 | gauges = join(gauges_folder, gauges_filename) |
---|
| 214 | |
---|
| 215 | # The absolute pathname for the building file |
---|
| 216 | # Used for run_building_inundation.py |
---|
| 217 | building_exposure = join(gauges_folder, building_exposure_filename) |
---|
| 218 | |
---|
| 219 | # full path to where MUX files (or meta-files) live |
---|
| 220 | mux_input = join(event_folder, mux_input_filename) |
---|
| 221 | |
---|