Index: anuga_work/development/Hinwood_2008/calc_norm.py
===================================================================
--- anuga_work/development/Hinwood_2008/calc_norm.py	(revision 5659)
+++ anuga_work/development/Hinwood_2008/calc_norm.py	(revision 5664)
@@ -131,5 +131,5 @@
                   
 def plot_rrms_sensor_settings(run_data, outputdir_tags, quantity,
-              save_as=None,
+              save_as=True,
               is_interactive=False, max_rmsd=None):
     """
@@ -140,6 +140,5 @@
     from anuga.shallow_water.data_manager import csv2dict
 
-    # TODO
-    # scale the plot
+
     plot_type = ".pdf"
     
@@ -196,4 +195,80 @@
     close()
 
+def auto_plot_test_rmsd(scenarios, outputdir_tag, quantity="stage",
+              save_as=True,
+              is_interactive=False, max_rmsd=1.0):
+    
+    tests = []
+    
+    for i in range(0,len(scenarios),2):
+        tests.append([scenarios[i], scenarios[i+1]])
+
+    for test in tests:
+        plot_test_rmsd(test, outputdir_tag, quantity,
+              save_as=save_as,
+              is_interactive=is_interactive, max_rmsd=max_rmsd)
+        
+def plot_test_rmsd(test, outputdir_tag, quantity,
+              save_as=None,
+              is_interactive=False, max_rmsd=None):
+    """
+    For a test, plot rmsd vs x location for both runs.
+    Also, add the break measurement.
+    """
+    from pylab import ion, plot, xlabel, ylabel, close, legend, \
+         savefig, title, axis, setp, subplot, grid, axvspan, figlegend
+    from anuga.shallow_water.data_manager import csv2dict
+        
+    plot_type = ".pdf"   
+    id = test[0]['scenario_id'][:2]
+    
+    if is_interactive:
+        ion()
+    time_date = strftime('plot date: %d/%m/%Y Time: %H:%M:%S',
+                                      localtime()) 
+    #subplot(212)    
+    plot_title = id + " Root Mean Square Deviation comparison" + '\n' \
+                 + time_date
+                 
+    #title(plot_title)
+    y_label = "RMSD"
+    ylabel(y_label)
+    xlabel("x location, m")
+    grid(True)
+
+    lines = []
+    for run in test:
+            
+        outputdir_name = run['scenario_id'] + outputdir_tag
+        pro_instance = project.Project(['data','flumes','Hinwood_2008'],
+                                       outputdir_name=outputdir_name)
+        
+        file_err = pro_instance.rmsd_dir + sep + outputdir_name + "_" \
+                   + quantity + "_err.csv"
+            
+        simulation, _ = csv2dict(file_err)
+        locations = [float(x) for x in simulation['x location']]
+        rmsd_list = [float(x) for x in simulation['rmsd']]
+        lines.append(plot(locations, rmsd_list))
+        
+        for break_x in run['break_xs']:
+            axvspan(break_x-0.001,break_x+0.001, facecolor='g')
+        
+    if max_rmsd is not None:
+        #print "setting axis"
+        axis(ymin=0, ymax=max_rmsd)
+       
+    figlegend(lines, outputdir_tags,'upper left')
+    
+    if is_interactive:
+        raw_input()
+
+    save_as = pro_instance.plots_dir + sep + \
+              id + "_rmsd" + plot_type
+    if save_as is not None:
+        savefig(save_as)
+    
+    close()
+
 # Return a bunch of lists
 # The err files, for all scenarios
@@ -317,8 +392,12 @@
     #scenarios = [scenarios[0]] # !!!!!!!!!!!!!!!!!!!!!!
     #scenarios = scenarios[4:] # !!!!!!!!!!!!!!!!!!!!!!
-    #for outputdir_tag in outputdir_tags:
-    #    auto_rrms(outputdir_tag, scenarios, "stage", y_location_tag=':0.0')
+    if False:
+        for outputdir_tag in outputdir_tags:
+            auto_rrms(outputdir_tag, scenarios, "stage", y_location_tag=':0.0')
     
     #scenarios = [scenarios[0]] # !!!!!!!!!!!!!!!!!!!!!!
-    auto_plot_rrms_sensor_settings(outputdir_tags, scenarios, "stage")
+    #auto_plot_rrms_sensor_settings(outputdir_tags, scenarios, "stage")
     #compare_different_settings(outputdir_tags, scenarios, "stage")
+
+    outputdir_tag = "_nolmts_wdth_0.1_z_0.0_ys_0.01_mta_0.01_G" 
+    auto_plot_test_rmsd(scenarios, outputdir_tag)
