source: production/pt_hedland_2006/compare_timeseries.py @ 3330

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

MOST and ANUGA comparisons and updates

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