source: anuga_work/production/dampier_2006/plot_contour_data.py @ 5409

Last change on this file since 5409 was 4949, checked in by sexton, 17 years ago

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

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
6from os import sep
7 
8directory = project.outputdir
9
10#timedir = '20070618_063824_run_final_2.4_onslow_nbartzis'
11timedir = '20070620_044413_run_final_2.4_exmouth_nbartzis'
12#timedir = '20070419_065050_run_final_2.4_dampier_nbartzis'
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
24# Dampier
25files = ['stage0_convert_d.csv','stage5_convert_d.csv','stage20_convert_d.csv','stage80_convert_d.csv']
26depth = [0,5,20,80]
27# Karratha
28#files = ['stage0_convert_k.csv','stage5_convert_k.csv','stage20_convert_k.csv','stage80_convert_k.csv']
29
30stage_max = []
31stage_min = []
32
33for thefile in files:
34
35    filename = directory + timedir + sep + thefile
36    max_stage, min_stage = get_data(filename)
37    stage_max.append(max_stage)
38    stage_min.append(min_stage)
39
40from anuga.abstract_2d_finite_volumes.util import greens_law
41from Numeric import arange
42d1 = 80.
43d2 = arange(d1,0.15,-0.1)
44h1 = max_stage
45#h1 = 4.0
46green = []
47for d in d2:
48    h2 = greens_law(d1,d,h1)
49    green.append(h2)
50   
51ion()
52plot(depth,stage_max,'ob',d2,green,'-g',depth,stage_max,'-b')
53xlabel('depth (m)') 
54ylabel('stage (m)')
55# Dampier
56title('ANUGA modelled maximum stage versus Green\'s approximation \n \
57Magnitude 9.3 event (Java) at Dampier')
58#title('ANUGA modelled maximum stage versus Green\'s approximation \n \
59#Magnitude 9.1 event (Sumba) at Dampier')
60#title('ANUGA modelled maximum stage versus Green\'s approximation \n \
61#Magnitude 9.0 event (Sumba) at Dampier')
62# Karratha
63#title('ANUGA modelled maximum stage versus Green\'s approximation \n \
64#Magnitude 9.3 event (Java) at Karratha')
65#title('ANUGA modelled maximum stage versus Green\'s approximation \n \
66#Magnitude 9.1 event (Sumba) at Karratha')
67#title('ANUGA modelled maximum stage versus Green\'s approximation \n \
68#Magnitude 9.0 event (Sumba) at Karratha')
69
70legend(['ANUGA','Green\'s law'])
71axis([-5,85,min(stage_max)*0.9,max(stage_max)*1.1])
72grid(True)
73#savefig('stratification_onslow_gun')
74savefig('stratification_exmouth_gun')
75#savefig('stratification_dampier_gun')
76
77close('all')
78
Note: See TracBrowser for help on using the repository browser.