Changeset 6095
- Timestamp:
- Dec 19, 2008, 3:26:16 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_work/production/carnarvon/ph2_compare_table.py
r6090 r6095 65 65 rel_error = zeros(len(mean_stages[1,:]),Float) 66 66 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]) 68 68 rel_error[i]= (abs_error[i]/mean_stages[1,no_models-1])*100 69 69 return abs_error,rel_error … … 73 73 ################################################### 74 74 75 event_number = 272 8375 event_number = 27255 76 76 boundary_mean = get_max_boundary_data(project.boundaries_dir+str(event_number)+sep+'max_sts_stage.csv') 77 77 … … 83 83 directory = project.home+project.state+sep+project.scenario+sep+'map_work' 84 84 depth = [5.0,10.,20.,50.] 85 no_models = 385 no_models = 2 86 86 #plot? 87 87 plot_flag = False 88 88 #Table?? 89 89 table_flag = True 90 filename = directory + sep + 'Carnarvon_Ph2_compare.csv' 90 filename = directory + sep + 'Carnarvon_Ph2_compare_'+str(event_number)+'.csv' 91 91 92 mean_stages, max_stages = get_stage_data(filename, depth, no_models) 92 93 print mean_stages 93 94 ################################################### 94 95 # Compare with Green's function and plot … … 170 171 if table_flag==True: 171 172 import csv 172 table=[mean_stages[:,0],mean_stages[:,1],mean_stages[:,2]]173 173 csvfile = directory+sep+'ph2compare_Carnarvon_max_ALL_' + str(event_number) + '_mean.csv' 174 174 fid1 = open(csvfile,'w') 175 175 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])) 184 203 185 204 fid1.close()
Note: See TracChangeset
for help on using the changeset viewer.