Index: /anuga_work/production/busselton/standardised_version/run_model.py
===================================================================
--- /anuga_work/production/busselton/standardised_version/run_model.py	(revision 6368)
+++ /anuga_work/production/busselton/standardised_version/run_model.py	(revision 6369)
@@ -46,95 +46,5 @@
 # Application specific imports
 from setup_model import project
-
-
-
-##
-# @brief Build boundary STS files from one or more MUX files.
-# @param mux_dir Directory containing the MUX files.
-# @param event_file Path to meta-file containing mux files+weight data.
-# @param output_dir Directory to write STS data to.
-# @note 'event_file' is produced by EventSelection.
-def build_urs_boundary(mux_dir, event_file, output_dir):
-    '''Build a boundary STS file from a set of MUX files.'''
-
-    print 'build_urs_boundary: mux_dir=%s' % mux_dir
-    print 'build_urs_boundary: event_file=%s' % event_file
-    print 'build_urs_boundary: output_dir=%s' % output_dir
-
-    # if we are using an EventSelection multi-mux file
-    if project.multi_mux:    
-        # get the mux+weight data from the event file
-        mux_event_file = os.path.join(mux_dir, event_file)
-        try:
-            fd = open(mux_event_file, 'r')
-            mux_data = fd.readlines()
-            fd.close()
-        except IOError, e:
-            msg = 'File %s cannot be read: %s' % (mux_event_file, str(e))
-            raise Exception, msg
-        except:
-            raise
-
-        # first line of file is # filenames+weight in rest of file
-        num_lines = int(mux_data[0].strip())
-        mux_data = mux_data[1:]
-        print 'number of sources %d' % num_lines
-
-        # quick sanity check on input mux meta-file
-        if num_lines != len(mux_data):
-            msg = ('Bad file %s: %d data lines, but line 1 count is %d'
-                   % (event_file, len(mux_data), num_lines))
-            raise Exception, msg
-
-        # Create filename and weights lists.
-        # Must chop GRD filename just after '*.grd'.
-        mux_filenames = []
-        for line in mux_data:
-            muxname = line.strip().split()[0]
-            split_index = muxname.index('.grd')
-            muxname = muxname[:split_index+len('.grd')]
-            muxname = os.path.join(mux_dir, muxname)
-            mux_filenames.append(muxname)
-        
-        mux_weights = [float(line.strip().split()[1]) for line in mux_data]
-
-        # Call legacy function to create STS file.
-        # This should be replaced in the future.
-        print 'reading', project.urs_order
-        print 'creating STS file'
-        print 'mux_filenames=%s' % str(mux_filenames)
-        print 'basename_out=%s' % str(output_dir)
-        print 'ordering_filename=%s' % str(project.urs_order)
-        print 'weights=%s' % str(mux_weights)
-        print 'mean_stage=%s' % str(project.tide)
-        urs2sts(mux_filenames,
-                basename_out=output_dir,
-                ordering_filename=project.urs_order,
-                weights=mux_weights,
-                mean_stage=project.tide,
-                verbose=True)
-    else:                           # a single mux stem file
-        urs_filenames = [os.path.join(mux_dir, event_file)]
-
-        weight_factor = 1.0
-        weights = weight_factor*num.ones(len(urs_filenames), num.float)
-            
-        order_filename = os.path.join(project.order_filename_dir)
-
-        print 'reading', order_filename
-        # Create ordered sts file
-        print 'creating sts file'
-        urs2sts(urs_filenames,
-                basename_out=os.path.join(project.boundaries_dir,
-                                          project.scenario_name),
-                ordering_filename=order_filename,
-                weights=weights,
-                mean_stage=project.tide,
-                verbose=True)
-
-    # report on stuff so far
-    quantities, elevation, time = get_sts_gauge_data(project.event_folder,
-                                                     verbose=False)
-    print len(elevation), len(quantities['stage'][0,:])
+import build_urs_boundary as bub
 
 #-------------------------------------------------------------------------------
@@ -158,7 +68,6 @@
 # Create the STS file
 print 'project.mux_data_folder=%s' % project.mux_data_folder
-bub.build_urs_boundary(project.mux_input_filename,
-                       os.path.join(project.event_folder,
-                                    project.scenario_name))
+if not os.path.exists(project.event_sts + '.sts'):
+    bub.build_urs_boundary(project.mux_input_filename, project.event_sts)
 
 # Read in boundary from ordered sts file
@@ -206,8 +115,11 @@
 
 # Set the initial stage in the offcoast region only
-IC = Polygon_function(project.land_initial_conditions,
-                      default=project.tide,
-                      geo_reference=domain.geo_reference)
-domain.set_quantity('stage', IC, use_cache=True, verbose=True)
+if project.land_initial_conditions:
+    IC = Polygon_function(project.land_initial_conditions,
+                          default=project.tide,
+                          geo_reference=domain.geo_reference)
+else:
+    IC = 0
+omain.set_quantity('stage', IC, use_cache=True, verbose=True)
 domain.set_quantity('friction', project.friction) 
 domain.set_quantity('elevation', 
@@ -225,5 +137,5 @@
 Br = Reflective_boundary(domain)
 Bt = Transmissive_stage_zero_momentum_boundary(domain)
-Bd = Dirichlet_boundary([kwargs['tide'], 0, 0])
+Bd = Dirichlet_boundary([project.tide, 0, 0])
 Bf = Field_boundary(project.event_sts+'.sts',
                     domain, mean_stage=project.tide,
@@ -235,5 +147,5 @@
 
 domain.set_boundary({'back': Br,
-                     'side': Bt,
+                     'side': Bd,
                      'ocean': Bf}) 
 
