Index: /anuga_work/production/busselton/standardised_version/project.py
===================================================================
--- /anuga_work/production/busselton/standardised_version/project.py	(revision 6311)
+++ /anuga_work/production/busselton/standardised_version/project.py	(revision 6312)
@@ -14,4 +14,6 @@
 #-----
 # Get system data - don't fiddle with this.
+# These values can be used to distinguish between two similar runs by two
+# different users or runs by the same user on two different machines.
 #-----
 
@@ -52,4 +54,6 @@
 # Important to distinguish each run - ensure str(user) is included!
 # Note, the user is free to include as many parameters as desired
+# This should be moved to run_model.py, with the user providing the list to join
+# for example: output_comment_list = [setup, str(tide), str(event_number), str(user)]
 output_comment = '_'.join([setup, str(tide), str(event_number), str(user)])
 
@@ -79,4 +83,5 @@
 # Format for points easting,northing (no header)
 bounding_polygon_filename = 'bounding_polygon.csv'
+bounding_polygon_maxarea = 100000
 
 # INTERIOR REGIONS -  for designing the mesh
@@ -121,6 +126,7 @@
 # MUX input filename
 # Must exist in $MUXHOME/mux directory.
-# If MUX file not used, do "mux_input_file = None".
-mux_input_file = 'event_031451.list'          # File produced by EventSelection
+# File is prodiced by EventSelection.
+# If MUX file not used, do "mux_input_filename = None".
+mux_input_filename = r'C:\temp\event_026633.list'
 
 #-------------------------------------------------------------------------------
@@ -162,19 +168,19 @@
 ENV_MUXHOME = 'MUXHOME'
 
-# Check we have required environment variables set
-sanity_error = False               # checked at bottom of this file
-
-if os.getenv(ENV_INUNDATIONHOME) is None:
-    print "Environment variable '%s' is not set" % ENV_INUNDATIONHOME
-    sanity_error = True
-
-if os.getenv(ENV_MUXHOME) is None:
-    print "Environment variable '%s' is not set" % ENV_MUXHOME
-    sanity_error = True
-
-# check for errors detected so far
-if sanity_error:
-    print 'You must fix the above errors before continuing.'
-    sys.exit(10)
+### Check we have required environment variables set
+##sanity_error = False               # checked at bottom of this file
+##
+##if os.getenv(ENV_INUNDATIONHOME) is None:
+##    print "Environment variable '%s' is not set" % ENV_INUNDATIONHOME
+##    sanity_error = True
+##
+##if os.getenv(ENV_MUXHOME) is None:
+##    print "Environment variable '%s' is not set" % ENV_MUXHOME
+##    sanity_error = True
+##
+### check for errors detected so far
+##if sanity_error:
+##    print 'You must fix the above errors before continuing.'
+##    sys.exit(10)
 
 #-------------------------------------------------------------------------------
@@ -198,56 +204,64 @@
 # create paths generated from environment variables.
 home = join(os.getenv(ENV_INUNDATIONHOME), 'data') # Absolute path for data folder
-if not exists(home):
-    print "Sorry, data directory '%s' doesn't exist" % home
-    sanity_error = True
+##if not exists(home):
+##    print "Sorry, data directory '%s' doesn't exist" % home
+##    sanity_error = True
     
 muxhome = os.getenv(ENV_MUXHOME)
-if not exists(muxhome):
-    print "Sorry, MUX directory '%s' doesn't exist" % muxhome
-    sanity_error = True
+##if not exists(muxhome):
+##    print "Sorry, MUX directory '%s' doesn't exist" % muxhome
+##    sanity_error = True
     
-# if mux_input_file has been defined, check if file exists
-if mux_input_file:
-    if not exists(join(muxhome, mux_input_file)):
-        print ("Sorry, MUX input file '%s' doesn't exist"
-               % join(muxhome, mux_input_file))
-        sanity_error = True
-
-# check various directories that must exist
+# check various directories/files that must exist
 anuga_folder = join(home, state, scenario_folder, 'anuga')
