source: anuga_work/production/broome/plot_contour_data.py @ 6805

Last change on this file since 6805 was 5001, checked in by nick, 17 years ago

update broome with new structure

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
9
10timedir = '20070615_063022_run_final_4.9_exmouth_nbartzis' # HAT exmouth
11#timedir = '20070618_064014_run_final_4.9_onslow_nbartzis' # HAT onslow
12#timedir = '20070615_063137_run_final_4.9_dampier_nbartzis' # HAT dampier
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','stage80_convert.csv']
25depth = [0,5,20,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 Broome')
53#title('ANUGA modelled maximum stage versus Green\'s approximation \n \
54#Magnitude 9.1 event (Sumba) at Broome')
55#title('ANUGA modelled maximum stage versus Green\'s approximation \n \
56#Magnitude 9.0 event (Sumba) at Broome')
57legend(['ANUGA','Green\'s law'])
58axis([-5,85,min(stage_max)*0.9,max(stage_max)*1.1])
59grid(True)
60#savefig('stratification_onslow_gun')
61savefig('stratification_exmouth_gun')
62#savefig('stratification_dampier_gun')
63
64close('all')
65
Note: See TracBrowser for help on using the repository browser.