Index: /anuga_work/production/perth/ph2_compare_table.py
===================================================================
--- /anuga_work/production/perth/ph2_compare_table.py	(revision 6092)
+++ /anuga_work/production/perth/ph2_compare_table.py	(revision 6093)
@@ -65,5 +65,5 @@
     rel_error = zeros(len(mean_stages[1,:]),Float)
     for i in range(len(mean_stages[1,:])):
-        abs_error[i] = (mean_stages[1,i]-mean_stages[1,2])
+        abs_error[i] = (mean_stages[1,i]-mean_stages[1,no_models-1])
         rel_error[i]= (abs_error[i]/mean_stages[1,no_models-1])*100
     return abs_error,rel_error
@@ -73,5 +73,5 @@
 ###################################################
 
-event_number = 68693
+event_number = 27283
 boundary_mean = get_max_boundary_data(project.boundaries_dir+str(event_number)+sep+'max_sts_stage.csv')
 
@@ -83,12 +83,13 @@
 directory = project.home+project.state+sep+project.scenario+sep+'map_work'
 depth = [5.0,10.,20.,50.]
-no_models = 3
+no_models = 2
 #plot?
 plot_flag = False
 #Table??
 table_flag = True
-filename = directory + sep + 'perth_ph2_compare_v5.csv'
+filename = directory + sep + 'perth_ph2_compare_'+str(event_number)+'.csv'
+
 mean_stages, max_stages = get_stage_data(filename, depth, no_models)
-
+print mean_stages
 ###################################################
 # Compare with Green's function and plot
@@ -124,9 +125,9 @@
 ##    ylabel('stage (m)')
 ##    title('ANUGA outputs (average stage) versus Green\'s approximation \n \
-##    for event 27283 at Perth')
+##    for event 27283 at perth')
 ##    legend(['original','Green\'s law'])
 ##    #axis([5,105,min(min(stages))*0.9,max(max(stages))*1.1])
 ##    grid(True)
-##    figname = 'ph2compare_Perth_mean_ORIG_' + str(event_number) + '_mean'
+##    figname = 'ph2compare_perth_mean_ORIG_' + str(event_number) + '_mean'
 ##    savefig(figname)
 ##
@@ -136,9 +137,9 @@
 ##    ylabel('stage (m)')
 ##    title('ANUGA outputs (average stage) versus Green\'s approximation \n \
-##    for event 27283 at Perth')
+##    for event 27283 at perth')
 ##    legend(['250m poly','original','Green\'s law'])
 ##    #axis([5,105,min(min(stages))*0.9,max(max(stages))*1.1])
 ##    grid(True)
-##    figname = 'ph2compare_Perth_mean_250AP_' + str(event_number) + '_mean'
+##    figname = 'ph2compare_perth_mean_250AP_' + str(event_number) + '_mean'
 ##    savefig(figname)
 ##
@@ -148,9 +149,9 @@
 ##    ylabel('stage (m)')
 ##    title('ANUGA outputs (average stage) versus Green\'s approximation \n \
-##    for event 27283 at Perth')
+##    for event 27283 at perth')
 ##    legend(['250m no poly','250m poly','original','Green\'s law'])
 ##    #axis([5,105,min(min(stages))*0.9,max(max(stages))*1.1])
 ##    grid(True)
-##    figname = 'ph2compare_Perth_mean_ALL_' + str(event_number) + '_mean'
+##    figname = 'ph2compare_perth_mean_ALL_' + str(event_number) + '_mean'
 ##    savefig(figname)
 ##
@@ -160,9 +161,9 @@
 ##    ylabel('stage (m)')
 ##    title('ANUGA outputs (max stage) versus Green\'s approximation \n \
-##    for event 27283 at Perth')
+##    for event 27283 at perth')
 ##    legend(['250m no poly','250m poly','original','Green\'s law'])
 ##    #axis([5,105,min(min(stages))*0.9,max(max(stages))*1.1])
 ##    grid(True)
-##    figname = 'ph2compare_Perth_max_ALL_' + str(event_number) + '_mean'
+##    figname = 'ph2compare_perth_max_ALL_' + str(event_number) + '_mean'
 ##    savefig(figname)
 ##    close('all')
@@ -170,16 +171,34 @@
 if table_flag==True:
     import csv
-    table=[mean_stages[:,0],mean_stages[:,1],mean_stages[:,2]]
-    csvfile = directory+sep+'ph2compare_Perth_max_ALL_' + str(event_number) + '_mean.csv'
+    csvfile = directory+sep+'ph2compare_perth_max_ALL_' + str(event_number) + '_mean.csv'
     fid1 = open(csvfile,'w')
     writer = csv.writer(fid1,delimiter=',',)
-    writer.writerow(('depth (m)','250m no poly','250m poly','original'))
-    for i in range(len(depth)):
-        writer.writerow((depth[i],mean_stages[i,0],mean_stages[i,1],mean_stages[i,2]))
-    writer.writerow(('100',boundary_mean,boundary_mean,boundary_mean))
-    writer.writerow(('M-value',M_value[0],M_value[1],M_value[2]))
-    writer.writerow(('Absolute Error', abs_error[0],abs_error[1],abs_error[2]))
-    writer.writerow(('Relative Error %', rel_error[0],rel_error[1],rel_error[2]))
-
+
+    if no_models==1:
+        writer.writerow(('depth (m)','250m no poly'))
+        for i in range(len(depth)):
+            writer.writerow((depth[i],mean_stages[i,0]))
+        writer.writerow(('100',boundary_mean,))
+        writer.writerow(('M-value',M_value[0]))
+        #writer.writerow(('Absolute Error', abs_error[0],abs_error[1]))
+        #writer.writerow(('Relative Error %', rel_error[0],rel_error[1]))
+
+    if no_models==2:
+        writer.writerow(('depth (m)','250m no poly','original'))
+        for i in range(len(depth)):
+            writer.writerow((depth[i],mean_stages[i,0],mean_stages[i,1]))
+        writer.writerow(('100',boundary_mean,boundary_mean))
+        writer.writerow(('M-value',M_value[0],M_value[1]))
+        writer.writerow(('Absolute Error', abs_error[0],abs_error[1]))
+        writer.writerow(('Relative Error %', rel_error[0],rel_error[1]))
+        
+    if no_models==3:
+        writer.writerow(('depth (m)','250m no poly','250m poly','original'))
+        for i in range(len(depth)):
+            writer.writerow((depth[i],mean_stages[i,0],mean_stages[i,1],mean_stages[i,2]))
+        writer.writerow(('100',boundary_mean,boundary_mean,boundary_mean))
+        writer.writerow(('M-value',M_value[0],M_value[1],M_value[2]))
+        writer.writerow(('Absolute Error', abs_error[0],abs_error[1],abs_error[2]))
+        writer.writerow(('Relative Error %', rel_error[0],rel_error[1],rel_error[2]))
 
     fid1.close()
