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