Index: /anuga_work/development/Hinwood_2008/plot.py
===================================================================
--- /anuga_work/development/Hinwood_2008/plot.py	(revision 5458)
+++ /anuga_work/development/Hinwood_2008/plot.py	(revision 5459)
@@ -14,5 +14,6 @@
                      legend_sim='ANUGA simulation',
                      legend_exp='Measured flume result',
-                     is_interactive=False):
+                     is_interactive=False,
+                     use_axis=None):
     """ 
     """
@@ -44,5 +45,6 @@
     legend((legend_sim, legend_exp),'upper left')
     title(plot_title)
-    #axis([0,60,0.380,0.420])
+    if use_axis is not None:
+        axis(use_axis)
     
     if is_interactive:
@@ -107,5 +109,8 @@
             plot_title = "Scenario: " + outputdir_name + "\n" + \
                          "X Gauge (m):" + str(gauge) + "    " + time_date
-                         
+            if gauge < run_data['axis_maximum_x']:
+                use_axis = run_data['axis']
+            else:
+                use_axis = None
             print "Doing ", plot_title
             plot_compare_csv(location_sim=loc_sim,
@@ -116,5 +121,6 @@
                              y_label='Water '+ quantity +' (m)',
                              is_interactive=False,
-                             save_as=save_as)
+                             save_as=save_as,
+                             use_axis=use_axis)
     
 #-------------------------------------------------------------
@@ -123,6 +129,6 @@
     """
     from scenarios import scenarios
-    outputdir_tag = "_test_C"
-    #scenarios = scenarios[1]
+    outputdir_tag = "_good_tri_area_0.01_C"
+    #scenarios = scenarios[1:]
     #scenarios = [scenarios[5]] 
     plot(scenarios, outputdir_tag)
Index: /anuga_work/development/Hinwood_2008/prepare_time_boundary.py
===================================================================
--- /anuga_work/development/Hinwood_2008/prepare_time_boundary.py	(revision 5458)
+++ /anuga_work/development/Hinwood_2008/prepare_time_boundary.py	(revision 5459)
@@ -15,4 +15,5 @@
 from Scientific.IO.NetCDF import NetCDFFile
 from Numeric import array, zeros, Float
+from os.path import join
   
 from anuga.utilities.numerical_tools import ensure_numeric
@@ -20,5 +21,6 @@
 from interp import interp
 
-from os.path import join
+
+import project
 
 # from os import getenv
@@ -115,4 +117,6 @@
     
     # Read velocity file
+    #print "*********************"
+    #print "velocity_file", velocity_file
     vfid = open(velocity_file)
     lines = vfid.readlines()
@@ -133,4 +137,5 @@
 
     # Read the depth file
+    #print "depth_file", depth_file
     dfid = open(depth_file)
     lines = dfid.readlines()
@@ -159,9 +164,11 @@
     #print "len(dtimes)", len(vtimes)
     #print "len(depths_at_vtimes)", len(depths_at_vtimes)
-#     for i in range(len(depths_at_vtimes)):
+    #print "metadata_dic['scenario_id']", metadata_dic['scenario_id']
+ #    for i in range(len(depths_at_vtimes)):
 #         print "i", i
 #         print "vtimes[i]", vtimes[i]
 #         print "depths_at_vtimes[i]", depths_at_vtimes[i]
-#     print "depths_at_vtimes",  depths_at_vtimes
+
+    #print "depths_at_vtimes",  depths_at_vtimes
     depths_at_vtimes = depths_at_vtimes/1000.00 # convert from mm to m
     missing=missing/1000.00 # Do to missing what is done to depths_at_vtimes
@@ -192,9 +199,13 @@
 
     fid.close()
+    print "The start time for is", start_time
+    if not start_time == metadata_dic['ANUGA_start_time']:
+        raise ValueError, "The calc'ed and recorded start times are different"
+    # Modify the sensor array to reflect the new start time
+    sensors[:,0] -= start_time
     
     # Since there is a new time reference save the depth info using this
     # new reference.
     fid = open(depth_file[:-4] + '_exp_depth.csv','w')
-    sensors[:,0] -= start_time
     #print "depth_file", depth_file
     #print "start_time", start_time
@@ -226,5 +237,4 @@
     # new reference.
     fid = open(depth_file[:-4] + '_exp_stage.csv','w')
-    sensors[:,0] -= start_time
     
     # Write a header
@@ -248,4 +258,5 @@
 def prepare_time_boundary(metadata_dic, raw_data_dir, output_dir):
     """
+    Use this if a project instance has already been created.
     """
     scenario_id = metadata_dic['scenario_id']
@@ -256,5 +267,6 @@
     
     final_time = combine_velocity_depth(velocity_file, depth_file, out_file,
-                                        metadata_dic)  
+                                        metadata_dic)
+    #print "metadata_dic['xleft'][1]", metadata_dic['xleft'][1]
     if metadata_dic['xleft'][1] >= 0.0:
         # This should be a -ve value, since the still water level is the
@@ -264,6 +276,27 @@
     csv2tms(tsm_file, metadata_dic['xleft'][1])
     return final_time
+
+# Don't do this, since run-dam changes the  metadata_dic['xleft'][1],
+# which is used by this function
+def prepare_time_boundary_for_scenarios_warning(scenarios,
+                                        outputdir_tag):
+
+    for run_data in scenarios:       
+        id = run_data['scenario_id']
+        outputdir_name = id + outputdir_tag
+        pro_instance = project.Project(['data','flumes','Hinwood_2008'],
+                                       outputdir_name=outputdir_name)
+        prepare_time_boundary(run_data,
+                              pro_instance.raw_data_dir,
+                              pro_instance.boundarydir)
+        
     
 #-------------------------------------------------------------------
 if __name__ == "__main__":
-    pass
+    
+    import sys; sys.exit()
+    
+    from scenarios import scenarios
+    outputdir_tag = "XXXX"
+    prepare_time_boundary_for_scenarios(scenarios,
+                                        outputdir_tag)
Index: /anuga_work/development/Hinwood_2008/run_dam.py
===================================================================
--- /anuga_work/development/Hinwood_2008/run_dam.py	(revision 5458)
+++ /anuga_work/development/Hinwood_2008/run_dam.py	(revision 5459)
@@ -78,8 +78,8 @@
         
     elif run_type == 3:
-        outputdir_name += '_test_good_time_mesh'
+        outputdir_name += '_yieldstep_0.1_tri_area_0.01_C'
         yieldstep = 0.1
         finaltime = None       
-        maximum_triangle_area=0.001
+        maximum_triangle_area=0.01
     elif run_type == 4:
         outputdir_name += '_good_tri_area_0.01_C'
@@ -115,4 +115,5 @@
                                        pro_instance.raw_data_dir,
                                        pro_instance.boundarydir)
+    #return pro_instance
     if finaltime is None:
         finaltime = boundary_final_time
@@ -251,4 +252,5 @@
     run_type = 1
     #for run_data in [scenarios[5]]:
+    #scenarios = scenarios[2:]
     for run_data in scenarios:
         pro_instance = main( run_data['scenario_id'] + '_boundary.tsm'  ,
@@ -256,3 +258,3 @@
                              run_type = run_type,
                              outputdir_name=run_data['scenario_id'])
-        gauges_for_slope(pro_instance.outputdir,[run_data])
+        #gauges_for_slope(pro_instance.outputdir,[run_data])