-if not exists(anuga_folder):
-    print "Sorry, ANUGA directory '%s' doesn't exist" % anuga_folder
-    sanity_error = True
+##if not exists(anuga_folder):
+##    print "Sorry, ANUGA directory '%s' doesn't exist" % anuga_folder
+##    sanity_error = True
 
 topographies_folder = join(anuga_folder, 'topographies')
-if not exists(topographies_folder):
-    print "Sorry, topo directory '%s' doesn't exist" % topographies_folder
-    sanity_error = True
+##if not exists(topographies_folder):
+##    print "Sorry, topo directory '%s' doesn't exist" % topographies_folder
+##    sanity_error = True
 
 polygons_folder = join(anuga_folder, 'polygons')
-if not exists(polygons_folder):
-    print "Sorry, polygon directory '%s' doesn't exist" % polygons_folder
-    sanity_error = True
+##if not exists(polygons_folder):
+##    print "Sorry, polygon directory '%s' doesn't exist" % polygons_folder
+##    sanity_error = True
 
 boundaries_folder = join(anuga_folder, 'boundaries')
-if not exists(boundaries_folder):
-    print "Sorry, boundaries directory '%s' doesn't exist" % boundaries_folder
-    sanity_error = True
+##if not exists(boundaries_folder):
+##    print "Sorry, boundaries directory '%s' doesn't exist" % boundaries_folder
+##    sanity_error = True
 
 output_folder = join(anuga_folder, 'outputs')
-if not exists(output_folder):
-    print "Sorry, outputs directory '%s' doesn't exist" % output_folder
-    sanity_error = True
+##if not exists(output_folder):
+##    print "Sorry, outputs directory '%s' doesn't exist" % output_folder
+##    sanity_error = True
 
 gauges_folder = join(anuga_folder, 'gauges')
-if not exists(gauges_folder):
-    print "Sorry, gauges directory '%s' doesn't exist" % gauges_folder
-    sanity_error = True
+##if not exists(gauges_folder):
+##    print "Sorry, gauges directory '%s' doesn't exist" % gauges_folder
+##    sanity_error = True
 
 meshes_folder = join(anuga_folder, 'meshes')
-if not exists(meshes_folder):
-    print "Sorry, meshes directory '%s' doesn't exist" % meshes_folder
-    sanity_error = True
-
+##if not exists(meshes_folder):
+##    print "Sorry, meshes directory '%s' doesn't exist" % meshes_folder
+##    sanity_error = True
+
+### if mux_input_filename has been defined, check if file exists
+##if mux_input_filename:
+##    if not exists(mux_input_filename):
+##        print ("Sorry, MUX input file '%s' doesn't exist" % mux_input_filename)
+##        sanity_error = True
+
+#-----
+# If these directories don't exist initially, create them.
+# This should be moved to run_model.py.
+#-----
+
+event_folder = join(boundaries_folder, str(event_number))
+if not exists(event_folder):
+    print "Creating directory 'event_folder'=%s" % event_folder
+    os.mkdir(event_folder)
 
 #-------------------------------------------------------------------------------
@@ -306,8 +320,8 @@
     time_thinning = 4
     yieldstep = 60
-else:
-    print ("Sorry, you must set the 'setup' variable to one of 'trial', "
-           "'basic' or 'final'. I found '%s'" % str(setup))
-    sanity_error = True
+##else:
+##    print ("Sorry, you must set the 'setup' variable to one of 'trial', "
+##           "'basic' or 'final'. I found '%s'" % str(setup))
+##    sanity_error = True
 
 #-------------------------------------------------------------------------------
@@ -330,5 +344,5 @@
 bounding_polygon = read_polygon(join(polygons_folder,
                                      bounding_polygon_filename))
-bounding_maxarea = 100000*scale_factor
+bounding_maxarea = bounding_polygon_maxarea*scale_factor
 
 # Estimate the number of triangles                     
@@ -336,11 +350,11 @@
                                   bounding_polygon, bounding_maxarea)
 
