[6291] | 1 | """ |
---|
[6402] | 2 | This file contains all your file and directory definitions |
---|
| 3 | for elevation, meshes and outputs. |
---|
| 4 | """ |
---|
[6291] | 5 | |
---|
| 6 | import os |
---|
[6402] | 7 | from anuga.utilities.system_tools import get_user_name, get_host_name |
---|
[6291] | 8 | from time import localtime, strftime, gmtime |
---|
[6402] | 9 | from os.path import join, exists |
---|
[6291] | 10 | |
---|
[6402] | 11 | |
---|
| 12 | #------------------------------------------------------------------------------- |
---|
[6291] | 13 | # Directory setup |
---|
[6402] | 14 | #------------------------------------------------------------------------------- |
---|
[6291] | 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 |
---|
[6293] | 18 | state = 'australia_ph2' |
---|
| 19 | scenario_name = 'ceduna' |
---|
[6402] | 20 | scenario_folder = scenario_name |
---|
[6291] | 21 | |
---|
[6402] | 22 | #------------------------------------------------------------------------------- |
---|
[6291] | 23 | # Initial Conditions |
---|
[6402] | 24 | #------------------------------------------------------------------------------- |
---|
| 25 | |
---|
| 26 | # Model specific parameters. |
---|
| 27 | # One or all can be changed each time the run_model script is executed |
---|
| 28 | tide = 0 # difference between MSL and HAT |
---|
| 29 | zone = 53 # specify zone of model |
---|
[6467] | 30 | event_number = 64448 # the event number or the mux file name |
---|
| 31 | # ceduna: 27347 (Java), 64448 (sandwich), 58331 (Puysegur) |
---|
| 32 | # other possible sources: |
---|
| 33 | # 7877 (altiplano, south america), 46503 (mid america), |
---|
| 34 | # 57483 (peru), 65304 (shetland), 68792 (sumatra) |
---|
| 35 | |
---|
[6291] | 36 | alpha = 0.1 # smoothing parameter for mesh |
---|
[6402] | 37 | friction=0.01 # manning's friction coefficient |
---|
| 38 | starttime=0 # start time for simulation |
---|
| 39 | finaltime=1000 # final time for simulation |
---|
[6291] | 40 | |
---|
[6460] | 41 | # index is only used when wave = Tb |
---|
[6464] | 42 | index = 1889 # index from the PTHA |
---|
[6460] | 43 | wave = 'Tb' # Bf (sts wave) Tb (index wave) |
---|
| 44 | |
---|
[6402] | 45 | setup = 'final' # This can be one of three values |
---|
| 46 | # trial - coarsest mesh, fast |
---|
| 47 | # basic - coarse mesh |
---|
| 48 | # final - fine mesh, slowest |
---|
[6291] | 49 | |
---|
[6402] | 50 | #------------------------------------------------------------------------------- |
---|
| 51 | # Output filename |
---|
| 52 | # |
---|
| 53 | # Your output filename should be unique between different runs on different data. |
---|
| 54 | # The list of items below will be used to create a file in your output directory. |
---|
| 55 | # Your user name and time+date will be automatically added. For example, |
---|
| 56 | # [setup, tide, event_number] |
---|
| 57 | # will result in a filename like |
---|
| 58 | # 20090212_091046_run_final_0_27283_rwilson |
---|
| 59 | #------------------------------------------------------------------------------- |
---|
[6291] | 60 | |
---|
[6460] | 61 | output_comment = [setup, tide, event_number, index, wave] |
---|
[6291] | 62 | |
---|
[6402] | 63 | #------------------------------------------------------------------------------- |
---|
| 64 | # Input Data |
---|
| 65 | #------------------------------------------------------------------------------- |
---|
[6291] | 66 | |
---|
| 67 | # ELEVATION DATA |
---|
| 68 | # Used in build_elevation.py |
---|
| 69 | # Format for ascii grids, as produced in ArcGIS + a projection file |
---|
[6402] | 70 | ascii_grid_filenames = [] # 250m grid 2005 |
---|
[6291] | 71 | |
---|
| 72 | # Format for point is x,y,elevation (with header) |
---|
[6402] | 73 | point_filenames = ['grid250m_pts.txt'] # 250m grid 2005 |
---|
| 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 |
---|
[6291] | 81 | # Used in build_elevation.py |
---|
| 82 | # Format for points easting,northing (no header) |
---|
| 83 | bounding_polygon_filename = 'bounding_polygon.csv' |
---|
[6402] | 84 | bounding_polygon_maxarea = 100000 |
---|
[6291] | 85 | |
---|
[6402] | 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 = [] |
---|
| 90 | |
---|
| 91 | # LAND - used to set the initial stage/water to be offcoast only |
---|
| 92 | # Used in run_model.py. Format for points easting,northing (no header) |
---|
| 93 | land_initial_conditions_filename = [] |
---|
| 94 | |
---|
[6291] | 95 | # GAUGES - for creating timeseries at a specific point |
---|
[6402] | 96 | # Used in get_timeseries.py. |
---|
[6291] | 97 | # Format easting,northing,name,elevation (with header) |
---|
[6402] | 98 | gauges_filename = 'gauges.csv' |
---|
[6291] | 99 | |
---|
[6402] | 100 | # BUILDINGS EXPOSURE - for identifying inundated houses |
---|
| 101 | # Used in run_building_inundation.py |
---|
| 102 | # Format latitude,longitude etc (geographic) |
---|
| 103 | building_exposure_filename = 'busselton_res_clip.csv' # from NEXIS |
---|
| 104 | |
---|
| 105 | # BOUNDING POLYGON - used in build_boundary.py and run_model.py respectively |
---|
[6291] | 106 | # NOTE: when files are put together the points must be in sequence |
---|
| 107 | # For ease go clockwise! |
---|
| 108 | # Check the run_model.py for boundary_tags |
---|
| 109 | |
---|
| 110 | # Thinned ordering file from Hazard Map (geographic) |
---|
| 111 | # Format is index,latitude,longitude (with header) |
---|
[6402] | 112 | urs_order_filename = 'urs_order.csv' |
---|
[6291] | 113 | |
---|
| 114 | # Landward bounding points |
---|
| 115 | # Format easting,northing (no header) |
---|
[6293] | 116 | landward_boundary_filename = 'landward_boundary.csv' |
---|
[6291] | 117 | |
---|
[6402] | 118 | # MUX input filename. |
---|
| 119 | # If a meta-file from EventSelection is used, set 'multi-mux' to True. |
---|
| 120 | # If a single MUX stem filename (*.grd) is used, set 'multi-mux' to False. |
---|
| 121 | ##mux_input_filename = event_number # to be found in event_folder |
---|
| 122 | # (ie boundaries/event_number/) |
---|
| 123 | ##multi_mux = False |
---|
| 124 | mux_input_filename = 'event.list' |
---|
| 125 | multi_mux = True |
---|
| 126 | |
---|
| 127 | |
---|
| 128 | ################################################################################ |
---|
| 129 | ################################################################################ |
---|
| 130 | #### NOTE: NOTHING WOULD NORMALLY CHANGE BELOW THIS POINT. #### |
---|
| 131 | ################################################################################ |
---|
| 132 | ################################################################################ |
---|
| 133 | |
---|
| 134 | # Get system user and host names. |
---|
| 135 | # These values can be used to distinguish between two similar runs by two |
---|
| 136 | # different users or runs by the same user on two different machines. |
---|
| 137 | user = get_user_name() |
---|
| 138 | host = get_host_name() |
---|
| 139 | |
---|
| 140 | # Environment variable names. |
---|
| 141 | # The inundation directory, not the data directory. |
---|
| 142 | ENV_INUNDATIONHOME = 'INUNDATIONHOME' |
---|
| 143 | |
---|
| 144 | # Path to MUX data |
---|
| 145 | ENV_MUXHOME = 'MUXHOME' |
---|
| 146 | |
---|
| 147 | #------------------------------------------------------------------------------- |
---|
[6291] | 148 | # Output Elevation Data |
---|
[6402] | 149 | #------------------------------------------------------------------------------- |
---|
| 150 | |
---|
[6291] | 151 | # Output filename for elevation |
---|
| 152 | # this is a combination of all the data generated in build_elevation.py |
---|
| 153 | combined_elevation_basename = scenario_name + '_combined_elevation' |
---|
| 154 | |
---|
[6402] | 155 | #------------------------------------------------------------------------------- |
---|
[6291] | 156 | # Directory Structure |
---|
[6402] | 157 | #------------------------------------------------------------------------------- |
---|
| 158 | |
---|
| 159 | # determines time for setting up output directories |
---|
| 160 | time = strftime('%Y%m%d_%H%M%S', localtime()) |
---|
| 161 | gtime = strftime('%Y%m%d_%H%M%S', gmtime()) |
---|
| 162 | build_time = time + '_build' |
---|
| 163 | run_time = time + '_run_' |
---|
| 164 | |
---|
| 165 | # create paths generated from environment variables. |
---|
| 166 | home = join(os.getenv(ENV_INUNDATIONHOME), 'data') # Absolute path for data folder |
---|
| 167 | muxhome = os.getenv(ENV_MUXHOME) |
---|
| 168 | |
---|
| 169 | # check various directories/files that must exist |
---|
| 170 | anuga_folder = join(home, state, scenario_folder, 'anuga') |
---|
[6291] | 171 | topographies_folder = join(anuga_folder, 'topographies') |
---|
| 172 | polygons_folder = join(anuga_folder, 'polygons') |
---|
| 173 | boundaries_folder = join(anuga_folder, 'boundaries') |
---|
| 174 | output_folder = join(anuga_folder, 'outputs') |
---|
[6402] | 175 | gauges_folder = join(anuga_folder, 'gauges') |
---|
[6291] | 176 | meshes_folder = join(anuga_folder, 'meshes') |
---|
[6402] | 177 | event_folder = join(boundaries_folder, str(event_number)) |
---|
[6291] | 178 | |
---|
[6402] | 179 | # MUX data files |
---|
| 180 | # Directory containing the MUX data files to be used with EventSelection. |
---|
| 181 | mux_data_folder = join(muxhome, 'mux') |
---|
| 182 | |
---|
| 183 | #------------------------------------------------------------------------------- |
---|
[6291] | 184 | # Location of input and output data |
---|
[6402] | 185 | #------------------------------------------------------------------------------- |
---|
[6291] | 186 | |
---|
[6402] | 187 | # Convert the user output_comment to a string for run_model.py |
---|
| 188 | output_comment = ('_'.join([str(x) for x in output_comment if x != user]) |
---|
| 189 | + '_' + user) |
---|
| 190 | |
---|
[6291] | 191 | # The absolute pathname of the all elevation, generated in build_elevation.py |
---|
| 192 | combined_elevation = join(topographies_folder, combined_elevation_basename) |
---|
| 193 | |
---|
| 194 | # The absolute pathname of the mesh, generated in run_model.py |
---|
| 195 | meshes = join(meshes_folder, scenario_name) + '.msh' |
---|
| 196 | |
---|
[6402] | 197 | # The pathname for the urs order points, used within build_urs_boundary.py |
---|
[6291] | 198 | urs_order = join(boundaries_folder, urs_order_filename) |
---|
| 199 | |
---|
| 200 | # The absolute pathname for the landward points of the bounding polygon, |
---|
| 201 | # Used within run_model.py) |
---|
| 202 | landward_boundary = join(boundaries_folder, landward_boundary_filename) |
---|
| 203 | |
---|
| 204 | # The absolute pathname for the .sts file, generated in build_boundary.py |
---|
[6402] | 205 | event_sts = join(event_folder, scenario_name) |
---|
[6291] | 206 | |
---|
| 207 | # The absolute pathname for the output folder names |
---|
| 208 | # Used for build_elevation.py |
---|
| 209 | output_build = join(output_folder, build_time) + '_' + str(user) |
---|
| 210 | # Used for run_model.py |
---|
| 211 | output_run = join(output_folder, run_time) + output_comment |
---|
| 212 | # Used by post processing |
---|
| 213 | output_run_time = join(output_run, scenario_name) |
---|
| 214 | |
---|
| 215 | # The absolute pathname for the gauges file |
---|
| 216 | # Used for get_timeseries.py |
---|
[6402] | 217 | gauges = join(gauges_folder, gauges_filename) |
---|
[6291] | 218 | |
---|
[6402] | 219 | # The absolute pathname for the building file |
---|
| 220 | # Used for run_building_inundation.py |
---|
| 221 | building_exposure = join(gauges_folder, building_exposure_filename) |
---|
[6291] | 222 | |
---|
[6402] | 223 | # full path to where MUX files (or meta-files) live |
---|
| 224 | mux_input = join(event_folder, mux_input_filename) |
---|
[6291] | 225 | |
---|
[6467] | 226 | boundary_csv = event_folder + sep + 'sts_gauge_' + str(index) +'.csv' |
---|
| 227 | |
---|