""" Generate latex output comparing time series of given sww files Inputs: production dirs: dictionary of output directories with a association to simulation, eg 50m boundary, 100m boundary gauge_map: graphical output from make_gauges.py Outputs: * latex output to generate figures for report * figures used for report stored in the report_figure directory NOTE, this directory will need to be committed, as well as the latex files. June 2006 """ from os import sep, getcwd, F_OK, access, mkdir import project from pyvolution.util import sww2timeseries, get_gauges_from_file # User defined inputs production_dirs = {'20060515_001733': '100m boundary', '20060530_102753': '50m boundary'}#, #'MOST': 'MOST'} gauge_map = 'boundarycomparison.png' # Create sections and graphs for each designated production directory latex_output = [] swwfiles = {} for label_id in production_dirs.keys(): file_loc = project.outputdir + label_id + sep swwfile = file_loc + project.basename + '.sww' if label_id == 'MOST': swwfile = project.boundarydir + project.boundary_basename + '.sww' swwfiles[swwfile] = label_id print 'swwfiles', swwfiles texname, vec = sww2timeseries(swwfiles, project.gauges50,#project.gauge_comparison, production_dirs, report = True, reportname = 'latexoutput_MOST_ANUGA_comparison', plot_quantity = ['stage', 'speed'], surface = False, time_min = None, time_max = None, title_on = False, verbose = True) latex_output.append(texname) from shutil import copy, move copy ('report' + sep + texname + '.tex', project.comparereportdir + sep + texname + '.tex') # Start report generation input_name = project.comparereportdir + sep + 'MOST_ANUGA_comparison_onslow.tex' fid = open(input_name, 'w') s = '\\begin{figure}[hbt] \n \centerline{ \includegraphics[width=150mm, height=100mm]{../report_figures/%s}}' %gauge_map fid.write(s) s = """ \caption{Point locations used to compare MOST and ANUGA for Onslow region.} \label{fig:comparisonpoints} \end{figure} """ fid.write(s) s = '\input{%s} \n \clearpage \n \n' %latex_output[0] fid.write(s) # Generate latex output for location points #s = '\\begin{table} \label{table:MOSTlocationsonslow} \n' #fid.write(s) #s = '\caption{Defined point locations for comparison study for Onslow region.}' #fid.write(s) #s = """ #\\begin{center} #\\begin{tabular}{|l|l|l|l|}\hline #\\bf{Point Name} & \\bf{Easting} & \\bf{Northing} & \\bf{Elevation (m)}\\\\ \hline #""" #fid.write(s) #for i, thisvec in enumerate(vec): # name = thisvec[0] # east = thisvec[1] # north = thisvec[2] # elev = thisvec[3] # s = '%s & %.2f & %.2f & %.2f \\\\ \hline \n' %(name, east, north, elev) # fid.write(s) # for which_one in plot_quantity: # move ('report_figures' + sep + 'gauge'+name.replace(' ','')+which_one+'.png', project.comparereportfigdir) #s = '\\end{tabular} \n \end{center} \n \end{table} \n \n' #fid.write(s)