source: anuga_work/production/pt_hedland_2006/compare_timeseries.py @ 5212

Last change on this file since 5212 was 4228, checked in by sexton, 17 years ago

(1) add building damage scripts for the study areas and update project.py (2) update report generation scripts (3) update Gantt chart (4) report updates to reflect URS input

File size: 3.1 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 anuga.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                              generate_fig = True,
47                              time_min = None,
48                              time_max = None,
49                              title_on = False,
50                              verbose = True)
51
52latex_output.append(texname)
53
54from shutil import copy, move
55copy ('report' + sep + texname + '.tex', project.comparereportdir + sep + texname + '.tex')
56
57
58# Start report generation
59input_name = project.comparereportdir + sep + 'comparison_pt_hedland.tex'
60fid = open(input_name, 'w')
61
62# Generate latex output for location points
63s = '\\begin{table} \label{table:locationspthedland} \n'
64fid.write(s)
65s = '\caption{Defined point locations for comparison study for Pt Hedland region.}' 
66fid.write(s)
67s = """
68\\begin{center}
69\\begin{tabular}{|l|l|l|l|}\hline
70\\bf{Point Name} & \\bf{Easting} & \\bf{Northing} & \\bf{Elevation (m)}\\\\ \hline
71"""
72fid.write(s)
73
74for i, thisvec in enumerate(vec):
75    name = thisvec[0]
76    east = thisvec[1]
77    north = thisvec[2]
78    elev = thisvec[3]
79    s = '%s & %.2f & %.2f & %.2f \\\\ \hline \n' %(name, east, north, elev)
80    fid.write(s)
81    for which_one in plot_quantity:
82        move ('report_figures' + sep + 'gauge'+name.replace(' ','')+which_one+'.png', project.comparereportfigdir)
83
84s = '\\end{tabular} \n  \end{center} \n \end{table} \n \n'
85fid.write(s)
86
87s = '\\begin{figure}[hbt] \n \centerline{ \includegraphics[width=150mm, height=100mm]{../report_figures/%s}}' %gauge_map
88fid.write(s)
89
90= """
91\caption{Point locations used for comparison between boundary at 50m and 100m contour for Onslow region.} 
92\label{fig:points}
93\end{figure}
94"""
95fid.write(s)
96   
97s = '\input{%s} \n \clearpage \n \n' %latex_output[0]
98fid.write(s)
Note: See TracBrowser for help on using the repository browser.