source: production/karratha_2005/get_timeseries.py @ 1868

Last change on this file since 1868 was 1836, checked in by ole, 19 years ago

Added points where timeseries is plottet

File size: 1.5 KB
Line 
1"""Read in sww file, interpolate at specified locations and plot
2"""
3
4import project
5from pyvolution.util import file_function
6
7swwfile = project.outputdir + project.basename + '.sww'
8
9#gauges = [[0.000, 1.696]]  #Boundary
10#gauges += [[4.521, 1.196],  [4.521, 1.696],  [4.521, 2.196]] #Ch 5-7-9
11#gauge_names = ['Boundary', 'ch5', 'ch7', 'ch9']
12#finaltime = 22.5
13#timestep = 0.05
14
15gauges = [[60000, 83000],
16          [60000, 80000],
17          [60000, 75000],                   
18          [60000, 70000],         
19          [60000, 60000],
20          [60000, 50000],         
21          [60000, 40000],
22          [60000, 30000],         
23          [60000, 20000],
24          [60000, 10000],         
25          [60000, 0]]
26#gauge_names = ['SW', 'N', 'N2', ]
27 
28
29#Read model output
30from caching import cache
31#f = file_function(swwfile,
32#                  quantities = 'stage',
33#                  interpolation_points = gauges,
34#                  verbose = True)
35
36f = cache(file_function, swwfile,
37          {'quantities': 'stage',
38           'interpolation_points': gauges,
39           'verbose': True},
40          dependencies = [swwfile],
41          verbose = True)
42
43print f
44model_time = f.T
45
46
47for k, g in enumerate(gauges):
48    model_values = []
49    for i, t in enumerate(f.T):
50        val = f(t, point_id = k)[0]
51        model_values.append(val)
52
53    from pylab import *
54    ion()
55    hold(False)
56    plot(model_time, model_values, '-b')
57    name = str(g)
58    title('Gauge %s' %name)
59    savefig(name, dpi = 300)
60
61    raw_input('Next')
62show()
63
Note: See TracBrowser for help on using the repository browser.