Changeset 6324
- Timestamp:
- Feb 12, 2009, 4:50:25 PM (16 years ago)
- Location:
- anuga_work/production/busselton/standardised_version
- Files:
-
- 2 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_work/production/busselton/standardised_version/project.py
r6312 r6324 1 1 """ 2 Common filenames and locations for elevation, meshes and outputs. 3 This script is the heart of all scripts in the folder 2 This file contains all your file and directory definitions 3 for elevation, meshes and outputs. 4 4 """ 5 5 6 import sys7 6 import os 7 from anuga.utilities.system_tools import get_user_name, get_host_name 8 from time import localtime, strftime, gmtime 8 9 from os.path import join, exists 9 from time import localtime, strftime, gmtime 10 from anuga.utilities.polygon import read_polygon, number_mesh_triangles 11 from anuga.utilities.system_tools import get_user_name, get_host_name 12 13 14 #----- 15 # Get system data - don't fiddle with this. 16 # These values can be used to distinguish between two similar runs by two 17 # different users or runs by the same user on two different machines. 18 #----- 19 20 user = get_user_name() 21 host = get_host_name() 10 22 11 23 12 #------------------------------------------------------------------------------- … … 37 26 # Model specific parameters. 38 27 # One or all can be changed each time the run_model script is executed 39 tide = 0 # ??40 event_number = 2 7283 # the event number28 tide = 0 # difference between MSL and HAT 29 event_number = 26633 # the event number 41 30 alpha = 0.1 # smoothing parameter for mesh 42 31 friction=0.01 # manning's friction coefficient … … 44 33 finaltime=80000 # final time for simulation 45 34 46 setup = 'final' # Final can be replaced with trial or basic. 47 # Either will result in a coarser mesh that will 48 # allow a faster, but less accurate, simulation. 49 50 #------------------------------------------------------------------------------- 51 # Output Filename 52 #------------------------------------------------------------------------------- 53 54 # Important to distinguish each run - ensure str(user) is included! 55 # Note, the user is free to include as many parameters as desired 56 # This should be moved to run_model.py, with the user providing the list to join 57 # for example: output_comment_list = [setup, str(tide), str(event_number), str(user)] 58 output_comment = '_'.join([setup, str(tide), str(event_number), str(user)]) 35 setup = 'final' # This can be one of three values 36 # trial - coarsest mesh, fast 37 # basic - coarse mesh 38 # final - fine mesh, slowest 39 40 #------------------------------------------------------------------------------- 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 49 #------------------------------------------------------------------------------- 50 51 output_comment = [setup, tide, event_number] 59 52 60 53 #------------------------------------------------------------------------------- … … 109 102 # Used in run_building_inundation.py 110 103 # Format latitude,longitude etc (geographic) 111 building_exposure_filename = 'busselton_res_clip.csv' # from NEXIS104 building_exposure_filename = 'busselton_res_clip.csv' # from NEXIS 112 105 113 106 # BOUNDING POLYGON - used in build_boundary.py and run_model.py respectively … … 124 117 landward_boundary_filename = 'landward_boundary_extend.csv' 125 118 126 # MUX input filename 127 # Must exist in $MUXHOME/mux directory.128 # File is prodiced by EventSelection.129 # If MUX file not used, do "mux_input_filename = None". 130 mu x_input_filename = r'C:\temp\event_026633.list'119 # MUX input filename. 120 # If a meta-file from EventSelection is used, set 'multi-mux' to True. 121 # If a single MUX stem filename is used, set 'multi-mux' to False. 122 mux_input_filename = 'event_026633.list' 123 multi_mux = True 131 124 132 125 #------------------------------------------------------------------------------- … … 147 140 ymaxBunbury = 6316500 148 141 149 150 ################################################################################ 151 ################################################################################ 152 #### NOTE: NOTHING SHOULD CHANGE BELOW THIS POINT. #### 153 ################################################################################ 154 ################################################################################ 155 156 #------------------------------------------------------------------------------- 157 # Sanity checks 158 #------------------------------------------------------------------------------- 159 160 # Test that environment variables are defined. 161 # A little late, but better here than up in user-changeable data. 142 ################################################################################ 143 ################################################################################ 144 #### NOTE: NOTHING WOULD NORMALLY CHANGE BELOW THIS POINT. #### 145 ################################################################################ 146 ################################################################################ 147 148 # Get system user and host names. 149 # These values can be used to distinguish between two similar runs by two 150 # different users or runs by the same user on two different machines. 151 user = get_user_name() 152 host = get_host_name() 162 153 163 154 # Environment variable names. … … 167 158 # Path to MUX data 168 159 ENV_MUXHOME = 'MUXHOME' 169 170 ### Check we have required environment variables set171 ##sanity_error = False # checked at bottom of this file172 ##173 ##if os.getenv(ENV_INUNDATIONHOME) is None:174 ## print "Environment variable '%s' is not set" % ENV_INUNDATIONHOME175 ## sanity_error = True176 ##177 ##if os.getenv(ENV_MUXHOME) is None:178 ## print "Environment variable '%s' is not set" % ENV_MUXHOME179 ## sanity_error = True180 ##181 ### check for errors detected so far182 ##if sanity_error:183 ## print 'You must fix the above errors before continuing.'184 ## sys.exit(10)185 160 186 161 #------------------------------------------------------------------------------- … … 204 179 # create paths generated from environment variables. 205 180 home = join(os.getenv(ENV_INUNDATIONHOME), 'data') # Absolute path for data folder 206 ##if not exists(home):207 ## print "Sorry, data directory '%s' doesn't exist" % home208 ## sanity_error = True209 210 181 muxhome = os.getenv(ENV_MUXHOME) 211 ##if not exists(muxhome):212 ## print "Sorry, MUX directory '%s' doesn't exist" % muxhome213 ## sanity_error = True214 182 215 183 # check various directories/files that must exist 216 184 anuga_folder = join(home, state, scenario_folder, 'anuga') 217 ##if not exists(anuga_folder):218 ## print "Sorry, ANUGA directory '%s' doesn't exist" % anuga_folder219 ## sanity_error = True220 221 185 topographies_folder = join(anuga_folder, 'topographies') 222 ##if not exists(topographies_folder):223 ## print "Sorry, topo directory '%s' doesn't exist" % topographies_folder224 ## sanity_error = True225 226 186 polygons_folder = join(anuga_folder, 'polygons') 227 ##if not exists(polygons_folder):228 ## print "Sorry, polygon directory '%s' doesn't exist" % polygons_folder229 ## sanity_error = True230 231 187 boundaries_folder = join(anuga_folder, 'boundaries') 232 ##if not exists(boundaries_folder):233 ## print "Sorry, boundaries directory '%s' doesn't exist" % boundaries_folder234 ## sanity_error = True235 236 188 output_folder = join(anuga_folder, 'outputs') 237 ##if not exists(output_folder):238 ## print "Sorry, outputs directory '%s' doesn't exist" % output_folder239 ## sanity_error = True240 241 189 gauges_folder = join(anuga_folder, 'gauges') 242 ##if not exists(gauges_folder):243 ## print "Sorry, gauges directory '%s' doesn't exist" % gauges_folder244 ## sanity_error = True245 246 190 meshes_folder = join(anuga_folder, 'meshes') 247 ##if not exists(meshes_folder):248 ## print "Sorry, meshes directory '%s' doesn't exist" % meshes_folder249 ## sanity_error = True250 251 ### if mux_input_filename has been defined, check if file exists252 ##if mux_input_filename:253 ## if not exists(mux_input_filename):254 ## print ("Sorry, MUX input file '%s' doesn't exist" % mux_input_filename)255 ## sanity_error = True256 257 #-----258 # If these directories don't exist initially, create them.259 # This should be moved to run_model.py.260 #-----261 262 191 event_folder = join(boundaries_folder, str(event_number)) 263 if not exists(event_folder): 264 print "Creating directory 'event_folder'=%s" % event_folder 265 os.mkdir(event_folder) 192 193 # MUX data files 194 # Directory containing the MUX data files to be used with EventSelection. 195 mux_data_folder = '/nas/gemd/georisk_models/tsunami/models/PTHA/Australia/mux' 266 196 267 197 #------------------------------------------------------------------------------- 268 198 # Location of input and output data 269 199 #------------------------------------------------------------------------------- 200 201 # Convert the user output_comment to a string for run_model.py 202 output_comment = ('_'.join([str(x) for x in output_comment if x != user]) 203 + '_' + user) 270 204 271 205 # The absolute pathname of the all elevation, generated in build_elevation.py … … 283 217 284 218 # The absolute pathname for the .sts file, generated in build_boundary.py 285 event_sts = join( boundaries_folder, str(event_number), scenario_name)219 event_sts = join(event_folder, scenario_name) 286 220 287 221 # The absolute pathname for the output folder names … … 301 235 building_exposure = join(gauges_folder, building_exposure_filename) 302 236 303 #------------------------------------------------------------------------------- 304 # Determine type of run 305 #------------------------------------------------------------------------------- 306 307 if setup == 'trial': 308 print 'trial' 309 scale_factor = 100 310 time_thinning = 96 311 yieldstep = 240 312 elif setup == 'basic': 313 print 'basic' 314 scale_factor = 4 315 time_thinning = 12 316 yieldstep = 120 317 elif setup == 'final': 318 print 'final' 319 scale_factor = 1 320 time_thinning = 4 321 yieldstep = 60 322 ##else: 323 ## print ("Sorry, you must set the 'setup' variable to one of 'trial', " 324 ## "'basic' or 'final'. I found '%s'" % str(setup)) 325 ## sanity_error = True 326 327 #------------------------------------------------------------------------------- 328 # Reading polygons and creating interior regions 329 #------------------------------------------------------------------------------- 330 331 # Create list of land polygons with initial conditions 332 land_initial_conditions = [] 333 for filename, MSL in land_initial_conditions_filename: 334 polygon = read_polygon(join(polygons_folder, filename)) 335 land_initial_conditions.append([polygon, MSL]) 336 337 # Create list of interior polygons with scaling factor 338 interior_regions = [] 339 for filename, maxarea in interior_regions_data: 340 polygon = read_polygon(join(polygons_folder, filename)) 341 interior_regions.append([polygon, maxarea*scale_factor]) 342 343 # Initial bounding polygon for data clipping 344 bounding_polygon = read_polygon(join(polygons_folder, 345 bounding_polygon_filename)) 346 bounding_maxarea = bounding_polygon_maxarea*scale_factor 347 348 # Estimate the number of triangles 349 trigs_min = number_mesh_triangles(interior_regions, 350 bounding_polygon, bounding_maxarea) 351 352 ###------------------------------------------------------------------------------- 353 ### Check for errors detected above. 354 ###------------------------------------------------------------------------------- 355 ## 356 ##if sanity_error: 357 ## print 'You must fix the above errors before continuing.' 358 ## sys.exit(10) 359 360 361 print 'min estimated number of triangles', trigs_min 237 # full path to where MUX files (or meta-files) live 238 mux_input = join(boundaries_folder, mux_input_filename) 239 -
anuga_work/production/busselton/standardised_version/run_model.py
r6312 r6324 38 38 39 39 # Application specific imports 40 import project # Definition of file names and polygons 40 from setup_model import project 41 41 import build_urs_boundary as bub 42 42 43 44 #-------------------------------------------------------------------------------45 # Perform (as much as possible) a sanity check on values from import of project.46 #-------------------------------------------------------------------------------47 43 48 44 #------------------------------------------------------------------------------- … … 65 61 66 62 # Create the STS file 67 bub.build_urs_boundary( os.path.join(project.muxhome, 'mux'),68 project.mux_input _filename,63 bub.build_urs_boundary(project.mux_data_folder, 64 project.mux_input, 69 65 os.path.join(project.event_folder, 70 66 project.scenario_name))
Note: See TracChangeset
for help on using the changeset viewer.