[6418] | 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 | |
---|
[6751] | 12 | #------------------------------------------------------------------------------ |
---|
[6418] | 13 | # Directory setup |
---|
[6751] | 14 | #------------------------------------------------------------------------------ |
---|
[6418] | 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 = 'thailand' |
---|
| 19 | scenario_name = 'patong' |
---|
| 20 | scenario_folder = 'patong_tsunami_scenario' |
---|
| 21 | |
---|
[6751] | 22 | #------------------------------------------------------------------------------ |
---|
[6418] | 23 | # Initial Conditions |
---|
[6751] | 24 | #------------------------------------------------------------------------------ |
---|
[6418] | 25 | |
---|
| 26 | # Model specific parameters. |
---|
| 27 | # One or all can be changed each time the run_model script is executed |
---|
[6524] | 28 | tide = 0.8 # difference between MSL and HAT |
---|
[6418] | 29 | zone = 47 # specify zone of model |
---|
[6524] | 30 | model = 'small' # different size model 'small' or 'large' |
---|
[6418] | 31 | event_number = 'mux_' + model # the event number or the mux file name |
---|
| 32 | alpha = 0.1 # smoothing parameter for mesh |
---|
[6543] | 33 | friction = 0.01 # manning's friction coefficient |
---|
| 34 | starttime = 0 # start time for simulation |
---|
| 35 | finaltime = 15000 # final time for simulation |
---|
[6418] | 36 | |
---|
[6422] | 37 | use_buildings = True |
---|
[6418] | 38 | setup = 'final' # This can be one of three values |
---|
| 39 | # trial - coarsest mesh, fast |
---|
| 40 | # basic - coarse mesh |
---|
| 41 | # final - fine mesh, slowest |
---|
| 42 | |
---|
[6751] | 43 | #------------------------------------------------------------------------------ |
---|
[6418] | 44 | # Output filename |
---|
| 45 | # |
---|
[6751] | 46 | # Your output filename should be unique between different runs on different |
---|
| 47 | # data. |
---|
| 48 | # The list of items below will be used to create a file in your output |
---|
| 49 | # directory. |
---|
[6418] | 50 | # Your user name and time+date will be automatically added. For example, |
---|
| 51 | # [setup, tide, event_number] |
---|
| 52 | # will result in a filename like |
---|
| 53 | # 20090212_091046_run_final_0_27283_rwilson |
---|
[6751] | 54 | #------------------------------------------------------------------------------ |
---|
[6418] | 55 | |
---|
[6751] | 56 | output_comment = [setup, tide, event_number, 'final'] |
---|
[6418] | 57 | |
---|
[6751] | 58 | #------------------------------------------------------------------------------ |
---|
[6418] | 59 | # Input Data |
---|
[6751] | 60 | #------------------------------------------------------------------------------ |
---|
[6418] | 61 | |
---|
| 62 | # ELEVATION DATA |
---|
| 63 | # Used in build_elevation.py |
---|
| 64 | # Format for ascii grids, as produced in ArcGIS + a projection file |
---|
| 65 | ascii_grid_filenames = [] |
---|
| 66 | |
---|
| 67 | # Format for point is x,y,elevation (with header) |
---|
| 68 | point_filenames = ['patong_10m_grid_msl_Project.txt', # 10m main grid |
---|
| 69 | 'patong_10m_small_grid_for_anuga_sub_Project.txt', # 10m saddle |
---|
| 70 | 'patong_bay_1s_grid_Project.txt', # 1s grid |
---|
| 71 | 'andaman_3s_grid_Clip2_Project.txt'] #3s grid |
---|
| 72 | |
---|
| 73 | ### Add csv header list to all files in point_filenames |
---|
| 74 | ##headerlist = ['x', 'y', 'elevation'] |
---|
| 75 | ##for f in point_filenames: |
---|
| 76 | ## add_csv_header(join(topographies_folder, f), headerlist) |
---|
| 77 | |
---|
| 78 | extent_polygon_filenames = ['patong_10m.txt', |
---|
| 79 | 'saddle_10m.txt', |
---|
| 80 | 'patong_1s.txt'] |
---|
| 81 | |
---|
| 82 | |
---|
| 83 | # BOUNDING POLYGON - for data clipping and estimate of triangles in mesh |
---|
| 84 | # Used in build_elevation.py |
---|
| 85 | # Format for points easting,northing (no header) |
---|
| 86 | bounding_polygon_filename = 'bounding_polygon_'+ model + '.csv' |
---|
| 87 | bounding_polygon_maxarea = 100000 |
---|
| 88 | |
---|
| 89 | # INTERIOR REGIONS - for designing the mesh |
---|
| 90 | # Used in run_model.py |
---|
| 91 | # Format for points easting,northing (no header) |
---|
| 92 | interior_regions_data = [['inundation_area.csv', 75], |
---|
| 93 | ['aoi.csv', 200], |
---|
| 94 | ['aos.csv', 900], |
---|
[6485] | 95 | ['sw_coast_original.csv', 7000], |
---|
[6418] | 96 | ['building_main.csv', 20], |
---|
| 97 | ['building_main_small.csv', 20], |
---|
| 98 | ['building_main_south.csv', 20], |
---|
| 99 | ['building_saddle.csv', 20]] |
---|
| 100 | |
---|
[6485] | 101 | |
---|
[6418] | 102 | # LAND - used to set the initial stage/water to be offcoast only |
---|
| 103 | # Used in run_model.py. Format for points easting,northing (no header) |
---|
[6485] | 104 | land_initial_conditions_filename = [['initial_conditions_' + model +'.csv', 0]] |
---|
[6418] | 105 | |
---|
| 106 | # GAUGES - for creating timeseries at a specific point |
---|
| 107 | # Used in get_timeseries.py. |
---|
| 108 | # Format easting,northing,name,elevation (with header) |
---|
[6984] | 109 | gauges_filename = 'gauges_h.csv' |
---|
[6418] | 110 | |
---|
| 111 | # BUILDINGS POLYOGN - for elevation of buildings |
---|
| 112 | # Used in run_model.py |
---|
| 113 | # Format easting,northing,id,floor (with header) |
---|
| 114 | building_polygon_filename = 'buildings.csv' |
---|
| 115 | |
---|
| 116 | |
---|
| 117 | # BUILDINGS EXPOSURE - for identifying inundated houses |
---|
| 118 | # Used in run_building_inundation.py |
---|
| 119 | # Format latitude,longitude etc (geographic) |
---|
| 120 | building_exposure_filename = 'busselton_res_clip.csv' # from NEXIS |
---|
| 121 | |
---|
| 122 | # BOUNDING POLYGON - used in build_boundary.py and run_model.py respectively |
---|
| 123 | # NOTE: when files are put together the points must be in sequence |
---|
| 124 | # For ease go clockwise! |
---|
| 125 | # Check the run_model.py for boundary_tags |
---|
| 126 | |
---|
| 127 | # Thinned ordering file from Hazard Map (geographic) |
---|
| 128 | # Format is index,latitude,longitude (with header) |
---|
| 129 | urs_order_filename = 'urs_order_'+ model +'.csv' |
---|
| 130 | |
---|
| 131 | # Landward bounding points |
---|
| 132 | # Format easting,northing (no header) |
---|
| 133 | landward_boundary_filename = 'landward_boundary_'+ model +'.csv' |
---|
| 134 | |
---|
| 135 | # MUX input filename. |
---|
| 136 | # If a meta-file from EventSelection is used, set 'multi-mux' to True. |
---|
| 137 | # If a single MUX stem filename (*.grd) is used, set 'multi-mux' to False. |
---|
| 138 | mux_input_filename = event_number # to be found in event_folder |
---|
| 139 | # (ie boundaries/event_number/) |
---|
| 140 | multi_mux = False |
---|
| 141 | ##mux_input_filename = 'event.list' |
---|
| 142 | ##multi_mux = True |
---|
| 143 | |
---|
[6751] | 144 | #------------------------------------------------------------------------------ |
---|
[6418] | 145 | # Clipping regions for export to asc and regions for clipping data |
---|
| 146 | # Final inundation maps should only be created in regions of the finest mesh |
---|
[6751] | 147 | #------------------------------------------------------------------------------ |
---|
[6418] | 148 | |
---|
| 149 | #CBD extract ascii grid - coordinates from patong_1s extent |
---|
| 150 | xminCBD = 417445.1119 |
---|
| 151 | xmaxCBD = 425601.7881 |
---|
| 152 | yminCBD = 870663.4547 |
---|
| 153 | ymaxCBD = 876965.3856 |
---|
| 154 | |
---|
| 155 | |
---|
| 156 | ################################################################################ |
---|
| 157 | ################################################################################ |
---|
| 158 | #### NOTE: NOTHING WOULD NORMALLY CHANGE BELOW THIS POINT. #### |
---|
| 159 | ################################################################################ |
---|
| 160 | ################################################################################ |
---|
| 161 | |
---|
| 162 | # Get system user and host names. |
---|
| 163 | # These values can be used to distinguish between two similar runs by two |
---|
| 164 | # different users or runs by the same user on two different machines. |
---|
| 165 | user = get_user_name() |
---|
| 166 | host = get_host_name() |
---|
| 167 | |
---|
| 168 | # Environment variable names. |
---|
| 169 | # The inundation directory, not the data directory. |
---|
| 170 | ENV_INUNDATIONHOME = 'INUNDATIONHOME' |
---|
| 171 | |
---|
| 172 | # Path to MUX data |
---|
| 173 | ENV_MUXHOME = 'MUXHOME' |
---|
| 174 | |
---|
| 175 | #------------------------------------------------------------------------------- |
---|
| 176 | # Output Elevation Data |
---|
| 177 | #------------------------------------------------------------------------------- |
---|
| 178 | |
---|
| 179 | # Output filename for elevation |
---|
| 180 | # this is a combination of all the data generated in build_elevation.py |
---|
| 181 | combined_elevation_basename = scenario_name + '_combined_elevation_' + model |
---|
| 182 | |
---|
| 183 | #------------------------------------------------------------------------------- |
---|
| 184 | # Directory Structure |
---|
| 185 | #------------------------------------------------------------------------------- |
---|
| 186 | |
---|
| 187 | # determines time for setting up output directories |
---|
| 188 | time = strftime('%Y%m%d_%H%M%S', localtime()) |
---|
| 189 | gtime = strftime('%Y%m%d_%H%M%S', gmtime()) |
---|
| 190 | build_time = time + '_build_' + model |
---|
| 191 | run_time = time + '_run_' |
---|
| 192 | |
---|
| 193 | # create paths generated from environment variables. |
---|
| 194 | home = join(os.getenv(ENV_INUNDATIONHOME), 'data') # Absolute path for data folder |
---|
| 195 | muxhome = os.getenv(ENV_MUXHOME) |
---|
| 196 | |
---|
| 197 | # check various directories/files that must exist |
---|
| 198 | anuga_folder = join(home, state, scenario_folder, 'anuga') |
---|
| 199 | topographies_folder = join(anuga_folder, 'topographies') |
---|
| 200 | polygons_folder = join(anuga_folder, 'polygons') |
---|
| 201 | boundaries_folder = join(anuga_folder, 'boundaries') |
---|
| 202 | output_folder = join(anuga_folder, 'outputs') |
---|
| 203 | gauges_folder = join(anuga_folder, 'gauges') |
---|
| 204 | meshes_folder = join(anuga_folder, 'meshes') |
---|
| 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 | |
---|
[6751] | 211 | #------------------------------------------------------------------------------ |
---|
[6418] | 212 | # Location of input and output data |
---|
[6751] | 213 | #------------------------------------------------------------------------------ |
---|
[6418] | 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 absolute pathname of the mesh, generated in run_model.py |
---|
[6430] | 223 | meshes = join(meshes_folder, scenario_name) + model +'.msh' |
---|
[6418] | 224 | |
---|
| 225 | # The pathname for the urs order points, used within build_urs_boundary.py |
---|
| 226 | urs_order = join(boundaries_folder, urs_order_filename) |
---|
| 227 | |
---|
| 228 | # The absolute pathname for the landward points of the bounding polygon, |
---|
| 229 | # Used within run_model.py) |
---|
| 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 for the gauges file |
---|
| 244 | # Used for get_timeseries.py |
---|
| 245 | gauges = join(gauges_folder, gauges_filename) |
---|
| 246 | |
---|
| 247 | # The absolute pathname for the gauges file |
---|
| 248 | # Used for run_model.py |
---|
| 249 | building_polygon = join(polygons_folder, building_polygon_filename) |
---|
| 250 | |
---|
| 251 | # The absolute pathname for the building file |
---|
| 252 | # Used for run_building_inundation.py |
---|
| 253 | building_exposure = join(gauges_folder, building_exposure_filename) |
---|
| 254 | |
---|
| 255 | # full path to where MUX files (or meta-files) live |
---|
| 256 | mux_input = join(event_folder, mux_input_filename) |
---|
| 257 | |
---|