source: production/onslow_2006/MOST_timeseries.py @ 3181

Last change on this file since 3181 was 3159, checked in by sexton, 19 years ago

adding MOST output to onslow report

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