<%doc> This Mako template is intended to create a summary report page about a comparison of two files for Glance's report generation. Created by Eva Schiffer Nov 2011. Copyright (c) 2011 University of Wisconsin SSEC. All rights reserved. </%doc> <%! import glance.report as report import glance.constants as constants %> <%inherit file="basereport.txt"/> <%block name="title">File Comparison Summary</%block> ## report on any points that are spatially invalid in one file and not the other <%block name="spatialInvalidity"> ## if we have some unique spatially invalid points, report them ## are there any in file A? %if (constants.A_FILE_TITLE_KEY in spatial) and (constants.NUMBER_INVALID_PTS_KEY in spatial[constants.A_FILE_TITLE_KEY]) and (spatial[constants.A_FILE_TITLE_KEY][constants.NUMBER_INVALID_PTS_KEY] > 0) : <% fileAInfo = spatial[constants.A_FILE_TITLE_KEY] %> <p> % if runInfo[constants.DO_MAKE_IMAGES_KEY] : <a href="./SpatialMismatch.A.png"><img src="./SpatialMismatch.A.small.png"></a><br> % endif File A has ${fileAInfo[constants.NUMBER_INVALID_PTS_KEY]} valid data points not present in File B.<br> File A has a total of ${report.make_formatted_display_string(fileAInfo[constants.PERCENT_INVALID_PTS_KEY])}% invalid longitude/latitude data. <br> </p> % endif ## are there any in file B? %if (constants.B_FILE_TITLE_KEY in spatial) and (constants.NUMBER_INVALID_PTS_KEY in spatial[constants.B_FILE_TITLE_KEY]) and (spatial[constants.B_FILE_TITLE_KEY][constants.NUMBER_INVALID_PTS_KEY] > 0) : <% fileBInfo = spatial[constants.B_FILE_TITLE_KEY] %> <p> % if runInfo[constants.DO_MAKE_IMAGES_KEY] : <a href="./SpatialMismatch.B.png"><img src="./SpatialMismatch.B.small.png"></a><br> % endif File B has ${fileBInfo[constants.NUMBER_INVALID_PTS_KEY]} valid data points not present in File A.<br> File B has a total of ${report.make_formatted_display_string(fileBInfo[constants.PERCENT_INVALID_PTS_KEY])}% longitude/latitude invalid data. <br> </p> % endif ## report on shared spatial invalidity if there is any % if (constants.PERCENT_INV_PTS_SHARED_KEY in spatial) : <% perInBoth = spatial[constants.PERCENT_INV_PTS_SHARED_KEY] %> % if perInBoth > 0 : <p> lon/lat data that is invalid in either file A or file B: ${report.make_formatted_display_string(perInBoth)}% </p> % endif % endif </%block> ## this is the main body block that includes most of the comparison info <%block name="comparedData"> ## list all of the variables that were compared (if any) <%block name="comparedVariablesList"> % if len(variables.keys()) > 0 : <h3>Compared Variables</h3> ## report on all the variables that were compared and give a basic stat idea of how well they did <blockquote> <p> ## TODO replace the table with floating boxes at some point <table> % for variableKey in sorted(list(variables)) : <% # get some information about the variable, for convenience tempVariableInfo = variables[variableKey] tempVarRunInfo = tempVariableInfo[constants.VARIABLE_RUN_INFO_KEY] technicalName = tempVarRunInfo[constants.VARIABLE_TECH_NAME_KEY] varDisplayName = technicalName if constants.DISPLAY_NAME_KEY in tempVarRunInfo : varDisplayName = tempVarRunInfo[constants.DISPLAY_NAME_KEY] rSquaredCorr = tempVariableInfo[constants.R_SQUARED_COEFF_VALUE_KEY] passPercent = tempVariableInfo[constants.PASSED_EPSILON_PERCENT_KEY] finiteSimilarPercent = tempVariableInfo[constants.FINITE_SIMILAR_PERCENT_KEY] didPass = tempVarRunInfo [constants.DID_VARIABLE_PASS_KEY] %> <tr> <td> % if not (didPass is None) : %if didPass : <div class="testpass">✔</div> %else : <div class="testfail">✘</div> % endif % endif </td> <td> Variable: <a href="${tempVarRunInfo[constants.VAR_REPORT_PATH_KEY]}">${varDisplayName}</a> <br> Epsilon used: ${tempVarRunInfo[constants.EPSILON_KEY]} <br> ## if there is an epsilon percent, also show that % if (constants.EPSILON_PERCENT_KEY in tempVarRunInfo) and (tempVarRunInfo[constants.EPSILON_PERCENT_KEY] is not None) : Epsilon percent (of file A) used: ${tempVarRunInfo[constants.EPSILON_PERCENT_KEY]}% <br> % endif ## if there's an r squared correlation value, also show that % if rSquaredCorr is not None : R-squared Correlation Coefficient: ${rSquaredCorr}<br> % endif Finite values within one epsilon of difference: ${report.make_formatted_display_string(passPercent, '%.6g')}%<br> Data that matched in finite-ness between the files: ${report.make_formatted_display_string(finiteSimilarPercent, '%.6g')}% </td> </tr> % endfor </table> </p> </blockquote> % endif </%block> ## report the names of variables shared between the two files, if any <%block name="sharedVarNames"> <% sharedVars = varNames[constants.SHARED_VARIABLE_NAMES_KEY] %> % if len(sharedVars) > 0 : <h3>Shared Variables</h3> <p> The following variables were common to both files: <br> <blockquote> % for varName in sorted(sharedVars) : ${varName} <br> % endfor </blockquote> </p> % endif </%block> ## report the names of variables unique to a or b, if any <%block name="uniqueVarNames"> <% uniqueToAVars = varNames[constants.VAR_NAMES_UNIQUE_TO_A_KEY] uniqueToBVars = varNames[constants.VAR_NAMES_UNIQUE_TO_B_KEY] %> ## check to see if there are any unique variables we need to report % if (len(uniqueToAVars) > 0) or (len(uniqueToBVars) > 0) : <h3>Unique Variables</h3> % if (len(uniqueToAVars) > 0) : <p> Variables only found in file A: <blockquote> %for varName in sorted(uniqueToAVars) : ${varName} <br> % endfor </blockquote> </p> % endif % if (len(uniqueToBVars) > 0) : <p> Variables only found in file B: <blockquote> %for varName in sorted(uniqueToBVars) : ${varName} <br> % endfor </blockquote> </p> % endif % endif </%block> </%block> <%block name="attrsTitle"> <h3>Global Attributes</h3> </%block>