[6567] | 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 = 'busselton' |
---|
| 20 | scenario_folder = 'busselton_tsunami_scenario' |
---|
| 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 |
---|
[6984] | 28 | tide = 0.6 # difference between MSL and HAT in metres |
---|
[6567] | 29 | zone = 50 # specify zone of model |
---|
[6984] | 30 | event_number = 27255 # the event number or the mux file name |
---|
[6567] | 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=80000 # 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 | |
---|
[6678] | 52 | output_comment = [setup, tide, event_number, 'Bt'] |
---|
[6567] | 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 |
---|
| 61 | ascii_grid_filenames = ['busselton_v2', # Topo |
---|
[6984] | 62 | 'grid_250m_clip', |
---|
| 63 | 'grid_250m_clip2'] # Busselton Topo |
---|
[6567] | 64 | |
---|
| 65 | # Format for point is x,y,elevation (with header) |
---|
| 66 | point_filenames = ['Busselton_Contour0.txt', # Coastline |
---|
| 67 | 'Busselton_BeachSurvey.txt', # Beach survey |
---|
| 68 | 'Busselton_NavyFinal.txt', # Bathymetry |
---|
| 69 | 'Busselton_Chart.txt', # Bathymetry Charts |
---|
| 70 | 'Busselton_Digitised.txt', # Digitised Fairsheet |
---|
| 71 | 'Busselton_250m.txt', # 250m |
---|
| 72 | 'Bunbury_TIN.txt', # Bunbury aoi TIN'd in ArcGIS |
---|
| 73 | 'Busselton_TIN.txt', # Busselton aoi TIN'd in ArcGIS |
---|
| 74 | 'XYAHD_clip.txt'] # To extend boundary |
---|
| 75 | |
---|
| 76 | ### Add csv header list to all files in point_filenames |
---|
| 77 | ##headerlist = ['x', 'y', 'elevation'] |
---|
| 78 | ##for f in point_filenames: |
---|
| 79 | ## add_csv_header(join(topographies_folder, f), headerlist) |
---|
| 80 | |
---|
| 81 | # BOUNDING POLYGON - for data clipping and estimate of triangles in mesh |
---|
| 82 | # Used in build_elevation.py |
---|
| 83 | # Format for points easting,northing (no header) |
---|
[6984] | 84 | bounding_polygon_filename = 'bounding_polygon_new.csv' |
---|
[6567] | 85 | bounding_polygon_maxarea = 100000 |
---|
| 86 | |
---|
| 87 | # INTERIOR REGIONS - for designing the mesh |
---|
| 88 | # Used in run_model.py |
---|
| 89 | # Format for points easting,northing (no header) |
---|
| 90 | interior_regions_data = [['busselton_1km.csv', 500], |
---|
| 91 | ['bunbury_1km.csv', 500], |
---|
| 92 | ['busselton_2km.csv', 10000], |
---|
| 93 | ['bunbury_2km.csv', 10000], |
---|
| 94 | ['island1.csv', 10000], |
---|
| 95 | ['island2.csv', 10000], |
---|
| 96 | ['coast_5km_d20m.csv', 40000]] |
---|
| 97 | |
---|
| 98 | # LAND - used to set the initial stage/water to be offcoast only |
---|
| 99 | # Used in run_model.py. Format for points easting,northing (no header) |
---|
[6984] | 100 | land_initial_conditions_filename = [['initial_condition_new.csv', 0], |
---|
[6567] | 101 | ['initial_condition_marina.csv', 0]] |
---|
| 102 | |
---|
| 103 | # GAUGES - for creating timeseries at a specific point |
---|
| 104 | # Used in get_timeseries.py. |
---|
| 105 | # Format easting,northing,name,elevation (with header) |
---|
[6716] | 106 | gauges_filename = 'MH_gauges2.csv' |
---|
[6567] | 107 | |
---|
| 108 | # BUILDINGS EXPOSURE - for identifying inundated houses |
---|
| 109 | # Used in run_building_inundation.py |
---|
| 110 | # Format latitude,longitude etc (geographic) |
---|
| 111 | building_exposure_filename = 'busselton_res_clip.csv' # from NEXIS |
---|
| 112 | |
---|
[7119] | 113 | # AREA OF IMAGES - Extent of each image to find out highest runup |
---|
| 114 | # Header - easting,northing,id,value |
---|
| 115 | # Used in get_runup.py |
---|
| 116 | images_filename = 'define_area_clip.csv' |
---|
| 117 | |
---|
[6567] | 118 | # BOUNDING POLYGON - used in build_boundary.py and run_model.py respectively |
---|
| 119 | # NOTE: when files are put together the points must be in sequence |
---|
| 120 | # For ease go clockwise! |
---|
| 121 | # Check the run_model.py for boundary_tags |
---|
| 122 | |
---|
| 123 | # Thinned ordering file from Hazard Map (geographic) |
---|
| 124 | # Format is index,latitude,longitude (with header) |
---|
| 125 | urs_order_filename = 'thinned_boundary_ordering_extend.csv' |
---|
| 126 | |
---|
| 127 | # Landward bounding points |
---|
| 128 | # Format easting,northing (no header) |
---|
[6984] | 129 | landward_boundary_filename = 'landward_boundary_new.csv' |
---|
[6567] | 130 | |
---|
| 131 | # MUX input filename. |
---|
| 132 | # If a meta-file from EventSelection is used, set 'multi-mux' to True. |
---|
| 133 | # If a single MUX stem filename (*.grd) is used, set 'multi-mux' to False. |
---|
| 134 | ##mux_input_filename = event_number # to be found in event_folder |
---|
| 135 | # (ie boundaries/event_number/) |
---|
| 136 | ##multi_mux = False |
---|
| 137 | mux_input_filename = 'event.list' |
---|
| 138 | multi_mux = True |
---|
| 139 | |
---|
| 140 | #------------------------------------------------------------------------------- |
---|
| 141 | # Clipping regions for export to asc and regions for clipping data |
---|
| 142 | # Final inundation maps should only be created in regions of the finest mesh |
---|
| 143 | #------------------------------------------------------------------------------- |
---|
| 144 | |
---|
| 145 | # ASCII export grid for Busselton |
---|
| 146 | xminBusselton = 340000 |
---|
| 147 | xmaxBusselton = 352000 |
---|
| 148 | yminBusselton = 6271500 |
---|
| 149 | ymaxBusselton = 6280000 |
---|
| 150 | |
---|
| 151 | # ASCII export grid for Bunbury |
---|
| 152 | xminBunbury = 369000 |
---|
| 153 | xmaxBunbury = 381000 |
---|
| 154 | yminBunbury = 6308000 |
---|
| 155 | ymaxBunbury = 6316500 |
---|
| 156 | |
---|
| 157 | ################################################################################ |
---|
| 158 | ################################################################################ |
---|
| 159 | #### NOTE: NOTHING WOULD NORMALLY CHANGE BELOW THIS POINT. #### |
---|
| 160 | ################################################################################ |
---|
| 161 | ################################################################################ |
---|
| 162 | |
---|
| 163 | # Get system user and host names. |
---|
| 164 | # These values can be used to distinguish between two similar runs by two |
---|
| 165 | # different users or runs by the same user on two different machines. |
---|
| 166 | user = get_user_name() |
---|
| 167 | host = get_host_name() |
---|
| 168 | |
---|
| 169 | # Environment variable names. |
---|
| 170 | # The inundation directory, not the data directory. |
---|
| 171 | ENV_INUNDATIONHOME = 'INUNDATIONHOME' |
---|
| 172 | |
---|
| 173 | # Path to MUX data |
---|
| 174 | ENV_MUXHOME = 'MUXHOME' |
---|
| 175 | |
---|
| 176 | #------------------------------------------------------------------------------- |
---|
| 177 | # Output Elevation Data |
---|
| 178 | #------------------------------------------------------------------------------- |
---|
| 179 | |
---|
| 180 | # Output filename for elevation |
---|
| 181 | # this is a combination of all the data generated in build_elevation.py |
---|
| 182 | combined_elevation_basename = scenario_name + '_combined_elevation' |
---|
| 183 | |
---|
| 184 | #------------------------------------------------------------------------------- |
---|
| 185 | # Directory Structure |
---|
| 186 | #------------------------------------------------------------------------------- |
---|
| 187 | |
---|
| 188 | # determines time for setting up output directories |
---|
| 189 | time = strftime('%Y%m%d_%H%M%S', localtime()) |
---|
| 190 | gtime = strftime('%Y%m%d_%H%M%S', gmtime()) |
---|
| 191 | build_time = time + '_build' |
---|
| 192 | run_time = time + '_run_' |
---|
| 193 | |
---|
| 194 | # create paths generated from environment variables. |
---|
| 195 | home = join(os.getenv(ENV_INUNDATIONHOME), 'data') # Absolute path for data folder |
---|
| 196 | muxhome = os.getenv(ENV_MUXHOME) |
---|
| 197 | |
---|
| 198 | # check various directories/files that must exist |
---|
| 199 | anuga_folder = join(home, state, scenario_folder, 'anuga') |
---|
| 200 | topographies_folder = join(anuga_folder, 'topographies') |
---|
| 201 | polygons_folder = join(anuga_folder, 'polygons') |
---|
| 202 | boundaries_folder = join(anuga_folder, 'boundaries') |
---|
| 203 | output_folder = join(anuga_folder, 'outputs') |
---|
| 204 | gauges_folder = join(anuga_folder, 'gauges') |
---|
| 205 | event_folder = join(boundaries_folder, str(event_number)) |
---|
| 206 | |
---|
| 207 | # MUX data files |
---|
| 208 | # Directory containing the MUX data files to be used with EventSelection. |
---|
| 209 | mux_data_folder = join(muxhome, 'mux') |
---|
| 210 | |
---|
| 211 | #------------------------------------------------------------------------------- |
---|
| 212 | # Location of input and output data |
---|
| 213 | #------------------------------------------------------------------------------- |
---|
| 214 | |
---|
| 215 | # Convert the user output_comment to a string for run_model.py |
---|
| 216 | output_comment = ('_'.join([str(x) for x in output_comment if x != user]) |
---|
| 217 | + '_' + user) |
---|
| 218 | |
---|
| 219 | # The absolute pathname of the all elevation, generated in build_elevation.py |
---|
| 220 | combined_elevation = join(topographies_folder, combined_elevation_basename) |
---|
| 221 | |
---|
| 222 | # The pathname for the urs order points, used within build_urs_boundary.py |
---|
| 223 | if urs_order_filename: |
---|
| 224 | urs_order = join(boundaries_folder, urs_order_filename) |
---|
| 225 | |
---|
| 226 | # The absolute pathname for the landward points of the bounding polygon, |
---|
| 227 | # Used within run_model.py) |
---|
| 228 | if landward_boundary_filename: |
---|
| 229 | landward_boundary = join(boundaries_folder, landward_boundary_filename) |
---|
| 230 | |
---|
| 231 | # The absolute pathname for the .sts file, generated in build_boundary.py |
---|
| 232 | event_sts = join(event_folder, scenario_name) |
---|
| 233 | |
---|
| 234 | # The absolute pathname for the output folder names |
---|
| 235 | # Used for build_elevation.py |
---|
| 236 | output_build = join(output_folder, build_time) + '_' + str(user) |
---|
| 237 | # Used for run_model.py |
---|
| 238 | output_run = join(output_folder, run_time) + output_comment |
---|
| 239 | # Used by post processing |
---|
| 240 | output_run_time = join(output_run, scenario_name) |
---|
| 241 | |
---|
| 242 | # The absolute pathname of the mesh, generated in run_model.py |
---|
| 243 | meshes = join(output_run, scenario_name) + '.msh' |
---|
| 244 | |
---|
| 245 | # The absolute pathname for the gauges file |
---|
| 246 | # Used for get_timeseries.py |
---|
| 247 | if gauges_filename: |
---|
| 248 | gauges = join(gauges_folder, gauges_filename) |
---|
| 249 | |
---|
| 250 | # The absolute pathname for the building file |
---|
| 251 | # Used for run_building_inundation.py |
---|
| 252 | if building_exposure_filename: |
---|
| 253 | building_exposure = join(gauges_folder, building_exposure_filename) |
---|
| 254 | |
---|
[7119] | 255 | # The absolute pathname for the image file |
---|
| 256 | # Used for get_runup.py |
---|
| 257 | if images_filename: |
---|
| 258 | images = join(polygons_folder, images_filename) |
---|
| 259 | |
---|
[6567] | 260 | # full path to where MUX files (or meta-files) live |
---|
| 261 | mux_input = join(event_folder, mux_input_filename) |
---|
| 262 | |
---|