source: anuga_work/production/exmouth_2006/plot_contour_data.py @ 5245

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

(1) update of production processes document (2) test for generating points for URS output (3) update of graduate proposal

File size: 2.4 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, figure
6from os import sep
7 
8directory = project.output_dir
9
10#timedir = '20070618_035101_run_final_1.4_dampier_nbartzis' # HAT 1 in Dampier 10000 yr
11#timedir = '20070619_042043_run_final_1.4_onslow_nbartzis' # HAT 1 in Onslow 10000 yr
12timedir = '20070619_042542_run_final_1.4_exmouth_nbartzis' # HAT 1 in Exmouth 10000 yr
13
14def get_data(filename):
15    fid = open(filename)
16    lines = fid.readlines()
17    fid.close()
18    stage = []
19    for line in lines[1:]:
20        fields = line.split(',')
21        stage.append(float(fields[2]))
22    return max(stage), min(stage)
23
24files = ['stage0_convert.csv','stage5_convert.csv','stage20_convert.csv','stage50_convert.csv','stage80_convert.csv']
25depth = [0,5,20,50,80]
26stage_max = []
27stage_min = []
28
29for thefile in files:
30
31    filename = directory + timedir + sep + thefile
32    max_stage, min_stage = get_data(filename)
33    stage_max.append(max_stage)
34    stage_min.append(min_stage)
35
36from anuga.abstract_2d_finite_volumes.util import greens_law
37from Numeric import arange
38d1 = 80.
39d2 = arange(d1,0.15,-0.1)
40h1 = max_stage
41#h1 = 4.0
42green = []
43for d in d2:
44    h2 = greens_law(d1,d,h1)
45    green.append(h2)
46   
47ion()
48plot(depth,stage_max,'ob',d2,green,'-g',depth,stage_max,'-b')
49xlabel('depth (m)') 
50ylabel('stage (m)')
51title('ANUGA modelled maximum stage versus Green\'s approximation \n \
52Magnitude 9.3 event (Java) at Exmouth')
53#title('ANUGA modelled maximum stage versus Green\'s approximation \n \
54#Magnitude 9.1 event (Sumba) at Exmouth')
55#title('ANUGA modelled maximum stage versus Green\'s approximation \n \
56#Magnitude 9.0 event (Sumba) at Exmouth')
57legend(['ANUGA','Green\'s law'])
58#axis([-5,85,min(stage_max)*0.9,max(stage_max)*1.1])
59axis([-5,85,3.5,max(stage_max)*1.1])
60grid(True)
61#savefig('stratification_onslow_gun')
62savefig('stratification_exmouth_gun')
63#savefig('stratification_dampier_gun')
64
65depthv2 = [0,5,20,80]
66datav2 = [8.2,6,4,h1]
67figure(2)
68plot(d2,green,'g-',depthv2,datav2,'bo-')
69xlabel('depth (m)')
70ylabel('stage (m)')
71title('ANUGA modelled maximum stage versus Green\'s approximation \n \
72Magnitude 9.3 event (Java) at Exmouth')
73legend(['ANUGA','Green\'s law'])
74axis([-5,85,3.5,max(stage_max)*1.1])
75grid(True)
76savefig('strat_exmouth_gun_v2')
77close('all')
78
Note: See TracBrowser for help on using the repository browser.