[7545] | 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 = 'western_australia' |
---|
[7546] | 19 | scenario_name = 'mandurah' |
---|
| 20 | scenario_folder = 'mandurah_tsunami_scenario_2009' |
---|
[7545] | 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.6 # difference between MSL and HAT in metres |
---|
| 29 | zone = 50 # specify zone of model |
---|
| 30 | event_number = 27255 # 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=80000 # final time for simulation |
---|
| 35 | |
---|
[7546] | 36 | setup = 'trial' # This can be one of three values |
---|
[7545] | 37 | # trial - coarsest mesh, fast |
---|
| 38 | # basic - coarse mesh |
---|
| 39 | # final - fine mesh, slowest |
---|
| 40 | |
---|
| 41 | #------------------------------------------------------------------------------- |
---|
| 42 | # Output filename |
---|
| 43 | # |
---|
| 44 | # Your output filename should be unique between different runs on different data. |
---|
| 45 | # The list of items below will be used to create a file in your output directory. |
---|
| 46 | # Your user name and time+date will be automatically added. For example, |
---|
| 47 | # [setup, tide, event_number] |
---|
| 48 | # will result in a filename like |
---|
| 49 | # 20090212_091046_run_final_0_27283_rwilson |
---|
| 50 | #------------------------------------------------------------------------------- |
---|
| 51 | |
---|
[7546] | 52 | output_comment = [setup, tide, event_number] |
---|
[7545] | 53 | |
---|
| 54 | #------------------------------------------------------------------------------- |
---|
| 55 | # Input Data |
---|
| 56 | #------------------------------------------------------------------------------- |
---|
| 57 | |
---|
| 58 | # ELEVATION DATA |
---|
| 59 | # Used in build_elevation.py |
---|
| 60 | # Format for ascii grids, as produced in ArcGIS + a projection file |
---|
[7546] | 61 | ascii_grid_filenames = [#'m_harvey_1m', # Topo |
---|
| 62 | 'm_peel_1m', |
---|
| 63 | 'ph10mex_clipped'] # mandurah Topo |
---|
[7545] | 64 | |
---|
| 65 | # Format for point is x,y,elevation (with header) |
---|
[7546] | 66 | point_filenames = ['bathymetry_all_data.txt', # All data |
---|
| 67 | 'coastline.txt'] # Coastline |
---|
[7545] | 68 | |
---|
| 69 | ### Add csv header list to all files in point_filenames |
---|
| 70 | ##headerlist = ['x', 'y', 'elevation'] |
---|
| 71 | ##for f in point_filenames: |
---|
| 72 | ## add_csv_header(join(topographies_folder, f), headerlist) |
---|
| 73 | |
---|
| 74 | # BOUNDING POLYGON - for data clipping and estimate of triangles in mesh |
---|
| 75 | # Used in build_elevation.py |
---|
| 76 | # Format for points easting,northing (no header) |
---|
[7546] | 77 | bounding_polygon_filename = 'bounding_polygon.csv' |
---|
[7545] | 78 | bounding_polygon_maxarea = 100000 |
---|
| 79 | |
---|
| 80 | # INTERIOR REGIONS - for designing the mesh |
---|
| 81 | # Used in run_model.py |
---|
| 82 | # Format for points easting,northing (no header) |
---|
[7546] | 83 | interior_regions_data = [['area_of_interest1.csv', 500], |
---|
| 84 | ['area_of_interest2.csv', 500], |
---|
| 85 | ['area_of_interest3.csv', 500], |
---|
| 86 | ['bounding_area_of_interest.csv', 2500]] |
---|
[7545] | 87 | |
---|
| 88 | # LAND - used to set the initial stage/water to be offcoast only |
---|
| 89 | # Used in run_model.py. Format for points easting,northing (no header) |
---|
[7546] | 90 | land_initial_conditions_filename = [['initial_conditions.csv', 0]] |
---|
[7545] | 91 | |
---|
| 92 | # GAUGES - for creating timeseries at a specific point |
---|
| 93 | # Used in get_timeseries.py. |
---|
| 94 | # Format easting,northing,name,elevation (with header) |
---|
[7546] | 95 | # gauges_filename = 'MH_gauges2.csv' |
---|
[7545] | 96 | |
---|
| 97 | # BUILDINGS EXPOSURE - for identifying inundated houses |
---|
| 98 | # Used in run_building_inundation.py |
---|
| 99 | # Format latitude,longitude etc (geographic) |
---|
[7546] | 100 | # building_exposure_filename = 'mandurah_res_clip.csv' # from NEXIS |
---|
[7545] | 101 | |
---|
| 102 | # AREA OF IMAGES - Extent of each image to find out highest runup |
---|
| 103 | # Header - easting,northing,id,value |
---|
| 104 | # Used in get_runup.py |
---|
[7546] | 105 | # images_filename = 'define_area_clip.csv' |
---|
[7545] | 106 | |
---|
| 107 | # BOUNDING POLYGON - used in build_boundary.py and run_model.py respectively |
---|
| 108 | # NOTE: when files are put together the points must be in sequence |
---|
| 109 | # For ease go clockwise! |
---|
| 110 | # Check the run_model.py for boundary_tags |
---|
| 111 | |
---|
| 112 | # Thinned ordering file from Hazard Map (geographic) |
---|
| 113 | # Format is index,latitude,longitude (with header) |
---|
[7546] | 114 | urs_order_filename = 'urs_order.csv' |
---|
[7545] | 115 | |
---|
| 116 | # Landward bounding points |
---|
| 117 | # Format easting,northing (no header) |
---|
[7546] | 118 | landward_boundary_filename = 'landward_boundary_polygon.csv' |
---|
[7545] | 119 | |
---|
| 120 | # MUX input filename. |
---|
| 121 | # If a meta-file from EventSelection is used, set 'multi-mux' to True. |
---|
| 122 | # If a single MUX stem filename (*.grd) is used, set 'multi-mux' to False. |
---|
| 123 | ##mux_input_filename = event_number # to be found in event_folder |
---|
| 124 | # (ie boundaries/event_number/) |
---|
| 125 | ##multi_mux = False |
---|
| 126 | mux_input_filename = 'event.list' |
---|
| 127 | multi_mux = True |
---|
| 128 | |
---|
| 129 | #------------------------------------------------------------------------------- |
---|
| 130 | # Clipping regions for export to asc and regions for clipping data |
---|
| 131 | # Final inundation maps should only be created in regions of the finest mesh |
---|
| 132 | #------------------------------------------------------------------------------- |
---|
| 133 | |
---|
[7546] | 134 | # This is my clipping region for topo |
---|
| 135 | clip_box = 'clip_box.csv' |
---|
[7545] | 136 | |
---|
[7546] | 137 | # ASCII export grid for mandurah |
---|
| 138 | xminmandurah = 377708 |
---|
| 139 | xmaxmandurah = 380186 |
---|
| 140 | yminmandurah = 6399699 |
---|
| 141 | ymaxmandurah = 6401544 |
---|
[7545] | 142 | |
---|
[7546] | 143 | |
---|
[7545] | 144 | ################################################################################ |
---|
| 145 | ################################################################################ |
---|
| 146 | #### NOTE: NOTHING WOULD NORMALLY CHANGE BELOW THIS POINT. #### |
---|
| 147 | ################################################################################ |
---|
| 148 | ################################################################################ |
---|
| 149 | |
---|
| 150 | # Get system user and host names. |
---|
| 151 | # These values can be used to distinguish between two similar runs by two |
---|
| 152 | # different users or runs by the same user on two different machines. |
---|
| 153 | user = get_user_name() |
---|
| 154 | host = get_host_name() |
---|
| 155 | |
---|
| 156 | # Environment variable names. |
---|
| 157 | # The inundation directory, not the data directory. |
---|
| 158 | ENV_INUNDATIONHOME = 'INUNDATIONHOME' |
---|
| 159 | |
---|
| 160 | # Path to MUX data |
---|
| 161 | ENV_MUXHOME = 'MUXHOME' |
---|
| 162 | |
---|
| 163 | #------------------------------------------------------------------------------- |
---|
| 164 | # Output Elevation Data |
---|
| 165 | #------------------------------------------------------------------------------- |
---|
| 166 | |
---|
| 167 | # Output filename for elevation |
---|
| 168 | # this is a combination of all the data generated in build_elevation.py |
---|
| 169 | combined_elevation_basename = scenario_name + '_combined_elevation' |
---|
| 170 | |
---|
| 171 | #------------------------------------------------------------------------------- |
---|
| 172 | # Directory Structure |
---|
| 173 | #------------------------------------------------------------------------------- |
---|
| 174 | |
---|
| 175 | # determines time for setting up output directories |
---|
| 176 | time = strftime('%Y%m%d_%H%M%S', localtime()) |
---|
| 177 | gtime = strftime('%Y%m%d_%H%M%S', gmtime()) |
---|
| 178 | build_time = time + '_build' |
---|
| 179 | run_time = time + '_run_' |
---|
| 180 | |
---|
| 181 | # create paths generated from environment variables. |
---|
| 182 | home = join(os.getenv(ENV_INUNDATIONHOME), 'data') # Absolute path for data folder |
---|
| 183 | muxhome = os.getenv(ENV_MUXHOME) |
---|
| 184 | |
---|
| 185 | # check various directories/files that must exist |
---|
| 186 | anuga_folder = join(home, state, scenario_folder, 'anuga') |
---|
| 187 | topographies_folder = join(anuga_folder, 'topographies') |
---|
| 188 | polygons_folder = join(anuga_folder, 'polygons') |
---|
| 189 | boundaries_folder = join(anuga_folder, 'boundaries') |
---|
| 190 | output_folder = join(anuga_folder, 'outputs') |
---|
| 191 | gauges_folder = join(anuga_folder, 'gauges') |
---|
| 192 | event_folder = join(boundaries_folder, str(event_number)) |
---|
| 193 | |
---|
| 194 | # MUX data files |
---|
| 195 | # Directory containing the MUX data files to be used with EventSelection. |
---|
| 196 | mux_data_folder = join(muxhome, 'mux') |
---|
| 197 | |
---|
| 198 | #------------------------------------------------------------------------------- |
---|
| 199 | # Location of input and output data |
---|
| 200 | #------------------------------------------------------------------------------- |
---|
| 201 | |
---|
| 202 | # Convert the user output_comment to a string for run_model.py |
---|
| 203 | output_comment = ('_'.join([str(x) for x in output_comment if x != user]) |
---|
| 204 | + '_' + user) |
---|
| 205 | |
---|
| 206 | # The absolute pathname of the all elevation, generated in build_elevation.py |
---|
| 207 | combined_elevation = join(topographies_folder, combined_elevation_basename) |
---|
| 208 | |
---|
| 209 | # The pathname for the urs order points, used within build_urs_boundary.py |
---|
| 210 | if urs_order_filename: |
---|
| 211 | urs_order = join(boundaries_folder, urs_order_filename) |
---|
| 212 | |
---|
| 213 | # The absolute pathname for the landward points of the bounding polygon, |
---|
| 214 | # Used within run_model.py) |
---|
| 215 | if landward_boundary_filename: |
---|
| 216 | landward_boundary = join(boundaries_folder, landward_boundary_filename) |
---|
| 217 | |
---|
| 218 | # The absolute pathname for the .sts file, generated in build_boundary.py |
---|
| 219 | event_sts = join(event_folder, scenario_name) |
---|
| 220 | |
---|
| 221 | # The absolute pathname for the output folder names |
---|
| 222 | # Used for build_elevation.py |
---|
| 223 | output_build = join(output_folder, build_time) + '_' + str(user) |
---|
| 224 | # Used for run_model.py |
---|
| 225 | output_run = join(output_folder, run_time) + output_comment |
---|
| 226 | # Used by post processing |
---|
| 227 | output_run_time = join(output_run, scenario_name) |
---|
| 228 | |
---|
| 229 | # The absolute pathname of the mesh, generated in run_model.py |
---|
| 230 | meshes = join(output_run, scenario_name) + '.msh' |
---|
| 231 | |
---|
| 232 | # The absolute pathname for the gauges file |
---|
| 233 | # Used for get_timeseries.py |
---|
[7546] | 234 | #if gauges_filename: |
---|
| 235 | # gauges = join(gauges_folder, gauges_filename) |
---|
[7545] | 236 | |
---|
| 237 | # The absolute pathname for the building file |
---|
| 238 | # Used for run_building_inundation.py |
---|
[7546] | 239 | # if building_exposure_filename: |
---|
| 240 | # building_exposure = join(gauges_folder, building_exposure_filename) |
---|
[7545] | 241 | |
---|
| 242 | # The absolute pathname for the image file |
---|
| 243 | # Used for get_runup.py |
---|
[7546] | 244 | # if images_filename: |
---|
| 245 | # images = join(polygons_folder, images_filename) |
---|
[7545] | 246 | |
---|
| 247 | # full path to where MUX files (or meta-files) live |
---|
| 248 | mux_input = join(event_folder, mux_input_filename) |
---|
| 249 | |
---|