[7209] | 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 |
---|
[7254] | 10 | from anuga.lib.add_csv_header.add_csv_header import add_csv_header |
---|
[7209] | 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 = 'exmouth' |
---|
| 20 | scenario_folder = 'exmouth_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 # 3.6 difference between MSL and HAT in metres |
---|
[7238] | 29 | zone = None # specify UTM zone of model |
---|
| 30 | central_meridian = 114.0 |
---|
[7209] | 31 | event_number = 27283 # 27255,27283 the event number or the mux file name |
---|
| 32 | alpha = 0.1 # smoothing parameter for mesh |
---|
| 33 | friction=0.01 # manning's friction coefficient |
---|
| 34 | starttime=0 # start time for simulation |
---|
| 35 | finaltime=1000 # final time for simulation |
---|
| 36 | |
---|
[7261] | 37 | setup = 'final' # This can be one of three values |
---|
[7209] | 38 | # trial - coarsest mesh, fast |
---|
| 39 | # basic - coarse mesh |
---|
| 40 | # final - fine mesh, slowest |
---|
| 41 | |
---|
| 42 | #------------------------------------------------------------------------------- |
---|
| 43 | # Output filename |
---|
| 44 | # |
---|
| 45 | # Your output filename should be unique between different runs on different data. |
---|
| 46 | # The list of items below will be used to create a file in your output directory. |
---|
| 47 | # Your user name and time+date will be automatically added. For example, |
---|
| 48 | # [setup, tide, event_number] |
---|
| 49 | # will result in a filename like |
---|
| 50 | # 20090212_091046_run_final_0_27283_rwilson |
---|
| 51 | #------------------------------------------------------------------------------- |
---|
| 52 | |
---|
| 53 | output_comment = [setup, tide, event_number] |
---|
| 54 | |
---|
| 55 | #------------------------------------------------------------------------------- |
---|
| 56 | # Input Data |
---|
| 57 | #------------------------------------------------------------------------------- |
---|
| 58 | |
---|
| 59 | # ELEVATION DATA |
---|
| 60 | # Used in build_elevation.py |
---|
| 61 | # Format for ascii grids, as produced in ArcGIS + a projection file |
---|
[7254] | 62 | ##ascii_grid_filenames = ['extract_dli', |
---|
| 63 | ## 'extract_dted'] |
---|
| 64 | ascii_grid_filenames = [] |
---|
[7209] | 65 | |
---|
| 66 | # Format for point is x,y,elevation (with header) |
---|
[7274] | 67 | point_filenames = ['coastline.txt', # coastline points with 0m elevation |
---|
| 68 | 'Exmouth.txt', # combined bathymetry for most of model |
---|
| 69 | 'extract_dgapcs100.txt', # interpolated bathy. for gap in data just NE of Exmouth itself |
---|
| 70 | 'extract_rivoli.txt', # interpolated bathy. for gap in data near Rivoli islands |
---|
| 71 | 'extract_dli.txt', # onshore elevation data |
---|
| 72 | 'extract_dted.txt', # more onshore elevation data |
---|
| 73 | 'exmouth_aoi_aos_gridded.txt'] # fine grid of data interpolated from Exmouth.txt for use in refined grids (aoi and aos) |
---|
[7209] | 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) |
---|
[7254] | 83 | bounding_polygon_filename = 'poly_all_MH.csv' |
---|
[7209] | 84 | bounding_polygon_maxarea = 100000 |
---|
| 85 | |
---|
| 86 | # INTERIOR REGIONS - for designing the mesh |
---|
| 87 | # Used in run_model.py |
---|
| 88 | # Format for points easting,northing (no header) |
---|
| 89 | interior_regions_data = [['sw_MH.csv', 3000], |
---|
| 90 | ['aos_MH.csv', 800], |
---|
[7274] | 91 | ['aoi_small_MH.csv', 500], |
---|
[7209] | 92 | ['island1_MH.csv', 3000], |
---|
| 93 | ['island2_MH.csv', 3000], |
---|
| 94 | ['island3_MH.csv', 3000], |
---|
| 95 | ['island4_MH.csv', 3000], |
---|
[7238] | 96 | ['island5_MH.csv', 3000]]#, |
---|
| 97 | ## ['island6_MH.csv', 3000]] |
---|
[7209] | 98 | |
---|
| 99 | PriorityArea_filename = None |
---|
| 100 | |
---|
| 101 | # LAND - used to set the initial stage/water to be offcoast only |
---|
| 102 | # Used in run_model.py. Format for points easting,northing,id,value |
---|
[7238] | 103 | land_initial_conditions_filename = 'initial_condition_comb.csv' |
---|
[7209] | 104 | |
---|
| 105 | # GAUGES - for creating timeseries at a specific point |
---|
| 106 | # Used in get_timeseries.py. |
---|
| 107 | # Format easting,northing,name,elevation (with header) |
---|
| 108 | gauges_filename = '' |
---|
| 109 | # BUILDINGS EXPOSURE - for identifying inundated houses |
---|
| 110 | # Used in run_building_inundation.py |
---|
| 111 | # Format latitude,longitude etc (geographic) |
---|
| 112 | building_exposure_filename = 'busselton_res_clip.csv' # from NEXIS |
---|
| 113 | |
---|
| 114 | # AREA OF IMAGES - Extent of each image to find out highest runup |
---|
| 115 | # Header - easting,northing,id,value |
---|
| 116 | # Used in get_runup.py |
---|
| 117 | images_filename = '' |
---|
| 118 | |
---|
| 119 | # BOUNDING POLYGON - used in build_boundary.py and run_model.py respectively |
---|
| 120 | # NOTE: when files are put together the points must be in sequence |
---|
| 121 | # For ease go clockwise! |
---|
| 122 | # Check the run_model.py for boundary_tags |
---|
| 123 | |
---|
| 124 | # Thinned ordering file from Hazard Map (geographic) |
---|
| 125 | # Format is index,latitude,longitude (with header) |
---|
| 126 | urs_order_filename = 'thinned_boundary_ordering.csv' |
---|
| 127 | |
---|
| 128 | # Landward bounding points |
---|
| 129 | # Format easting,northing (no header) |
---|
| 130 | landward_boundary_filename = 'landward_bounding_polygon.csv' |
---|
| 131 | |
---|
| 132 | # MUX input filename. |
---|
| 133 | # If a meta-file from EventSelection is used, set 'multi-mux' to True. |
---|
| 134 | # If a single MUX stem filename (*.grd) is used, set 'multi-mux' to False. |
---|
| 135 | ##mux_input_filename = event_number # to be found in event_folder |
---|
| 136 | # (ie boundaries/event_number/) |
---|
| 137 | ##multi_mux = False |
---|
| 138 | mux_input_filename = 'event.list' |
---|
| 139 | multi_mux = True |
---|
| 140 | |
---|
| 141 | #------------------------------------------------------------------------------- |
---|
| 142 | # Clipping regions for export to asc and regions for clipping data |
---|
| 143 | # Final inundation maps should only be created in regions of the finest mesh |
---|
| 144 | #------------------------------------------------------------------------------- |
---|
| 145 | |
---|
[7261] | 146 | # ASCII export grid for Exmouth |
---|
| 147 | xminExmouth = 511616 |
---|
| 148 | xmaxExmouth = 516764 |
---|
| 149 | yminExmouth = 7568731 |
---|
| 150 | ymaxExmouth = 7577540 |
---|
[7209] | 151 | |
---|
| 152 | |
---|
| 153 | ################################################################################ |
---|
| 154 | ################################################################################ |
---|
| 155 | #### NOTE: NOTHING WOULD NORMALLY CHANGE BELOW THIS POINT. #### |
---|
| 156 | ################################################################################ |
---|
| 157 | ################################################################################ |
---|
| 158 | |
---|
| 159 | # Get system user and host names. |
---|
| 160 | # These values can be used to distinguish between two similar runs by two |
---|
| 161 | # different users or runs by the same user on two different machines. |
---|
| 162 | user = get_user_name() |
---|
| 163 | host = get_host_name() |
---|
| 164 | |
---|
| 165 | # Environment variable names. |
---|
| 166 | # The inundation directory, not the data directory. |
---|
| 167 | ENV_INUNDATIONHOME = 'INUNDATIONHOME' |
---|
| 168 | |
---|
| 169 | # Path to MUX data |
---|
| 170 | ENV_MUXHOME = 'MUXHOME' |
---|
| 171 | |
---|
| 172 | #------------------------------------------------------------------------------- |
---|
| 173 | # Output Elevation Data |
---|
| 174 | #------------------------------------------------------------------------------- |
---|
| 175 | |
---|
| 176 | # Output filename for elevation |
---|
| 177 | # this is a combination of all the data generated in build_elevation.py |
---|
| 178 | combined_elevation_basename = scenario_name + '_combined_elevation' |
---|
| 179 | |
---|
| 180 | #------------------------------------------------------------------------------- |
---|
| 181 | # Directory Structure |
---|
| 182 | #------------------------------------------------------------------------------- |
---|
| 183 | |
---|
| 184 | # determines time for setting up output directories |
---|
| 185 | time = strftime('%Y%m%d_%H%M%S', localtime()) |
---|
| 186 | gtime = strftime('%Y%m%d_%H%M%S', gmtime()) |
---|
| 187 | build_time = time + '_build' |
---|
| 188 | run_time = time + '_run_' |
---|
| 189 | |
---|
| 190 | # create paths generated from environment variables. |
---|
| 191 | home = join(os.getenv(ENV_INUNDATIONHOME), 'data') # Absolute path for data folder |
---|
| 192 | muxhome = os.getenv(ENV_MUXHOME) |
---|
| 193 | |
---|
| 194 | # check various directories/files that must exist |
---|
| 195 | anuga_folder = join(home, state, scenario_folder, 'anuga') |
---|
| 196 | topographies_folder = join(anuga_folder, 'topographies') |
---|
| 197 | polygons_folder = join(anuga_folder, 'polygons') |
---|
| 198 | boundaries_folder = join(anuga_folder, 'boundaries') |
---|
| 199 | output_folder = join(anuga_folder, 'outputs') |
---|
| 200 | gauges_folder = join(anuga_folder, 'gauges') |
---|
| 201 | event_folder = join(boundaries_folder, str(event_number)) |
---|
| 202 | |
---|
[7254] | 203 | ### Add csv header list to all files in point_filenames |
---|
| 204 | ##headerlist = ['x', 'y', 'elevation'] |
---|
| 205 | ##for f in point_filenames: |
---|
| 206 | ## add_csv_header(join(topographies_folder, f), headerlist) |
---|
| 207 | |
---|
[7209] | 208 | # MUX data files |
---|
| 209 | # Directory containing the MUX data files to be used with EventSelection. |
---|
| 210 | mux_data_folder = join(muxhome, 'mux') |
---|
| 211 | |
---|
| 212 | #------------------------------------------------------------------------------- |
---|
| 213 | # Location of input and output data |
---|
| 214 | #------------------------------------------------------------------------------- |
---|
| 215 | |
---|
| 216 | # Convert the user output_comment to a string for run_model.py |
---|
| 217 | output_comment = ('_'.join([str(x) for x in output_comment if x != user]) |
---|
| 218 | + '_' + user) |
---|
| 219 | |
---|
| 220 | # The absolute pathname of the all elevation, generated in build_elevation.py |
---|
| 221 | combined_elevation = join(topographies_folder, combined_elevation_basename) |
---|
| 222 | |
---|
| 223 | # The pathname for the urs order points, used within build_urs_boundary.py |
---|
| 224 | if urs_order_filename: |
---|
| 225 | urs_order = join(boundaries_folder, urs_order_filename) |
---|
| 226 | |
---|
| 227 | # The absolute pathname for the landward points of the bounding polygon, |
---|
| 228 | # Used within run_model.py) |
---|
| 229 | if landward_boundary_filename: |
---|
| 230 | landward_boundary = join(boundaries_folder, landward_boundary_filename) |
---|
| 231 | |
---|
| 232 | # The absolute pathname for the .sts file, generated in build_boundary.py |
---|
| 233 | event_sts = join(event_folder, scenario_name) |
---|
| 234 | |
---|
| 235 | # The absolute pathname for the output folder names |
---|
| 236 | # Used for build_elevation.py |
---|
| 237 | output_build = join(output_folder, build_time) + '_' + str(user) |
---|
| 238 | # Used for run_model.py |
---|
| 239 | output_run = join(output_folder, run_time) + output_comment |
---|
| 240 | # Used by post processing |
---|
| 241 | output_run_time = join(output_run, scenario_name) |
---|
| 242 | |
---|
| 243 | # The absolute pathname of the mesh, generated in run_model.py |
---|
| 244 | meshes = join(output_run, scenario_name) + '.msh' |
---|
| 245 | |
---|
| 246 | # The absolute pathname for the gauges file |
---|
| 247 | # Used for get_timeseries.py |
---|
| 248 | if gauges_filename: |
---|
| 249 | gauges = join(gauges_folder, gauges_filename) |
---|
| 250 | |
---|
| 251 | # The absolute pathname for the building file |
---|
| 252 | # Used for run_building_inundation.py |
---|
| 253 | if building_exposure_filename: |
---|
| 254 | building_exposure = join(gauges_folder, building_exposure_filename) |
---|
| 255 | |
---|
| 256 | # The absolute pathname for the image file |
---|
| 257 | # Used for get_runup.py |
---|
| 258 | if images_filename: |
---|
| 259 | images = join(polygons_folder, images_filename) |
---|
| 260 | |
---|
| 261 | |
---|
| 262 | # full path to where MUX files (or meta-files) live |
---|
| 263 | mux_input = join(event_folder, mux_input_filename) |
---|
| 264 | |
---|
| 265 | #Multiple polygons in one CSV file to make internal polygons |
---|
| 266 | if not PriorityArea_filename == None: |
---|
| 267 | PriorityAreas = join(polygons_folder, PriorityArea_filename) |
---|
| 268 | |
---|
| 269 | |
---|