[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 | |
---|
[6984] | 11 | #------------------------------------------------------------------------------- |
---|
| 12 | # Fitting Scenario |
---|
| 13 | #------------------------------------------------------------------------------- |
---|
[6457] | 14 | |
---|
[6984] | 15 | extent = None #'small' #None #'sw' # 'aos1' ##'aos1' |
---|
| 16 | extent_maxarea = 30000 |
---|
| 17 | |
---|
[6457] | 18 | #------------------------------------------------------------------------------- |
---|
| 19 | # Directory setup |
---|
| 20 | #------------------------------------------------------------------------------- |
---|
| 21 | |
---|
| 22 | # this section needs to be updated to reflect the modelled community. |
---|
| 23 | # Note, the user needs to set up the directory system accordingly |
---|
| 24 | state = 'tasmania' |
---|
| 25 | scenario_name = 'hobart' |
---|
| 26 | scenario_folder = 'hobart_tsunami_scenario_2009' |
---|
| 27 | |
---|
| 28 | #------------------------------------------------------------------------------- |
---|
| 29 | # Initial Conditions |
---|
| 30 | #------------------------------------------------------------------------------- |
---|
| 31 | |
---|
| 32 | # Model specific parameters. |
---|
| 33 | # One or all can be changed each time the run_model script is executed |
---|
| 34 | tide = 0 # difference between MSL and HAT in metres |
---|
[6984] | 35 | zone = 55 # specify UTM zone of model |
---|
| 36 | event_number = 64477 # 58280, 64477 the event number or the mux file name |
---|
[6457] | 37 | alpha = 0.1 # smoothing parameter for mesh |
---|
| 38 | friction=0.01 # manning's friction coefficient |
---|
| 39 | starttime=0 # start time for simulation |
---|
[6984] | 40 | finaltime=65000 # final time for simulation |
---|
[6457] | 41 | |
---|
| 42 | setup = 'final' # This can be one of three values |
---|
| 43 | # trial - coarsest mesh, fast |
---|
| 44 | # basic - coarse mesh |
---|
| 45 | # final - fine mesh, slowest |
---|
| 46 | |
---|
| 47 | #------------------------------------------------------------------------------- |
---|
| 48 | # Output filename |
---|
| 49 | # |
---|
| 50 | # Your output filename should be unique between different runs on different data. |
---|
| 51 | # The list of items below will be used to create a file in your output directory. |
---|
| 52 | # Your user name and time+date will be automatically added. For example, |
---|
| 53 | # [setup, tide, event_number] |
---|
| 54 | # will result in a filename like |
---|
| 55 | # 20090212_091046_run_final_0_27283_rwilson |
---|
| 56 | #------------------------------------------------------------------------------- |
---|
| 57 | |
---|
[6984] | 58 | output_comment = [setup, tide, event_number, extent] |
---|
[6457] | 59 | |
---|
| 60 | #------------------------------------------------------------------------------- |
---|
| 61 | # Input Data |
---|
| 62 | #------------------------------------------------------------------------------- |
---|
| 63 | |
---|
| 64 | # ELEVATION DATA |
---|
| 65 | # Used in build_elevation.py |
---|
[6984] | 66 | if extent == None: |
---|
| 67 | ascii_grid_filenames = ['topo_grid_notsw', 'fitting_problem_sw_elevation'] |
---|
| 68 | point_filenames = [] |
---|
| 69 | elif extent == 'sw': |
---|
| 70 | # Format for ascii grids, as produced in ArcGIS + a projection file |
---|
| 71 | ascii_grid_filenames = ['hob3_pro_extract', 'grid_250m_project', 'ldr_bbay', |
---|
| 72 | 'ldr_bellerive', 'ldr_brunyislandneck', |
---|
| 73 | 'ldr_calvertsbeach', 'ldr_carltonbeach', |
---|
| 74 | 'ldr_connelly', 'ldr_cremorne', 'ldr_dodge1', |
---|
| 75 | 'ldr_dodge2', 'ldr_kingston', 'ldr_lauderdale', |
---|
| 76 | 'ldr_linersfarne', 'ldr_oppossumbay', 'ldr_primrose', |
---|
| 77 | 'ldr_rosny', 'ldr_sandybay', 'ldr_selfspoint', |
---|
| 78 | 'ldr_sevenmile', 'ldr_southarm1', 'ldr_southarm2', |
---|
| 79 | 'ldr_sullivanscove', 'ldr_tranmere', 'tasdem_mask'] |
---|
[6457] | 80 | |
---|
[6984] | 81 | # Format for point is x,y,elevation (with header) |
---|
| 82 | point_filenames = ['Topo_1.txt','Topo_2.txt','Topo_3.txt', |
---|
| 83 | 'tasmania_data.txt', # The data from Tasmania |
---|
| 84 | 'hydro_data.txt'] # Data from Hydro |
---|
[6457] | 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' |
---|
[6499] | 95 | bounding_polygon_maxarea = 1000000 |
---|
[6457] | 96 | |
---|
| 97 | # INTERIOR REGIONS - for designing the mesh |
---|
| 98 | # Used in run_model.py |
---|
| 99 | # Format for points easting,northing (no header) |
---|
[6984] | 100 | if extent == 'sw': |
---|
| 101 | interior_regions_data = [['aos1.csv', 1500], |
---|
| 102 | ['aos2.csv', 1500]] |
---|
| 103 | PriorityArea_filename = 'PriorityAreas.csv' |
---|
| 104 | elif extent == 'aos1': |
---|
| 105 | interior_regions_data = [] |
---|
| 106 | PriorityArea_filename = 'PriorityAreas_aos1.csv' |
---|
| 107 | elif extent == 'aos2': |
---|
| 108 | interior_regions_data = [] |
---|
| 109 | PriorityArea_filename = 'PriorityAreas_aos2.csv' |
---|
| 110 | elif extent == 'small': |
---|
| 111 | interior_regions_data = [['aoi_bruny.csv', 500], |
---|
| 112 | ['aoi_S_arms.csv', 500], |
---|
| 113 | ['aos1_small.csv', 1500], |
---|
| 114 | ['aos2.csv', 1500], |
---|
| 115 | ['sw.csv', 30000]] |
---|
| 116 | PriorityArea_filename = None |
---|
| 117 | elif extent == None: |
---|
| 118 | interior_regions_data = [['aos1.csv', 1500], |
---|
| 119 | ['aos2.csv', 1500], |
---|
| 120 | ['sw.csv', 30000]] |
---|
| 121 | PriorityArea_filename = 'PriorityAreas.csv' |
---|
| 122 | |
---|
[6457] | 123 | # LAND - used to set the initial stage/water to be offcoast only |
---|
| 124 | # Used in run_model.py. Format for points easting,northing (no header) |
---|
| 125 | land_initial_conditions_filename = [] |
---|
| 126 | |
---|
| 127 | # GAUGES - for creating timeseries at a specific point |
---|
| 128 | # Used in get_timeseries.py. |
---|
| 129 | # Format easting,northing,name,elevation (with header) |
---|
[7120] | 130 | gauges_filename = 'time_of_arrival_hobart.csv' #'TideGaugesPoints.csv' #'tsunamipointsMGA.csv' |
---|
[6457] | 131 | |
---|
| 132 | # BUILDINGS EXPOSURE - for identifying inundated houses |
---|
| 133 | # Used in run_building_inundation.py |
---|
| 134 | # Format latitude,longitude etc (geographic) |
---|
| 135 | building_exposure_filename = 'busselton_res_clip.csv' # from NEXIS |
---|
| 136 | |
---|
[7082] | 137 | # AREA OF IMAGES - Extent of each image to find out highest runup |
---|
[7120] | 138 | # Header - easting,northing,id,value |
---|
[7082] | 139 | # Used in get_runup.py |
---|
| 140 | images_filename = 'images.csv' |
---|
| 141 | |
---|
[6457] | 142 | # BOUNDING POLYGON - used in build_boundary.py and run_model.py respectively |
---|
| 143 | # NOTE: when files are put together the points must be in sequence |
---|
| 144 | # For ease go clockwise! |
---|
| 145 | # Check the run_model.py for boundary_tags |
---|
| 146 | |
---|
| 147 | # Thinned ordering file from Hazard Map (geographic) |
---|
| 148 | # Format is index,latitude,longitude (with header) |
---|
| 149 | urs_order_filename = 'urs_order.csv' |
---|
| 150 | |
---|
| 151 | # Landward bounding points |
---|
| 152 | # Format easting,northing (no header) |
---|
| 153 | landward_boundary_filename = 'landward_boundary.csv' |
---|
| 154 | |
---|
| 155 | # MUX input filename. |
---|
| 156 | # If a meta-file from EventSelection is used, set 'multi-mux' to True. |
---|
| 157 | # If a single MUX stem filename (*.grd) is used, set 'multi-mux' to False. |
---|
| 158 | ##mux_input_filename = event_number # to be found in event_folder |
---|
| 159 | # (ie boundaries/event_number/) |
---|
| 160 | ##multi_mux = False |
---|
| 161 | mux_input_filename = 'event.list' |
---|
| 162 | multi_mux = True |
---|
| 163 | |
---|
| 164 | #------------------------------------------------------------------------------- |
---|
| 165 | # Clipping regions for export to asc and regions for clipping data |
---|
| 166 | # Final inundation maps should only be created in regions of the finest mesh |
---|
| 167 | #------------------------------------------------------------------------------- |
---|
| 168 | |
---|
[6984] | 169 | # ASCII export grid for Bruny |
---|
| 170 | xminBruny = 523900 |
---|
| 171 | xmaxBruny = 533200 |
---|
| 172 | yminBruny = 5204300 |
---|
| 173 | ymaxBruny = 5213100 |
---|
[6457] | 174 | |
---|
[6984] | 175 | # ASCII export grid for South Arms |
---|
| 176 | xminSArms = 532497 |
---|
| 177 | xmaxSArms = 534326 |
---|
| 178 | yminSArms = 5237028 |
---|
| 179 | ymaxSArms = 5238465 |
---|
[6457] | 180 | |
---|
[7082] | 181 | # ASCII export grid for Hobart Large |
---|
| 182 | xminHobart = 520000 |
---|
| 183 | xmaxHobart = 545000 |
---|
| 184 | yminHobart = 5230000 |
---|
| 185 | ymaxHobart = 5260000 |
---|
[6984] | 186 | |
---|
[7082] | 187 | # ASCII export grid for North West Communities |
---|
| 188 | xminNW = 548000 |
---|
| 189 | xmaxNW = 561000 |
---|
| 190 | yminNW = 5250000 |
---|
| 191 | ymaxNW = 5258000 |
---|
| 192 | |
---|
| 193 | # ASCII export grid for South Communities |
---|
| 194 | xminSouth = 523000 |
---|
| 195 | xmaxSouth = 533300 |
---|
| 196 | yminSouth = 5197000 |
---|
| 197 | ymaxSouth = 5214000 |
---|
| 198 | |
---|
| 199 | |
---|
[6457] | 200 | ################################################################################ |
---|
| 201 | ################################################################################ |
---|
| 202 | #### NOTE: NOTHING WOULD NORMALLY CHANGE BELOW THIS POINT. #### |
---|
| 203 | ################################################################################ |
---|
| 204 | ################################################################################ |
---|
| 205 | |
---|
| 206 | # Get system user and host names. |
---|
| 207 | # These values can be used to distinguish between two similar runs by two |
---|
| 208 | # different users or runs by the same user on two different machines. |
---|
| 209 | user = get_user_name() |
---|
| 210 | host = get_host_name() |
---|
| 211 | |
---|
| 212 | # Environment variable names. |
---|
| 213 | # The inundation directory, not the data directory. |
---|
| 214 | ENV_INUNDATIONHOME = 'INUNDATIONHOME' |
---|
| 215 | |
---|
| 216 | # Path to MUX data |
---|
| 217 | ENV_MUXHOME = 'MUXHOME' |
---|
| 218 | |
---|
| 219 | #------------------------------------------------------------------------------- |
---|
| 220 | # Output Elevation Data |
---|
| 221 | #------------------------------------------------------------------------------- |
---|
| 222 | |
---|
| 223 | # Output filename for elevation |
---|
| 224 | # this is a combination of all the data generated in build_elevation.py |
---|
| 225 | combined_elevation_basename = scenario_name + '_combined_elevation' |
---|
| 226 | |
---|
| 227 | #------------------------------------------------------------------------------- |
---|
| 228 | # Directory Structure |
---|
| 229 | #------------------------------------------------------------------------------- |
---|
| 230 | |
---|
| 231 | # determines time for setting up output directories |
---|
| 232 | time = strftime('%Y%m%d_%H%M%S', localtime()) |
---|
| 233 | gtime = strftime('%Y%m%d_%H%M%S', gmtime()) |
---|
| 234 | build_time = time + '_build' |
---|
| 235 | run_time = time + '_run_' |
---|
| 236 | |
---|
| 237 | # create paths generated from environment variables. |
---|
| 238 | home = join(os.getenv(ENV_INUNDATIONHOME), 'data') # Absolute path for data folder |
---|
| 239 | muxhome = os.getenv(ENV_MUXHOME) |
---|
| 240 | |
---|
| 241 | # check various directories/files that must exist |
---|
| 242 | anuga_folder = join(home, state, scenario_folder, 'anuga') |
---|
| 243 | topographies_folder = join(anuga_folder, 'topographies') |
---|
| 244 | polygons_folder = join(anuga_folder, 'polygons') |
---|
| 245 | boundaries_folder = join(anuga_folder, 'boundaries') |
---|
| 246 | output_folder = join(anuga_folder, 'outputs') |
---|
| 247 | gauges_folder = join(anuga_folder, 'gauges') |
---|
| 248 | event_folder = join(boundaries_folder, str(event_number)) |
---|
| 249 | |
---|
| 250 | # MUX data files |
---|
| 251 | # Directory containing the MUX data files to be used with EventSelection. |
---|
| 252 | mux_data_folder = join(muxhome, 'mux') |
---|
| 253 | |
---|
| 254 | #------------------------------------------------------------------------------- |
---|
| 255 | # Location of input and output data |
---|
| 256 | #------------------------------------------------------------------------------- |
---|
| 257 | |
---|
| 258 | # Convert the user output_comment to a string for run_model.py |
---|
| 259 | output_comment = ('_'.join([str(x) for x in output_comment if x != user]) |
---|
| 260 | + '_' + user) |
---|
| 261 | |
---|
| 262 | # The absolute pathname of the all elevation, generated in build_elevation.py |
---|
| 263 | combined_elevation = join(topographies_folder, combined_elevation_basename) |
---|
| 264 | |
---|
| 265 | # The pathname for the urs order points, used within build_urs_boundary.py |
---|
| 266 | if urs_order_filename: |
---|
| 267 | urs_order = join(boundaries_folder, urs_order_filename) |
---|
| 268 | |
---|
| 269 | # The absolute pathname for the landward points of the bounding polygon, |
---|
| 270 | # Used within run_model.py) |
---|
| 271 | if landward_boundary_filename: |
---|
| 272 | landward_boundary = join(boundaries_folder, landward_boundary_filename) |
---|
| 273 | |
---|
| 274 | # The absolute pathname for the .sts file, generated in build_boundary.py |
---|
| 275 | event_sts = join(event_folder, scenario_name) |
---|
| 276 | |
---|
| 277 | # The absolute pathname for the output folder names |
---|
| 278 | # Used for build_elevation.py |
---|
| 279 | output_build = join(output_folder, build_time) + '_' + str(user) |
---|
| 280 | # Used for run_model.py |
---|
| 281 | output_run = join(output_folder, run_time) + output_comment |
---|
| 282 | # Used by post processing |
---|
| 283 | output_run_time = join(output_run, scenario_name) |
---|
| 284 | |
---|
[6984] | 285 | # The absolute pathname of the mesh, generated in run_model.py |
---|
| 286 | meshes = join(output_run, scenario_name) + '.msh' |
---|
| 287 | |
---|
[6457] | 288 | # The absolute pathname for the gauges file |
---|
| 289 | # Used for get_timeseries.py |
---|
| 290 | if gauges_filename: |
---|
| 291 | gauges = join(gauges_folder, gauges_filename) |
---|
| 292 | |
---|
| 293 | # The absolute pathname for the building file |
---|
| 294 | # Used for run_building_inundation.py |
---|
| 295 | if building_exposure_filename: |
---|
| 296 | building_exposure = join(gauges_folder, building_exposure_filename) |
---|
| 297 | |
---|
[7082] | 298 | # The absolute pathname for the image file |
---|
| 299 | # Used for get_runup.py |
---|
| 300 | if images_filename: |
---|
| 301 | images = join(polygons_folder, images_filename) |
---|
| 302 | |
---|
| 303 | |
---|
[6457] | 304 | # full path to where MUX files (or meta-files) live |
---|
| 305 | mux_input = join(event_folder, mux_input_filename) |
---|
| 306 | |
---|
[6499] | 307 | #Multiple polygons in one CSV file to make internal polygons |
---|
[6984] | 308 | if not PriorityArea_filename == None: |
---|
| 309 | PriorityAreas = join(polygons_folder, PriorityArea_filename) |
---|
[6499] | 310 | |
---|
| 311 | |
---|