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

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

(a) minor updates for Cairns example in manual (b) scripts for stratification investigation for other model areas

File size: 2.0 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.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'])
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.