[3159] | 1 | """ |
---|
| 2 | Generate latex output comparing time series of given sww files |
---|
| 3 | |
---|
| 4 | Inputs: |
---|
| 5 | |
---|
[3188] | 6 | production dirs: dictionary of output directories with a |
---|
| 7 | association to simulation, eg 50m boundary, 100m boundary |
---|
| 8 | |
---|
| 9 | gauge_map: graphical output from make_gauges.py |
---|
| 10 | |
---|
[3159] | 11 | Outputs: |
---|
| 12 | |
---|
| 13 | * latex output to generate figures for report |
---|
| 14 | * figures used for report stored in the report_figure directory |
---|
| 15 | NOTE, this directory will need to be committed, as well as |
---|
| 16 | the latex files. |
---|
| 17 | |
---|
| 18 | June 2006 |
---|
| 19 | """ |
---|
| 20 | |
---|
| 21 | from os import sep, getcwd, F_OK, access, mkdir |
---|
| 22 | import project |
---|
| 23 | from pyvolution.util import sww2timeseries, get_gauges_from_file |
---|
| 24 | |
---|
| 25 | # User defined inputs |
---|
[3188] | 26 | production_dirs = {'20060515_001733': '100m boundary', |
---|
[3285] | 27 | '20060530_102753': '50m boundary'}#, |
---|
| 28 | #'MOST': 'MOST'} |
---|
[3159] | 29 | |
---|
| 30 | gauge_map = 'boundarycomparison.png' |
---|
| 31 | |
---|
| 32 | # Create sections and graphs for each designated production directory |
---|
| 33 | latex_output = [] |
---|
| 34 | swwfiles = {} |
---|
| 35 | for 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] | 43 | print 'swwfiles', swwfiles |
---|
| 44 | |
---|
[3159] | 45 | texname, 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 | |
---|
| 57 | latex_output.append(texname) |
---|
| 58 | |
---|
[3188] | 59 | from shutil import copy, move |
---|
| 60 | copy ('report' + sep + texname + '.tex', project.comparereportdir + sep + texname + '.tex') |
---|
[3159] | 61 | |
---|
| 62 | # Start report generation |
---|
[3190] | 63 | input_name = project.comparereportdir + sep + 'MOST_ANUGA_comparison_onslow.tex' |
---|
[3159] | 64 | fid = open(input_name, 'w') |
---|
| 65 | |
---|
[3188] | 66 | s = '\\begin{figure}[hbt] \n \centerline{ \includegraphics[width=150mm, height=100mm]{../report_figures/%s}}' %gauge_map |
---|
| 67 | fid.write(s) |
---|
| 68 | |
---|
| 69 | s = """ |
---|
| 70 | \caption{Point locations used to compare MOST and ANUGA for Onslow region.} |
---|
| 71 | \label{fig:comparisonpoints} |
---|
| 72 | \end{figure} |
---|
| 73 | """ |
---|
| 74 | fid.write(s) |
---|
| 75 | |
---|
| 76 | s = '\input{%s} \n \clearpage \n \n' %latex_output[0] |
---|
| 77 | fid.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) |
---|