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