source: anuga_work/production/onslow_2006/plot_contour_data.py @ 5523

Last change on this file since 5523 was 4927, checked in by sexton, 16 years ago

scripts for stratification investigation

File size: 1.9 KB
Line 
1"""Read in contour data file and plot max and min
2"""
3
4import project
5from pylab import plot, xlabel, ylabel, savefig, ion, close, axis, title, legend, grid
6from os import sep
7 
8directory = project.outputdir
9timedir = '20070906_061418_run_final_1.5_jsexton_exmouth_original'
10#timedir = '20070608_060316_run_final_1.5_onslow_nbartzis'
11#timedir = '20070613_034754_run_final_1.5_dampier_nbartzis'
12
13def get_data(filename):
14    fid = open(filename)
15    lines = fid.readlines()
16    fid.close()
17    stage = []
18    for line in lines[1:]:
19        fields = line.split(',')
20        stage.append(float(fields[2]))
21    return max(stage), min(stage)
22
23files = ['stage0_convert.csv','stage5_convert.csv','stage20_convert.csv','stage80_convert.csv']
24depth = [0,5,20,80]
25stage_max = []
26stage_min = []
27
28for thefile in files:
29
30    filename = directory + timedir + sep + thefile
31    max_stage, min_stage = get_data(filename)
32    stage_max.append(max_stage)
33    stage_min.append(min_stage)
34
35from anuga.abstract_2d_finite_volumes.util import greens_law
36from Numeric import arange
37d1 = 80.
38d2 = arange(d1,0.15,-0.1)
39h1 = max_stage
40#h1 = 4.0
41green = []
42for d in d2:
43    h2 = greens_law(d1,d,h1)
44    green.append(h2)
45   
46ion()
47plot(depth,stage_max,'ob',d2,green,'-g',depth,stage_max,'-b')
48xlabel('depth (m)') 
49ylabel('stage (m)')
50title('ANUGA modelled maximum stage versus Green\'s approximation \n \
51Magnitude 9.3 event (Java) at Onslow')
52#title('ANUGA modelled maximum stage versus Green\'s approximation \n \
53#Magnitude 9.1 event (Sumba) at Onslow')
54#title('ANUGA modelled maximum stage versus Green\'s approximation \n \
55#Magnitude 9.0 event (Sumba) at Onslow')
56legend(['ANUGA','Green\'s law'])
57axis([-5,85,min(stage_max)*0.9,max(stage_max)*1.1])
58grid(True)
59#savefig('stratification_onslow_gun')
60savefig('stratification_exmouth_gun')
61#savefig('stratification_dampier_gun')
62
63close('all')
64
Note: See TracBrowser for help on using the repository browser.