Changeset 5992
- Timestamp:
- Nov 25, 2008, 9:51:52 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_work/production/perth/ph2_compare.py
r5924 r5992 7 7 8 8 import project 9 from pylab import plot, xlabel, ylabel, savefig, ion, close, axis, title, legend, grid 9 from pylab import plot, xlabel, ylabel, savefig, ion, close, axis, title, legend, grid, figure 10 10 from os import sep 11 11 … … 15 15 16 16 def get_max_boundary_data(filename): 17 from anuga.utilities.numerical_tools import mean 17 18 fid = open(filename) 18 19 lines = fid.readlines() … … 22 23 fields = line.split(',') 23 24 stage.append(float(fields[3])) 24 return m ax(stage), min(stage)25 return mean(stage) 25 26 26 27 def get_stage_data(filename,depth,no_models): … … 60 61 61 62 event_number = 27283 62 boundary_m ax, boundary_min = get_max_boundary_data(project.boundaries_dir+str(event_number)+sep+'max_sts_stage.csv')63 boundary_mean = get_max_boundary_data(project.boundaries_dir+str(event_number)+sep+'max_sts_stage.csv') 63 64 64 65 ################################################### … … 70 71 depth = [5.0,10.,20.,50.] 71 72 no_models = 3 72 filename = directory + sep + 'perth_ph2_compare_v 2.csv'73 filename = directory + sep + 'perth_ph2_compare_v5.csv' 73 74 mean_stages, max_stages = get_stage_data(filename, depth, no_models) 74 75 … … 81 82 d1 = 100. 82 83 d2 = arange(d1,1,-0.1) 83 h1 = boundary_m ax84 h1 = boundary_mean 84 85 green = [] 85 86 for d in d2: … … 89 90 ion() 90 91 figure(1) 92 plot(depth,mean_stages[:,2],'>g',d2,green,'-g') 93 xlabel('depth (m)') 94 ylabel('stage (m)') 95 title('ANUGA outputs (average stage) versus Green\'s approximation \n \ 96 for event 27283 at Perth') 97 legend(['original','Green\'s law']) 98 #axis([5,105,min(min(stages))*0.9,max(max(stages))*1.1]) 99 grid(True) 100 figname = 'ph2compare_perth_mean_ORIG_' + str(event_number) + '_mean' 101 savefig(figname) 102 103 figure(2) 104 plot(depth,mean_stages[:,1],'+r',depth,mean_stages[:,2],'>g',d2,green,'-g') 105 xlabel('depth (m)') 106 ylabel('stage (m)') 107 title('ANUGA outputs (average stage) versus Green\'s approximation \n \ 108 for event 27283 at Perth') 109 legend(['250m poly','original','Green\'s law']) 110 #axis([5,105,min(min(stages))*0.9,max(max(stages))*1.1]) 111 grid(True) 112 figname = 'ph2compare_perth_mean_250AP_' + str(event_number) + '_mean' 113 savefig(figname) 114 115 figure(3) 91 116 plot(depth,mean_stages[:,0],'ob',depth,mean_stages[:,1],'+r',depth,mean_stages[:,2],'>g',d2,green,'-g') 92 117 xlabel('depth (m)') … … 97 122 #axis([5,105,min(min(stages))*0.9,max(max(stages))*1.1]) 98 123 grid(True) 99 figname = 'ph2compare_perth_mean_ ' + str(event_number)124 figname = 'ph2compare_perth_mean_ALL_' + str(event_number) + '_mean' 100 125 savefig(figname) 101 126 102 figure( 2)127 figure(4) 103 128 plot(depth,max_stages[:,0],'ob',depth,max_stages[:,1],'+r',depth,max_stages[:,2],'>g',d2,green,'-g') 104 129 xlabel('depth (m)') … … 109 134 #axis([5,105,min(min(stages))*0.9,max(max(stages))*1.1]) 110 135 grid(True) 111 figname = 'ph2compare_perth_max_' + str(event_number) 136 figname = 'ph2compare_perth_max_ALL_' + str(event_number) + '_mean' 137 savefig(figname) 112 138 close('all') 113 139
Note: See TracChangeset
for help on using the changeset viewer.