[6308] | 1 | """ |
---|
[6324] | 2 | This file contains all your file and directory definitions |
---|
| 3 | for elevation, meshes and outputs. |
---|
[6253] | 4 | """ |
---|
| 5 | |
---|
[6261] | 6 | import os |
---|
[6324] | 7 | from anuga.utilities.system_tools import get_user_name, get_host_name |
---|
| 8 | from time import localtime, strftime, gmtime |
---|
[6308] | 9 | from os.path import join, exists |
---|
[6253] | 10 | |
---|
| 11 | |
---|
[6308] | 12 | #------------------------------------------------------------------------------- |
---|
| 13 | # Directory setup |
---|
| 14 | #------------------------------------------------------------------------------- |
---|
[6253] | 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' |
---|
[6276] | 20 | scenario_folder = 'busselton_tsunami_scenario' |
---|
[6253] | 21 | |
---|
[6308] | 22 | #------------------------------------------------------------------------------- |
---|
[6279] | 23 | # Initial Conditions |
---|
[6308] | 24 | #------------------------------------------------------------------------------- |
---|
| 25 | |
---|
| 26 | # Model specific parameters. |
---|
| 27 | # One or all can be changed each time the run_model script is executed |
---|
[6324] | 28 | tide = 0 # difference between MSL and HAT |
---|
[6329] | 29 | event_number = 27197 # the event number |
---|
[6253] | 30 | alpha = 0.1 # smoothing parameter for mesh |
---|
| 31 | friction=0.01 # manning's friction coefficient |
---|
[6308] | 32 | starttime=0 # start time for simulation |
---|
[6253] | 33 | finaltime=80000 # final time for simulation |
---|
| 34 | |
---|
[6324] | 35 | setup = 'final' # This can be one of three values |
---|
| 36 | # trial - coarsest mesh, fast |
---|
| 37 | # basic - coarse mesh |
---|
| 38 | # final - fine mesh, slowest |
---|
[6253] | 39 | |
---|
[6308] | 40 | #------------------------------------------------------------------------------- |
---|
[6324] | 41 | # Output filename |
---|
| 42 | # |
---|
| 43 | # Your output filename should be unique between different runs on different data. |
---|
| 44 | # The list of items below will be used to create a file in your output directory. |
---|
| 45 | # Your user name and time+date will be automatically added. For example, |
---|
| 46 | # [setup, tide, event_number] |
---|
| 47 | # will result in a filename like |
---|
| 48 | # 20090212_091046_run_final_0_27283_rwilson |
---|
[6308] | 49 | #------------------------------------------------------------------------------- |
---|
[6253] | 50 | |
---|
[6324] | 51 | output_comment = [setup, tide, event_number] |
---|
[6253] | 52 | |
---|
[6308] | 53 | #------------------------------------------------------------------------------- |
---|
[6253] | 54 | # Input Data |
---|
[6308] | 55 | #------------------------------------------------------------------------------- |
---|
| 56 | |
---|
[6279] | 57 | # ELEVATION DATA |
---|
[6284] | 58 | # Used in build_elevation.py |
---|
[6278] | 59 | # Format for ascii grids, as produced in ArcGIS + a projection file |
---|
[6279] | 60 | ascii_grid_filenames = ['busselton_v2', # Topo |
---|
| 61 | 'grid_250m_clip'] # Busselton Topo |
---|
[6276] | 62 | |
---|
[6278] | 63 | # Format for point is x,y,elevation (with header) |
---|
[6308] | 64 | point_filenames = ['Busselton_Contour0.txt', # Coastline |
---|
| 65 | 'Busselton_BeachSurvey.txt', # Beach survey |
---|
| 66 | 'Busselton_NavyFinal.txt', # Bathymetry |
---|
| 67 | 'Busselton_Chart.txt', # Bathymetry Charts |
---|
| 68 | 'Busselton_Digitised.txt', # Digitised Fairsheet |
---|
| 69 | 'Busselton_250m.txt', # 250m |
---|
| 70 | 'Bunbury_TIN.txt', # Bunbury aoi TIN'd in ArcGIS |
---|
| 71 | 'Busselton_TIN.txt', # Busselton aoi TIN'd in ArcGIS |
---|
| 72 | 'XYAHD_clip.txt'] # To extend boundary |
---|
[6253] | 73 | |
---|
[6375] | 74 | ### Add csv header list to all files in point_filenames |
---|
| 75 | ##headerlist = ['x', 'y', 'elevation'] |
---|
| 76 | ##for f in point_filenames: |
---|
| 77 | ## add_csv_header(join(topographies_folder, f), headerlist) |
---|
| 78 | |
---|
| 79 | # BOUNDING POLYGON - for data clipping and estimate of triangles in mesh |
---|
[6284] | 80 | # Used in build_elevation.py |
---|
[6278] | 81 | # Format for points easting,northing (no header) |
---|
| 82 | bounding_polygon_filename = 'bounding_polygon.csv' |
---|
[6312] | 83 | bounding_polygon_maxarea = 100000 |
---|
[6278] | 84 | |
---|
[6279] | 85 | # INTERIOR REGIONS - for designing the mesh |
---|
[6284] | 86 | # Used in run_model.py |
---|
[6278] | 87 | # Format for points easting,northing (no header) |
---|
| 88 | interior_regions_data = [['busselton_1km.csv', 500], |
---|
| 89 | ['bunbury_1km.csv', 500], |
---|
| 90 | ['busselton_2km.csv', 10000], |
---|
| 91 | ['bunbury_2km.csv', 10000], |
---|
| 92 | ['island1.csv', 10000], |
---|
| 93 | ['island2.csv', 10000], |
---|
[6279] | 94 | ['coast_5km_d20m.csv', 40000]] |
---|
| 95 | |
---|
[6308] | 96 | # LAND - used to set the initial stage/water to be offcoast only |
---|
| 97 | # Used in run_model.py. Format for points easting,northing (no header) |
---|
| 98 | land_initial_conditions_filename = [['initial_condition_extend.csv', 0], |
---|
| 99 | ['initial_condition_marina.csv', 0]] |
---|
| 100 | |
---|
[6279] | 101 | # GAUGES - for creating timeseries at a specific point |
---|
[6308] | 102 | # Used in get_timeseries.py. |
---|
[6278] | 103 | # Format easting,northing,name,elevation (with header) |
---|
[6276] | 104 | gauges_filename = 'gauges.csv' |
---|
[6278] | 105 | |
---|
[6279] | 106 | # BUILDINGS EXPOSURE - for identifying inundated houses |
---|
| 107 | # Used in run_building_inundation.py |
---|
| 108 | # Format latitude,longitude etc (geographic) |
---|
[6324] | 109 | building_exposure_filename = 'busselton_res_clip.csv' # from NEXIS |
---|
[6253] | 110 | |
---|
[6308] | 111 | # BOUNDING POLYGON - used in build_boundary.py and run_model.py respectively |
---|
[6278] | 112 | # NOTE: when files are put together the points must be in sequence |
---|
| 113 | # For ease go clockwise! |
---|
[6284] | 114 | # Check the run_model.py for boundary_tags |
---|
[6278] | 115 | |
---|
[6282] | 116 | # Thinned ordering file from Hazard Map (geographic) |
---|
[6278] | 117 | # Format is index,latitude,longitude (with header) |
---|
[6279] | 118 | urs_order_filename = 'thinned_boundary_ordering_extend.csv' |
---|
[6278] | 119 | |
---|
[6282] | 120 | # Landward bounding points |
---|
[6278] | 121 | # Format easting,northing (no header) |
---|
[6279] | 122 | landward_boundary_filename = 'landward_boundary_extend.csv' |
---|
[6253] | 123 | |
---|
[6324] | 124 | # MUX input filename. |
---|
| 125 | # If a meta-file from EventSelection is used, set 'multi-mux' to True. |
---|
[6329] | 126 | # If a single MUX stem filename (*.grd) is used, set 'multi-mux' to False. |
---|
| 127 | mux_input_filename = 'Java-0016-z.grd' |
---|
| 128 | multi_mux = False |
---|
[6365] | 129 | ##mux_input_filename = join(event_folder, 'event.list') |
---|
[6335] | 130 | ##multi_mux = True |
---|
[6308] | 131 | |
---|
| 132 | #------------------------------------------------------------------------------- |
---|
[6279] | 133 | # Clipping regions for export to asc and regions for clipping data |
---|
| 134 | # Final inundation maps should only be created in regions of the finest mesh |
---|
[6308] | 135 | #------------------------------------------------------------------------------- |
---|
[6261] | 136 | |
---|
[6279] | 137 | # ASCII export grid for Busselton |
---|
| 138 | xminBusselton = 340000 |
---|
| 139 | xmaxBusselton = 352000 |
---|
| 140 | yminBusselton = 6271500 |
---|
| 141 | ymaxBusselton = 6280000 |
---|
| 142 | |
---|
| 143 | # ASCII export grid for Bunbury |
---|
| 144 | xminBunbury = 369000 |
---|
| 145 | xmaxBunbury = 381000 |
---|
| 146 | yminBunbury = 6308000 |
---|
| 147 | ymaxBunbury = 6316500 |
---|
| 148 | |
---|
[6308] | 149 | ################################################################################ |
---|
| 150 | ################################################################################ |
---|
[6324] | 151 | #### NOTE: NOTHING WOULD NORMALLY CHANGE BELOW THIS POINT. #### |
---|
[6308] | 152 | ################################################################################ |
---|
| 153 | ################################################################################ |
---|
| 154 | |
---|
[6324] | 155 | # Get system user and host names. |
---|
| 156 | # These values can be used to distinguish between two similar runs by two |
---|
| 157 | # different users or runs by the same user on two different machines. |
---|
| 158 | user = get_user_name() |
---|
| 159 | host = get_host_name() |
---|
[6308] | 160 | |
---|
| 161 | # Environment variable names. |
---|
| 162 | # The inundation directory, not the data directory. |
---|
| 163 | ENV_INUNDATIONHOME = 'INUNDATIONHOME' |
---|
| 164 | |
---|
| 165 | # Path to MUX data |
---|
| 166 | ENV_MUXHOME = 'MUXHOME' |
---|
| 167 | |
---|
| 168 | #------------------------------------------------------------------------------- |
---|
[6253] | 169 | # Output Elevation Data |
---|
[6308] | 170 | #------------------------------------------------------------------------------- |
---|
| 171 | |
---|
[6253] | 172 | # Output filename for elevation |
---|
[6284] | 173 | # this is a combination of all the data generated in build_elevation.py |
---|
[6276] | 174 | combined_elevation_basename = scenario_name + '_combined_elevation' |
---|
[6253] | 175 | |
---|
[6308] | 176 | #------------------------------------------------------------------------------- |
---|
[6253] | 177 | # Directory Structure |
---|
[6308] | 178 | #------------------------------------------------------------------------------- |
---|
| 179 | |
---|
| 180 | # determines time for setting up output directories |
---|
| 181 | time = strftime('%Y%m%d_%H%M%S', localtime()) |
---|
| 182 | gtime = strftime('%Y%m%d_%H%M%S', gmtime()) |
---|
| 183 | build_time = time + '_build' |
---|
[6329] | 184 | run_time = time + '_run_' |
---|
[6308] | 185 | |
---|
| 186 | # create paths generated from environment variables. |
---|
| 187 | home = join(os.getenv(ENV_INUNDATIONHOME), 'data') # Absolute path for data folder |
---|
| 188 | muxhome = os.getenv(ENV_MUXHOME) |
---|
| 189 | |
---|
[6312] | 190 | # check various directories/files that must exist |
---|
[6279] | 191 | anuga_folder = join(home, state, scenario_folder, 'anuga') |
---|
[6278] | 192 | topographies_folder = join(anuga_folder, 'topographies') |
---|
| 193 | polygons_folder = join(anuga_folder, 'polygons') |
---|
| 194 | boundaries_folder = join(anuga_folder, 'boundaries') |
---|
| 195 | output_folder = join(anuga_folder, 'outputs') |
---|
[6308] | 196 | gauges_folder = join(anuga_folder, 'gauges') |
---|
[6278] | 197 | meshes_folder = join(anuga_folder, 'meshes') |
---|
[6324] | 198 | event_folder = join(boundaries_folder, str(event_number)) |
---|
[6253] | 199 | |
---|
[6324] | 200 | # MUX data files |
---|
| 201 | # Directory containing the MUX data files to be used with EventSelection. |
---|
[6329] | 202 | mux_data_folder = join(muxhome, 'mux') |
---|
[6308] | 203 | |
---|
| 204 | #------------------------------------------------------------------------------- |
---|
[6253] | 205 | # Location of input and output data |
---|
[6308] | 206 | #------------------------------------------------------------------------------- |
---|
[6253] | 207 | |
---|
[6324] | 208 | # Convert the user output_comment to a string for run_model.py |
---|
| 209 | output_comment = ('_'.join([str(x) for x in output_comment if x != user]) |
---|
| 210 | + '_' + user) |
---|
| 211 | |
---|
[6284] | 212 | # The absolute pathname of the all elevation, generated in build_elevation.py |
---|
[6278] | 213 | combined_elevation = join(topographies_folder, combined_elevation_basename) |
---|
[6253] | 214 | |
---|
[6284] | 215 | # The absolute pathname of the mesh, generated in run_model.py |
---|
| 216 | meshes = join(meshes_folder, scenario_name) + '.msh' |
---|
| 217 | |
---|
[6335] | 218 | # The pathname for the urs order points, used within build_urs_boundary.py |
---|
[6278] | 219 | urs_order = join(boundaries_folder, urs_order_filename) |
---|
[6253] | 220 | |
---|
[6278] | 221 | # The absolute pathname for the landward points of the bounding polygon, |
---|
[6284] | 222 | # Used within run_model.py) |
---|
[6278] | 223 | landward_boundary = join(boundaries_folder, landward_boundary_filename) |
---|
[6253] | 224 | |
---|
[6278] | 225 | # The absolute pathname for the .sts file, generated in build_boundary.py |
---|
[6324] | 226 | event_sts = join(event_folder, scenario_name) |
---|
[6253] | 227 | |
---|
[6278] | 228 | # The absolute pathname for the output folder names |
---|
[6284] | 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 |
---|
[6278] | 233 | # Used by post processing |
---|
| 234 | output_run_time = join(output_run, scenario_name) |
---|
[6261] | 235 | |
---|
[6282] | 236 | # The absolute pathname for the gauges file |
---|
| 237 | # Used for get_timeseries.py |
---|
[6278] | 238 | gauges = join(gauges_folder, gauges_filename) |
---|
[6253] | 239 | |
---|
[6282] | 240 | # The absolute pathname for the building file |
---|
[6278] | 241 | # Used for run_building_inundation.py |
---|
| 242 | building_exposure = join(gauges_folder, building_exposure_filename) |
---|
[6253] | 243 | |
---|
[6324] | 244 | # full path to where MUX files (or meta-files) live |
---|
| 245 | mux_input = join(boundaries_folder, mux_input_filename) |
---|
[6308] | 246 | |
---|