source: production/onslow_2006/compare_timeseries.py @ 3190

Last change on this file since 3190 was 3190, checked in by sexton, 18 years ago

MOST and ANUGA comparisons and updates

File size: 3.2 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
24production_dirs = {'20060515_001733': '100m boundary',
25                   '20060530_102753': '50m boundary',
26                   'MOST': 'MOST'}
27
28gauge_map = 'onslow_boundary_gauges.png'
29
30plot_quantity = ['stage', 'speed']
31
32# Create sections and graphs for each designated production directory
33latex_output = []
34swwfiles = {}
35for label_id in production_dirs.keys():
36   
37    file_loc = project.outputdir + label_id + sep
38    swwfile = file_loc + project.basename + '.sww'
39    if label_id == 'MOST':
40        swwfile = project.boundarydir + project.boundary_basename + '.sww'
41    swwfiles[swwfile] = label_id
42
43texname, vec = sww2timeseries(swwfiles,
44                              project.gauges50,
45                              production_dirs,
46                              report = True,
47                              reportname = 'latexoutput_compare50_100_MOST',
48                              surface = False,
49                              plot_quantity = plot_quantity,
50                              time_min = None,
51                              time_max = None,
52                              title_on = False,
53                              verbose = True)
54
55latex_output.append(texname)
56
57from shutil import copy, move
58copy ('report' + sep + texname + '.tex', project.comparereportdir + sep + texname + '.tex')
59
60
61# Start report generation
62input_name = project.comparereportdir + sep + '50100MOSTcomparison_onslow.tex'
63fid = open(input_name, 'w')
64
65# Generate latex output for location points
66s = '\\begin{table} \label{table:locationsonslow} \n'
67fid.write(s)
68s = '\caption{Defined point locations for comparison study for Onslow region.}' 
69fid.write(s)
70s = """
71\\begin{center}
72\\begin{tabular}{|l|l|l|l|}\hline
73\\bf{Point Name} & \\bf{Easting} & \\bf{Northing} & \\bf{Elevation (m)}\\\\ \hline
74"""
75fid.write(s)
76
77for i, thisvec in enumerate(vec):
78    name = thisvec[0]
79    east = thisvec[1]
80    north = thisvec[2]
81    elev = thisvec[3]
82    s = '%s & %.2f & %.2f & %.2f \\\\ \hline \n' %(name, east, north, elev)
83    fid.write(s)
84    for which_one in plot_quantity:
85        move ('report_figures' + sep + 'gauge'+name.replace(' ','')+which_one+'.png', project.comparereportfigdir)
86
87s = '\\end{tabular} \n  \end{center} \n \end{table} \n \n'
88fid.write(s)
89
90s = '\\begin{figure}[hbt] \n \centerline{ \includegraphics[width=150mm, height=100mm]{../report_figures/%s}}' %gauge_map
91fid.write(s)
92
93= """
94\caption{Point locations used for comparison between boundary at 50m and 100m contour for Onslow region.} 
95\label{fig:points}
96\end{figure}
97"""
98fid.write(s)
99   
100s = '\input{%s} \n \clearpage \n \n' %latex_output[0]
101fid.write(s)
Note: See TracBrowser for help on using the repository browser.