source: production/onslow_2006/compare_timeseries.py @ 3261

Last change on this file since 3261 was 3252, checked in by sexton, 19 years ago
File size: 3.3 KB
Line 
1"""
2Generate latex output comparing time series of given sww files
3
4Inputs:
5
6output dirs: dictionary of output directories with a
7             association to simulation, eg 50m boundary, 100m boundary
8                   
9Outputs:
10
11* latex output to generate figures for report
12* figures used for report stored in the report_figure directory
13NOTE, this directory will need to be committed, as well as
14the latex files.
15
16June 2006                   
17"""
18
19from os import sep
20import project
21from pyvolution.util import sww2timeseries, get_gauges_from_file
22
23# User defined inputs
24# for comparison between MOST and ANUGA
25production_dirs = {'20060515_001733': '100m boundary',
26                   '20060530_102753': '50m boundary',
27                   'MOST': 'MOST'}
28
29gauge_map = 'onslow_boundary_gauges.png' # MOST/ANUGA comparison
30
31plot_quantity = ['stage', 'speed']
32
33# Create sections and graphs for each designated production directory
34latex_output = []
35swwfiles = {}
36for label_id in production_dirs.keys():
37   
38    file_loc = project.outputdir + label_id + sep
39    swwfile = file_loc + project.basename + '.sww'
40    if label_id == 'MOST':
41        swwfile = project.boundarydir + project.boundary_basename + '.sww'
42    swwfiles[swwfile] = label_id
43
44texname, vec = sww2timeseries(swwfiles,
45                              project.gauges50,
46                              production_dirs,
47                              report = True,
48                              reportname = 'latexoutput_compare50_100_MOST',
49                              surface = False,
50                              plot_quantity = plot_quantity,
51                              time_min = None,
52                              time_max = None,
53                              title_on = False,
54                              verbose = True)
55
56latex_output.append(texname)
57
58# for MOST/ANUGA comparison
59from shutil import copy, move
60copy ('report' + sep + texname + '.tex', project.comparereportdir + sep + texname + '.tex')
61
62
63# Start report generation
64# for MOST/ANUGA comparison
65input_name = project.comparereportdir + sep + '50100MOSTcomparison_onslow.tex'
66fid = open(input_name, 'w')
67
68
69# Generate latex output for location points
70s = '\\begin{table} \label{table:locationsonslow} \n'
71fid.write(s)
72s = '\caption{Defined point locations for comparison study for Onslow region.}' 
73fid.write(s)
74s = """
75\\begin{center}
76\\begin{tabular}{|l|l|l|l|}\hline
77\\bf{Point Name} & \\bf{Easting} & \\bf{Northing} & \\bf{Elevation (m)}\\\\ \hline
78"""
79fid.write(s)
80
81for i, thisvec in enumerate(vec):
82    name = thisvec[0]
83    east = thisvec[1]
84    north = thisvec[2]
85    elev = thisvec[3]
86    s = '%s & %.2f & %.2f & %.2f \\\\ \hline \n' %(name, east, north, elev)
87    fid.write(s)
88    for which_one in plot_quantity:
89        move ('report_figures' + sep + 'gauge'+name.replace(' ','')+which_one+'.png', project.comparereportfigdir)
90
91s = '\\end{tabular} \n  \end{center} \n \end{table} \n \n'
92fid.write(s)
93
94s = '\\begin{figure}[hbt] \n \centerline{ \includegraphics[width=150mm, height=100mm]{../report_figures/%s}}' %gauge_map
95fid.write(s)
96
97= """
98\caption{Point locations used for comparison between boundary at 50m and 100m contour for Onslow region.} 
99\label{fig:points}
100\end{figure}
101"""
102fid.write(s)
103   
104s = '\input{%s} \n \clearpage \n \n' %latex_output[0]
105fid.write(s)
Note: See TracBrowser for help on using the repository browser.