Index: /anuga_validation/automated_validation_tests/patong_beach_validation/compare_model_timeseries.py
===================================================================
--- /anuga_validation/automated_validation_tests/patong_beach_validation/compare_model_timeseries.py	(revision 7644)
+++ /anuga_validation/automated_validation_tests/patong_beach_validation/compare_model_timeseries.py	(revision 7645)
@@ -11,4 +11,8 @@
 
 from anuga.abstract_2d_finite_volumes.util import file_function
+from anuga.utilities.numerical_tools import cov, get_machine_precision
+
+
+import pylab
 import numpy as num
 import sys, os
@@ -43,8 +47,8 @@
     gauge_names = gauges.keys()
 
-    print sww_filename
-    print gauge_locations
-    os.system('cp %s tempfile.sww' % sww_filename) # Has end with sww
-    f = file_function('tempfile.sww', #_filename,
+    tempfile = 'xyz1234tempfile.sww' # Has to end with sww
+
+    os.system('cp %s %s' % (sww_filename, tempfile))
+    f = file_function(tempfile, 
                       quantities='stage',
                       interpolation_points=gauge_locations,
@@ -62,9 +66,94 @@
 
 
-    return timevector, timeseries
-
-
-
-def compare_timeseries(swwfile1, swwfile2):
+    return num.array(timevector), timeseries
+
+
+    
+def compare_timeseries(timevector, 
+                       timeseries1,
+                       timeseries2,
+                       name='',
+                       legend = ('Time series 1', 'Time series 2')):
+    """Compare and plot two timeseries
+    """
+
+    
+    timeseries1 = num.array(timeseries1)
+    timeseries2 = num.array(timeseries2) 
+    N = timevector.shape[0]
+    assert timeseries1.shape[0] == N    
+    assert timeseries2.shape[0] == N        
+    
+    eps = 1.0e-3
+    
+    # Covariance measure    
+    #res = cov(timeseries1, timeseries2)
+    #msg = 'Covariance between timeseries was too large: %e' % res
+    #assert res < 0.01, msg
+     
+    # Difference measures
+    print timeseries1
+    print timeseries1-timeseries2
+    
+    
+    # Maximum norm
+    nominator = max(abs(timeseries1-timeseries2))    
+    denominator = max(abs(timeseries1))
+    print nominator, denominator, N
+    if denominator > 0:
+        # Relative measure
+        res = nominator/denominator
+    else:
+        # Absolute measure
+        res = nominator/N
+                
+    msg = '%s: Difference between timeseries was too large: %e' % (name, res)
+    #assert res < eps, msg
+    
+    
+    nominator = sum(abs(timeseries1-timeseries2))    
+    denominator = sum(abs(timeseries1))
+    print nominator, denominator, N
+    if denominator > 0:
+        # Relative measure
+        res = nominator/denominator
+    else:
+        # Absolute measure
+        res = nominator/N
+                
+    msg = '%s: Difference between timeseries was too large: %e' % (name, res)
+    #assert res < eps, msg
+
+    # Extrema
+    #res = max(model)
+    #report_difference('Maximum', res, expected_maximum[name], rtol, atol)
+    
+    
+
+    # Generate plots
+    pylab.ion() # No plotting on screen
+    pylab.hold(False)
+    
+    pylab.plot(timevector, timeseries1, 'r-',
+               timevector, timeseries2, 'k-')
+
+    pylab.title('Gauge %s' % name)
+    pylab.xlabel('time(s)')
+    pylab.ylabel('stage (m)')    
+    pylab.legend(legend, shadow=True, loc='upper left')
+    pylab.savefig(name, dpi = 300)        
+
+    # Error vector
+    pylab.ion() # No plotting on screen
+    pylab.hold(False)
+    pylab.plot(timevector, timeseries1-timeseries2, 'b-')
+    pylab.title('Gauge %s (difference)' % name)    
+    pylab.xlabel('time(s)')
+    pylab.ylabel('stage difference (m)')  
+    pylab.savefig(name + '_diff', dpi = 300)                  
+    
+    
+
+def compare_all_timeseries(swwfile1, swwfile2):
     
     timevector1, timeseries1 = get_timeseries(swwfile1, gauges)
@@ -74,8 +163,27 @@
           (swwfile1, swwfile2)
     assert num.allclose(timevector1, timevector2), msg
-
+    timevector = timevector1
+    
+    # Check that both timeseries exist for all gauges
+    for name in timeseries2:
+        assert name in timeseries1
+    
+    for name in timeseries1:
+        assert name in timeseries2
+            
+    # Compare all timeseries data individually
+    for name in timeseries1:
+        compare_timeseries(timevector, 
+                           timeseries1[name],
+                           timeseries2[name],
+                           name=name)
+        
+        
+        
+            
+    
     print 'OK'
     
-
+    
 
 if __name__ == '__main__':
@@ -85,7 +193,7 @@
         import sys; sys.exit(-1) 
 
-    res = compare_timeseries(sys.argv[1], sys.argv[2])
+    #res = compare_all_timeseries(sys.argv[1], sys.argv[2])
     try:
-        res = compare_timeseries(sys.argv[1], sys.argv[2])
+        res = compare_all_timeseries(sys.argv[1], sys.argv[2])
     except:
         sys.exit(-1)
Index: /anuga_validation/automated_validation_tests/patong_beach_validation/project.py
===================================================================
--- /anuga_validation/automated_validation_tests/patong_beach_validation/project.py	(revision 7644)
+++ /anuga_validation/automated_validation_tests/patong_beach_validation/project.py	(revision 7645)
@@ -36,5 +36,5 @@
 
 use_buildings = True
-setup = 'trial'         # This can be one of three values
+setup = 'basic'         # This can be one of three values
                         #    trial - coarsest mesh, fast
                         #    basic - coarse mesh
Index: /anuga_validation/automated_validation_tests/patong_beach_validation/validate.py
===================================================================
--- /anuga_validation/automated_validation_tests/patong_beach_validation/validate.py	(revision 7644)
+++ /anuga_validation/automated_validation_tests/patong_beach_validation/validate.py	(revision 7645)
@@ -53,5 +53,5 @@
                          'patong.sww.FINAL.tgz'
                         )
-#Optional_Data_Objects = ('patong.sww.TRIAL.tgz',)
+Optional_Data_Objects = ('patong.sww.BASIC.tgz',)
 
 # path to the local data directory
@@ -349,4 +349,8 @@
     #cmd = 'python cmpsww.py %s %s > cmpsww.stdout' % (local_sww, new_output_sww)
     cmd = 'python compare_model_timeseries.py %s %s > compare_model_timeseries.stdout' % (local_sww, new_output_sww)
+    print '-------------------------------------'
+    print cmd
+    print '-------------------------------------'    
+    
     log.debug("check_that_output_is_as_expected: doing '%s'" % cmd)
     res = os.system(cmd)
