source: production/onslow_2006/MOST_timeseries.py @ 3290

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

scripts to interrogate onslow outputs

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