[6457] | 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 = 'tasmania' |
---|
| 19 | scenario_name = 'hobart' |
---|
| 20 | scenario_folder = 'hobart_tsunami_scenario_2009' |
---|
| 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 = 55 # specify zone of model |
---|
| 30 | event_number = 58364 # 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 | setup = 'final' # This can be one of three values |
---|
| 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 | |
---|
| 52 | output_comment = [setup, tide, event_number] |
---|
| 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 |
---|
[6499] | 61 | ascii_grid_filenames = ['hob3_pro_extract', 'grid_250m_project', 'ldr_bbay', |
---|
| 62 | 'ldr_bellerive', 'ldr_brunyislandneck', |
---|
| 63 | 'ldr_calvertsbeach', 'ldr_carltonbeach', |
---|
| 64 | 'ldr_connelly', 'ldr_cremorne', 'ldr_dodge1', |
---|
| 65 | 'ldr_dodge2', 'ldr_kingston', 'ldr_lauderdale', |
---|
| 66 | 'ldr_linersfarne', 'ldr_oppossumbay', 'ldr_primrose', |
---|
| 67 | 'ldr_rosny', 'ldr_sandybay', 'ldr_selfspoint', |
---|
| 68 | 'ldr_sevenmile', 'ldr_southarm1', 'ldr_southarm2', |
---|
| 69 | 'ldr_sullivanscove', 'ldr_tranmere', 'tasdem_mask'] |
---|
[6457] | 70 | |
---|
| 71 | # Format for point is x,y,elevation (with header) |
---|
| 72 | point_filenames = ['tasmania_data.txt', # The data from Tasmania |
---|
| 73 | 'hydro_data.txt'] # Data from Hydro |
---|
| 74 | |
---|
| 75 | ### Add csv header list to all files in point_filenames |
---|
| 76 | ##headerlist = ['x', 'y', 'elevation'] |
---|
| 77 | ##for f in point_filenames: |
---|
| 78 | ## add_csv_header(join(topographies_folder, f), headerlist) |
---|
| 79 | |
---|
| 80 | # BOUNDING POLYGON - for data clipping and estimate of triangles in mesh |
---|
| 81 | # Used in build_elevation.py |
---|
| 82 | # Format for points easting,northing (no header) |
---|
| 83 | bounding_polygon_filename = 'bounding_polygon.csv' |
---|
[6499] | 84 | bounding_polygon_maxarea = 1000000 |
---|
[6457] | 85 | |
---|
| 86 | # INTERIOR REGIONS - for designing the mesh |
---|
| 87 | # Used in run_model.py |
---|
| 88 | # Format for points easting,northing (no header) |
---|
[6499] | 89 | interior_regions_data = [['aos1.csv', 1500], |
---|
| 90 | ['aos2.csv', 1500], |
---|
| 91 | ['sw.csv', 30000]] |
---|
| 92 | PriorityArea_filename = 'PriorityAreas.csv' |
---|
[6457] | 93 | |
---|
| 94 | # LAND - used to set the initial stage/water to be offcoast only |
---|
| 95 | # Used in run_model.py. Format for points easting,northing (no header) |
---|
| 96 | land_initial_conditions_filename = [] |
---|
| 97 | |
---|
| 98 | # GAUGES - for creating timeseries at a specific point |
---|
| 99 | # Used in get_timeseries.py. |
---|
| 100 | # Format easting,northing,name,elevation (with header) |
---|
| 101 | gauges_filename = 'gauges.csv' |
---|
| 102 | |
---|
| 103 | # BUILDINGS EXPOSURE - for identifying inundated houses |
---|
| 104 | # Used in run_building_inundation.py |
---|
| 105 | # Format latitude,longitude etc (geographic) |
---|
| 106 | building_exposure_filename = 'busselton_res_clip.csv' # from NEXIS |
---|
| 107 | |
---|
| 108 | # BOUNDING POLYGON - used in build_boundary.py and run_model.py respectively |
---|
| 109 | # NOTE: when files are put together the points must be in sequence |
---|
| 110 | # For ease go clockwise! |
---|
| 111 | # Check the run_model.py for boundary_tags |
---|
| 112 | |
---|
| 113 | # Thinned ordering file from Hazard Map (geographic) |
---|
| 114 | # Format is index,latitude,longitude (with header) |
---|
| 115 | urs_order_filename = 'urs_order.csv' |
---|
| 116 | |
---|
| 117 | # Landward bounding points |
---|
| 118 | # Format easting,northing (no header) |
---|
| 119 | landward_boundary_filename = 'landward_boundary.csv' |
---|
| 120 | |
---|
| 121 | # MUX input filename. |
---|
| 122 | # If a meta-file from EventSelection is used, set 'multi-mux' to True. |
---|
| 123 | # If a single MUX stem filename (*.grd) is used, set 'multi-mux' to False. |
---|
| 124 | ##mux_input_filename = event_number # to be found in event_folder |
---|
| 125 | # (ie boundaries/event_number/) |
---|
| 126 | ##multi_mux = False |
---|
| 127 | mux_input_filename = 'event.list' |
---|
| 128 | multi_mux = True |
---|
| 129 | |
---|
| 130 | #------------------------------------------------------------------------------- |
---|
| 131 | # Clipping regions for export to asc and regions for clipping data |
---|
| 132 | # Final inundation maps should only be created in regions of the finest mesh |
---|
| 133 | #------------------------------------------------------------------------------- |
---|
| 134 | |
---|
| 135 | # ASCII export grid for Busselton |
---|
| 136 | xminBusselton = 340000 |
---|
| 137 | xmaxBusselton = 352000 |
---|
| 138 | yminBusselton = 6271500 |
---|
| 139 | ymaxBusselton = 6280000 |
---|
| 140 | |
---|
| 141 | # ASCII export grid for Bunbury |
---|
| 142 | xminBunbury = 369000 |
---|
| 143 | xmaxBunbury = 381000 |
---|
| 144 | yminBunbury = 6308000 |
---|
| 145 | ymaxBunbury = 6316500 |
---|
| 146 | |
---|
| 147 | ################################################################################ |
---|
| 148 | ################################################################################ |
---|
| 149 | #### NOTE: NOTHING WOULD NORMALLY CHANGE BELOW THIS POINT. #### |
---|
| 150 | ################################################################################ |
---|
| 151 | ################################################################################ |
---|
| 152 | |
---|
| 153 | # Get system user and host names. |
---|
| 154 | # These values can be used to distinguish between two similar runs by two |
---|
| 155 | # different users or runs by the same user on two different machines. |
---|
| 156 | user = get_user_name() |
---|
| 157 | host = get_host_name() |
---|
| 158 | |
---|
| 159 | # Environment variable names. |
---|
| 160 | # The inundation directory, not the data directory. |
---|
| 161 | ENV_INUNDATIONHOME = 'INUNDATIONHOME' |
---|
| 162 | |
---|
| 163 | # Path to MUX data |
---|
| 164 | ENV_MUXHOME = 'MUXHOME' |
---|
| 165 | |
---|
| 166 | #------------------------------------------------------------------------------- |
---|
| 167 | # Output Elevation Data |
---|
| 168 | #------------------------------------------------------------------------------- |
---|
| 169 | |
---|
| 170 | # Output filename for elevation |
---|
| 171 | # this is a combination of all the data generated in build_elevation.py |
---|
| 172 | combined_elevation_basename = scenario_name + '_combined_elevation' |
---|
| 173 | |
---|
| 174 | #------------------------------------------------------------------------------- |
---|
| 175 | # Directory Structure |
---|
| 176 | #------------------------------------------------------------------------------- |
---|
| 177 | |
---|
| 178 | # determines time for setting up output directories |
---|
| 179 | time = strftime('%Y%m%d_%H%M%S', localtime()) |
---|
| 180 | gtime = strftime('%Y%m%d_%H%M%S', gmtime()) |
---|
| 181 | build_time = time + '_build' |
---|
| 182 | run_time = time + '_run_' |
---|
| 183 | |
---|
| 184 | # create paths generated from environment variables. |
---|
| 185 | home = join(os.getenv(ENV_INUNDATIONHOME), 'data') # Absolute path for data folder |
---|
| 186 | muxhome = os.getenv(ENV_MUXHOME) |
---|
| 187 | |
---|
| 188 | # check various directories/files that must exist |
---|
| 189 | anuga_folder = join(home, state, scenario_folder, 'anuga') |
---|
| 190 | topographies_folder = join(anuga_folder, 'topographies') |
---|
| 191 | polygons_folder = join(anuga_folder, 'polygons') |
---|
| 192 | boundaries_folder = join(anuga_folder, 'boundaries') |
---|
| 193 | output_folder = join(anuga_folder, 'outputs') |
---|
| 194 | gauges_folder = join(anuga_folder, 'gauges') |
---|
| 195 | meshes_folder = join(anuga_folder, 'meshes') |
---|
| 196 | event_folder = join(boundaries_folder, str(event_number)) |
---|
| 197 | |
---|
| 198 | # MUX data files |
---|
| 199 | # Directory containing the MUX data files to be used with EventSelection. |
---|
| 200 | mux_data_folder = join(muxhome, 'mux') |
---|
| 201 | |
---|
| 202 | #------------------------------------------------------------------------------- |
---|
| 203 | # Location of input and output data |
---|
| 204 | #------------------------------------------------------------------------------- |
---|
| 205 | |
---|
| 206 | # Convert the user output_comment to a string for run_model.py |
---|
| 207 | output_comment = ('_'.join([str(x) for x in output_comment if x != user]) |
---|
| 208 | + '_' + user) |
---|
| 209 | |
---|
| 210 | # The absolute pathname of the all elevation, generated in build_elevation.py |
---|
| 211 | combined_elevation = join(topographies_folder, combined_elevation_basename) |
---|
| 212 | |
---|
| 213 | # The absolute pathname of the mesh, generated in run_model.py |
---|
| 214 | meshes = join(meshes_folder, scenario_name) + '.msh' |
---|
| 215 | |
---|
| 216 | # The pathname for the urs order points, used within build_urs_boundary.py |
---|
| 217 | if urs_order_filename: |
---|
| 218 | urs_order = join(boundaries_folder, urs_order_filename) |
---|
| 219 | |
---|
| 220 | # The absolute pathname for the landward points of the bounding polygon, |
---|
| 221 | # Used within run_model.py) |
---|
| 222 | if landward_boundary_filename: |
---|
| 223 | landward_boundary = join(boundaries_folder, landward_boundary_filename) |
---|
| 224 | |
---|
| 225 | # The absolute pathname for the .sts file, generated in build_boundary.py |
---|
| 226 | event_sts = join(event_folder, scenario_name) |
---|
| 227 | |
---|
| 228 | # The absolute pathname for the output folder names |
---|
| 229 | # Used for build_elevation.py |
---|
| 230 | output_build = join(output_folder, build_time) + '_' + str(user) |
---|
| 231 | # Used for run_model.py |
---|
| 232 | output_run = join(output_folder, run_time) + output_comment |
---|
| 233 | # Used by post processing |
---|
| 234 | output_run_time = join(output_run, scenario_name) |
---|
| 235 | |
---|
| 236 | # The absolute pathname for the gauges file |
---|
| 237 | # Used for get_timeseries.py |
---|
| 238 | if gauges_filename: |
---|
| 239 | gauges = join(gauges_folder, gauges_filename) |
---|
| 240 | |
---|
| 241 | # The absolute pathname for the building file |
---|
| 242 | # Used for run_building_inundation.py |
---|
| 243 | if building_exposure_filename: |
---|
| 244 | building_exposure = join(gauges_folder, building_exposure_filename) |
---|
| 245 | |
---|
| 246 | # full path to where MUX files (or meta-files) live |
---|
| 247 | mux_input = join(event_folder, mux_input_filename) |
---|
| 248 | |
---|
[6499] | 249 | #Multiple polygons in one CSV file to make internal polygons |
---|
| 250 | PriorityAreas = join(polygons_folder, PriorityArea_filename) |
---|
| 251 | |
---|
| 252 | |
---|