Changeset 3015 for production/pt_hedland_2006/make_report.py
- Timestamp:
- May 30, 2006, 12:00:56 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
production/pt_hedland_2006/make_report.py
r2950 r3015 34 34 * an introduction must be written in introduction.tex; a basic outline and 35 35 some of the core inputs are already in place 36 * an results.tex file needs to be written for the particular scenario 37 * the tsunami-genic event should be discussed in tsunami_scenario.tex 36 * the tsunami-genic event should be discussed in tsunami_scenario.tex 37 * a computational_setup.tex file needs to be written for the particular scenario 38 * the interpretation of the results needs to be written to interpretation.tex 39 * maximum inundation maps need to be included in HAT_map and LAT_map etc. 40 * damage modelling maps need to be included in HAT_damage and LAT_damage etc. 38 41 * a summary must be written into summary.tex 39 42 * metadata for the scenario data to be included in metadata.tex … … 44 47 from os import getcwd, sep, altsep, mkdir, access, F_OK 45 48 import project 46 from pyvolution.util import sww2timeseries 49 from pyvolution.util import sww2timeseries, get_gauges_from_file 47 50 48 51 # Derive scenario name … … 54 57 scenario_name = '%s %s' %(test[0], test[1]) 55 58 59 # Create report directory 60 reportdir = getcwd()+sep+'report'+sep 61 if access(reportdir,F_OK) == 0: 62 mkdir (reportdir) 63 56 64 # User defined inputs 57 65 report_title = 'Tsunami impact modelling for the North West shelf: %s' %scenario_name.title() … … 60 68 '': 'Lowest Astronomical Tide'} 61 69 70 max_maps = {'Highest Astronomical Tide': 'HAT_map', 71 'Lowest Astronomical Tide': 'LAT_map'} 72 73 damage_maps = {'Highest Astronomical Tide': 'HAT_damage', 74 'Lowest Astronomical Tide': 'LAT_damage'} 75 62 76 # Create sections and graphs for each designated production directory 63 77 latex_output = [] … … 71 85 label_id, 72 86 report = True, 73 plot_quantity = ['stage', 'velocity' , 'bearing'],87 plot_quantity = ['stage', 'velocity'], 74 88 time_min = None, 75 89 time_max = None, 76 title_on = False, 90 title_on = False, 77 91 verbose = True) 78 92 … … 80 94 81 95 96 82 97 # Start report generation 83 reportdir = getcwd()+sep+'report'+sep84 if access(reportdir,F_OK) == 0:85 mkdir (reportdir)86 98 report_name = reportdir + scenario + '_report.tex' 87 99 fid = open(report_name, 'w') … … 94 106 % * an introduction must be written in introduction.tex; a basic outline and 95 107 % some of the core inputs are already in place 96 % * an results.tex file needs to be written for the particular scenario97 108 % * the tsunami-genic event should be discussed in tsunami_scenario.tex 109 % * an computational_setup.tex file needs to be written for the particular scenario 110 % * the interpretation of the results needs to be written to interpretation.tex 111 % * maximum inundation maps need to be included in HAT_map.tex and LAT_map.tex etc. 112 % * damage modelling maps need to be included in HAT_damage and LAT_damage etc. 98 113 % * a summary must be written into summary.tex 99 114 % * metadata for the scenario data to be included in metadata.tex … … 151 166 \section{Inundation modelling results} 152 167 \label{sec:results} 153 \input{ results}168 \input{computational_setup} 154 169 155 170 """ 171 fid.write(s) 172 173 # Generate latex output for gauges 174 s = '\\begin{table} \label{table:gaugelocations} \n' 175 fid.write(s) 176 s = '\caption{Defined gauge locations for %s study area.}' %scenario_name.title() 177 fid.write(s) 178 s = """ 179 \\begin{center} 180 \\begin{tabular}{|l|l|l|l|}\hline 181 \\bf{Gauge Name} & \\bf{Easting} & \\bf{Northing} & \\bf{Elevation}\\\\ \hline 182 """ 183 fid.write(s) 184 185 gauges, locations = get_gauges_from_file(project.gauge_filename) 186 187 for name, gauges in zip(locations, gauges): 188 east = gauges[0] 189 north = gauges[1] 190 elev = 0.0 191 #elev = gauges[2] 192 s = '%s & %.2f & %.2f & %.2f \\\\ \hline \n' %(name.replace('_',' '), east, north, elev) 193 fid.write(s) 194 195 s = '\\end{tabular} \n \end{center} \n \end{table} \n \n' 196 fid.write(s) 197 198 s = '\input{interpretation} \n' 156 199 fid.write(s) 157 200 … … 162 205 s = '\subsection{%s} \n \n' %production_dirs[name] 163 206 fid.write(s) 164 207 208 s = '\input{%s} \n \clearpage \n \n' %max_maps[production_dirs[name]] 209 fid.write(s) 210 165 211 s = '\input{%s} \n \clearpage \n \n' %latex_output[i] 166 212 fid.write(s) 167 213 168 169 # Closing 214 # Closing 215 170 216 s = """ 171 217 \section{Damage modelling} 172 218 \input{damage} 173 174 \section{Summary} 219 """ 220 fid.write(s) 221 222 for i, name in enumerate(production_dirs.keys()): 223 224 s = '\subsection{%s} \n \n' %production_dirs[name] 225 fid.write(s) 226 227 s = '\input{%s} \n \clearpage \n \n' %damage_maps[production_dirs[name]] 228 fid.write(s) 229 230 231 s = """ 232 \section{Summary} 175 233 \input{summary} 176 234 177 235 \section{References} 178 236 \input{references} 237 179 238 \section{Metadata} 180 239 \label{sec:metadata}
Note: See TracChangeset
for help on using the changeset viewer.