-#-------------------------------------------------------------------------------
-# Check for errors detected above.
-#-------------------------------------------------------------------------------
-
-if sanity_error:
-    print 'You must fix the above errors before continuing.'
-    sys.exit(10)
+###-------------------------------------------------------------------------------
+### Check for errors detected above.
+###-------------------------------------------------------------------------------
+##
+##if sanity_error:
+##    print 'You must fix the above errors before continuing.'
+##    sys.exit(10)
 
 
Index: /anuga_work/production/busselton/standardised_version/run_model.py
===================================================================
--- /anuga_work/production/busselton/standardised_version/run_model.py	(revision 6311)
+++ /anuga_work/production/busselton/standardised_version/run_model.py	(revision 6312)
@@ -39,22 +39,34 @@
 # Application specific imports
 import project  # Definition of file names and polygons
+import build_urs_boundary as bub
 
 
-#------------------------------------------------------------------------------
+#-------------------------------------------------------------------------------
+# Perform (as much as possible) a sanity check on values from import of project.
+#-------------------------------------------------------------------------------
+
+#-------------------------------------------------------------------------------
 # Copy scripts to time stamped output directory and capture screen
 # output to file. Copy script must be before screen_catcher
-#------------------------------------------------------------------------------
+#-------------------------------------------------------------------------------
+
 copy_code_files(project.output_run, __file__, 
-                os.path.dirname(project.__file__)+os.sep+\
-                project.__name__+'.py' )
+                os.path.join(os.path.dirname(project.__file__),
+                             project.__name__+'.py'))
 start_screen_catcher(project.output_run, 0, 1)
 
-
-#------------------------------------------------------------------------------
+#-------------------------------------------------------------------------------
 # Create the computational domain based on overall clipping polygon with
 # a tagged boundary and interior regions defined in project.py along with
 # resolutions (maximal area of per triangle) for each polygon
-#------------------------------------------------------------------------------
+#-------------------------------------------------------------------------------
+
 print 'Create computational domain'
+
+# Create the STS file
+bub.build_urs_boundary(os.path.join(project.muxhome, 'mux'),
+                       project.mux_input_filename,
+                       os.path.join(project.event_folder,
+                                    project.scenario_name))
 
 # Read in boundary from ordered sts file
@@ -69,5 +81,5 @@
 
 # Number of boundary segments
-N = len(event_sts)-1
+N = len(event_sts) - 1
 
 # Boundary tags refer to project.landward_boundary
@@ -91,8 +103,8 @@
 domain.set_minimum_storable_height(0.01)    # Don't store depth less than 1cm
 
+#-------------------------------------------------------------------------------
+# Setup initial conditions
+#-------------------------------------------------------------------------------
 
-#------------------------------------------------------------------------------
-# Setup initial conditions
-#------------------------------------------------------------------------------
 print 'Setup initial conditions'
 
@@ -109,13 +121,13 @@
                     alpha=project.alpha)
 
+#-------------------------------------------------------------------------------
+# Setup boundary conditions 
+#-------------------------------------------------------------------------------
 
-#------------------------------------------------------------------------------
-# Setup boundary conditions 
-#------------------------------------------------------------------------------
 print 'Set boundary - available tags:', domain.get_boundary_tags()
 
 Br = Reflective_boundary(domain)
 Bt = Transmissive_stage_zero_momentum_boundary(domain)
-Bd = Dirichlet_boundary([kwargs['tide'],0,0])
+Bd = Dirichlet_boundary([kwargs['tide'], 0, 0])
 Bf = Field_boundary(project.event_sts+'.sts',
                     domain, mean_stage=project.tide,
@@ -130,8 +142,8 @@
                      'ocean': Bf}) 
 
+#-------------------------------------------------------------------------------
+# Evolve system through time
+#-------------------------------------------------------------------------------
 
-#------------------------------------------------------------------------------
-# Evolve system through time
-#------------------------------------------------------------------------------
 t0 = time.time()
 for t in domain.evolve(yieldstep=project.yieldstep, 
@@ -141,3 +153,3 @@
     print domain.boundary_statistics(tags='ocean')
 
-print 'Simulation took %.2f seconds' %(time.time()-t0)
+print 'Simulation took %.2f seconds' % (time.time()-t0)
