Skip to content
Snippets Groups Projects
mainreport.txt 7.18 KiB
<%doc>
This Mako template is intended to create a summary report page for Glance.

Created by Eva Schiffer Nov 2011.
Copyright (c) 2011 University of Wisconsin SSEC. All rights reserved.
</%doc>

<%!
    import glance.report as report
%>

<%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 spatial.has_key('file A') and spatial['file A'].has_key('numInvPts') and (spatial['file A']['numInvPts'] > 0) :
        <%
            fileAInfo = spatial['file A']
        %>
        <p>
            % if runInfo['shouldIncludeImages'] :
                <a href="./SpatialMismatch.A.png"><img src="./SpatialMismatch.A.small.png"></a><br>
            % endif
            File A has ${fileAInfo['numInvPts']} valid data points not present in File B.<br>
            File A has a total of ${report.make_formatted_display_string(fileAInfo['perInvPts'])}% invalid longitude/latitude data. <br>
        </p>
    % endif
    ## are there any in file B?
    %if spatial.has_key('file B') and spatial['file B'].has_key('numInvPts') and (spatial['file B']['numInvPts'] > 0) :
        <%
            fileBInfo = spatial['file B']
        %>
        <p>
            % if runInfo['shouldIncludeImages'] :
                <a href="./SpatialMismatch.B.png"><img src="./SpatialMismatch.B.small.png"></a><br>
            % endif
            File B has ${fileBInfo['numInvPts']} valid data points not present in File A.<br>
            File B has a total of ${report.make_formatted_display_string(fileBInfo['perInvPts'])}% longitude/latitude invalid data. <br>
        </p>
    % endif
    ## report on shared spatial invalidity if there is any
    % if spatial.has_key('perInvPtsInBoth') :
        <% perInBoth = spatial['perInvPtsInBoth'] %>
        % 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['variable_run_info']
                            
                            technicalName  = tempVarRunInfo['variable_name']
                            varDisplayName = technicalName
                            if 'display_name' in tempVarRunInfo :
                                varDisplayName = tempVarRunInfo['display_name']
                            
                            rSquaredCorr         = tempVariableInfo['r_squared_correlation']
                            passPercent          = tempVariableInfo['pass_epsilon_percent']
                            finiteSimilarPercent = tempVariableInfo['finite_similar_percent']
                            didPass              = tempVarRunInfo['did_pass']
                        %>
                        <tr>
                            <td>
                                % if not (didPass is None) :
                                    %if didPass :
                                        <img src="./pass.gif">
                                    %else :
                                        <img src="./fail.gif">
                                    % endif
                                % endif
                            </td>
                            <td>
                                Variable: <a href="${tempVarRunInfo['variable_report_path_escaped']}">${varDisplayName}</a> <br>
                                Epsilon used: ${tempVarRunInfo['epsilon']} <br>
                                ## if there is an epsilon percent, also show that
                                % if ('epsilon_percent' in tempVarRunInfo) and (tempVarRunInfo['epsilon_percent'] is not None) :
                                    Epsilon percent (of file A) used: ${tempVarRunInfo['epsilon_percent']}% <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['sharedVars'] %>
    % if len(sharedVars) > 0 :
        <h3>Shared Variables</h3>
        <p>
            The following variables were common to both files: <br>
            <blockquote>
                % for varName in 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['uniqueToAVars']
        uniqueToBVars = varNames['uniqueToBVars']
    %>
    ## 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 uniqueToAVars :
                        ${varName} <br>
                    % endfor
                </blockquote>
            </p>
        % endif
        
        % if (len(uniqueToBVars) > 0) :
            <p>
                Variables only found in file B:
                <blockquote>
                    %for varName in uniqueToBVars :
                        ${varName} <br>
                    % endfor
                </blockquote>
            </p>
        % endif
    
    % endif
    
    </%block>
    
</%block>