Changeset 6095


Ignore:
Timestamp:
Dec 19, 2008, 3:26:16 PM (16 years ago)
Author:
jgriffin
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • anuga_work/production/carnarvon/ph2_compare_table.py

    r6090 r6095  
    6565    rel_error = zeros(len(mean_stages[1,:]),Float)
    6666    for i in range(len(mean_stages[1,:])):
    67         abs_error[i] = (mean_stages[1,i]-mean_stages[1,2])
     67        abs_error[i] = (mean_stages[1,i]-mean_stages[1,no_models-1])
    6868        rel_error[i]= (abs_error[i]/mean_stages[1,no_models-1])*100
    6969    return abs_error,rel_error
     
    7373###################################################
    7474
    75 event_number = 27283
     75event_number = 27255
    7676boundary_mean = get_max_boundary_data(project.boundaries_dir+str(event_number)+sep+'max_sts_stage.csv')
    7777
     
    8383directory = project.home+project.state+sep+project.scenario+sep+'map_work'
    8484depth = [5.0,10.,20.,50.]
    85 no_models = 3
     85no_models = 2
    8686#plot?
    8787plot_flag = False
    8888#Table??
    8989table_flag = True
    90 filename = directory + sep + 'Carnarvon_Ph2_compare.csv'
     90filename = directory + sep + 'Carnarvon_Ph2_compare_'+str(event_number)+'.csv'
     91
    9192mean_stages, max_stages = get_stage_data(filename, depth, no_models)
    92 
     93print mean_stages
    9394###################################################
    9495# Compare with Green's function and plot
     
    170171if table_flag==True:
    171172    import csv
    172     table=[mean_stages[:,0],mean_stages[:,1],mean_stages[:,2]]
    173173    csvfile = directory+sep+'ph2compare_Carnarvon_max_ALL_' + str(event_number) + '_mean.csv'
    174174    fid1 = open(csvfile,'w')
    175175    writer = csv.writer(fid1,delimiter=',',)
    176     writer.writerow(('depth (m)','250m no poly','250m poly','original'))
    177     for i in range(len(depth)):
    178         writer.writerow((depth[i],mean_stages[i,0],mean_stages[i,1],mean_stages[i,2]))
    179     writer.writerow(('100',boundary_mean,boundary_mean,boundary_mean))
    180     writer.writerow(('M-value',M_value[0],M_value[1],M_value[2]))
    181     writer.writerow(('Absolute Error', abs_error[0],abs_error[1],abs_error[2]))
    182     writer.writerow(('Relative Error %', rel_error[0],rel_error[1],rel_error[2]))
    183 
     176
     177    if no_models==1:
     178        writer.writerow(('depth (m)','250m no poly'))
     179        for i in range(len(depth)):
     180            writer.writerow((depth[i],mean_stages[i,0]))
     181        writer.writerow(('100',boundary_mean,))
     182        writer.writerow(('M-value',M_value[0]))
     183        #writer.writerow(('Absolute Error', abs_error[0],abs_error[1]))
     184        #writer.writerow(('Relative Error %', rel_error[0],rel_error[1]))
     185
     186    if no_models==2:
     187        writer.writerow(('depth (m)','250m no poly','original'))
     188        for i in range(len(depth)):
     189            writer.writerow((depth[i],mean_stages[i,0],mean_stages[i,1]))
     190        writer.writerow(('100',boundary_mean,boundary_mean))
     191        writer.writerow(('M-value',M_value[0],M_value[1]))
     192        writer.writerow(('Absolute Error', abs_error[0],abs_error[1]))
     193        writer.writerow(('Relative Error %', rel_error[0],rel_error[1]))
     194       
     195    if no_models==3:
     196        writer.writerow(('depth (m)','250m no poly','250m poly','original'))
     197        for i in range(len(depth)):
     198            writer.writerow((depth[i],mean_stages[i,0],mean_stages[i,1],mean_stages[i,2]))
     199        writer.writerow(('100',boundary_mean,boundary_mean,boundary_mean))
     200        writer.writerow(('M-value',M_value[0],M_value[1],M_value[2]))
     201        writer.writerow(('Absolute Error', abs_error[0],abs_error[1],abs_error[2]))
     202        writer.writerow(('Relative Error %', rel_error[0],rel_error[1],rel_error[2]))
    184203
    185204    fid1.close()
Note: See TracChangeset for help on using the changeset viewer.