Skip to content
Snippets Groups Projects
basereport.txt 8.97 KiB
Newer Older
<%doc>
This Mako template builds the skeleton of html reports for glance.

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
%>

<%block name="htmlContent">

<html>
    <head>
        <title>${self.title()}</title>
Alan De Smet's avatar
Alan De Smet committed
		<style>
		th.l { text-align: left; }
Alan De Smet's avatar
Alan De Smet committed
		td.n,th.n { text-align: right; }
		body { font-family: sans-serif; }
Alan De Smet's avatar
Alan De Smet committed
		h4 { margin-bottom: 0; }
		tr th { background-color: white; }
		tr:nth-child(even) { background-color: #EEE; }
		table { border-collapse: collapse; }
		td, th { padding-left: 0.5em; padding-right: 0.5em; }
Alan De Smet's avatar
Alan De Smet committed
		</style>
        <h1><%block name="title"/></h1>
        
        <%block name="runIdentification">
        
        ## display information on the version, user, and machine that ran the report
        <p>
            % if constants.GLANCE_VERSION_INFO_KEY in runInfo :
                report produced with ${runInfo[constants.GLANCE_VERSION_INFO_KEY]} <br>
            analysis generated ${runInfo[constants.TIME_INFO_KEY]} by user ${runInfo[constants.USER_INFO_KEY]} on ${runInfo[constants.MACHINE_INFO_KEY]}
        </p>
        
        </%block>
        
        <%block name="fileIdentification">
        
        ## show information on each of the files we're comparing (should only be two)
        % for fileKey in sorted(list(files)) :
            <% tempFileInfo = files[fileKey] %>
            <p>
                ${fileKey}:
                % if constants.DISPLAY_NAME_KEY in tempFileInfo :
                    ${tempFileInfo[constants.DISPLAY_NAME_KEY]}
                    path: ${tempFileInfo[constants.PATH_KEY]} <br>
                    md5sum for ${fileKey}: ${tempFileInfo[constants.MD5SUM_KEY]} <br>
                    last modified: ${tempFileInfo[constants.LAST_MODIFIED_KEY]}
                </blockquote>
            </p>
        % endfor
        
        </%block>
        
        <%block name="configInfo">
        
        ## display info on the config file that was used, if one was
        % if (constants.CONFIG_FILE_PATH_KEY in runInfo) and (runInfo[constants.CONFIG_FILE_PATH_KEY] is not None) :
                A configuration file was used to control the production of this report.<br>
                Please see <a href="./${runInfo[constants.CONFIG_FILE_NAME_KEY]}">this copy of the configuration file</a>
                </%block>
                for details.
            </p>
            
            <p>
            <% wasFiltered = False %>
            
            <%block name="additionalFilterInfo"></%block>
            
            ## display information about any data filtering on the lons/lats
            % if (constants.LAT_FILTER_FUNCTION_A_KEY in runInfo) and (not (runInfo[constants.LAT_FILTER_FUNCTION_A_KEY] is None)) :
                Note: The latitude in file A was filtered.<br>
                <% wasFiltered = True %>
            % endif
            % if (constants.LAT_FILTER_FUNCTION_B_KEY in runInfo) and (not (runInfo[constants.LAT_FILTER_FUNCTION_B_KEY] is None)) :
                Note: The latitude in file B was filtered.<br>
                <% wasFiltered = True %>
            % endif
            % if (constants.LON_FILTER_FUNCTION_A_KEY in runInfo) and (not (runInfo[constants.LON_FILTER_FUNCTION_A_KEY] is None)) :
                Note: The longitude in file A was filtered.<br>
                <% wasFiltered = True %>
            % endif
            % if (constants.LON_FILTER_FUNCTION_B_KEY in runInfo) and (not (runInfo[constants.LON_FILTER_FUNCTION_B_KEY] is None)) :
                Note: The longitude in file B was filtered.<br>
                <% wasFiltered = True %>
            % endif
            
            ## show an additional message if there was any filtering
            % if wasFiltered :
                Please see the original configuration file to view any data filtering functions.
            % endif
            </p>
            
        % endif
        
        </%block>
        
        <%block name="lonlatInfo">
        
        ## if the lon/lat variables exist, display info on them
        %if (constants.LATITUDE_NAME_KEY in runInfo) and (constants.LONGITUDE_NAME_KEY in runInfo) :
            
            ## display the latitude and longitude variable names
            <p>
                % if (constants.LAT_ALT_NAME_IN_B_KEY in runInfo) :
                    latitude in A: ${runInfo[constants.LATITUDE_NAME_KEY]}<br>
                    latitude in B: ${runInfo[constants.LAT_ALT_NAME_IN_B_KEY]}<br>
                    latitude: ${runInfo[constants.LATITUDE_NAME_KEY]} <br>
                % if (constants.LON_ALT_NAME_IN_B_KEY in runInfo) :
                    longitude in A: ${runInfo[constants.LONGITUDE_NAME_KEY]}<br>
                    longitude in B: ${runInfo[constants.LON_ALT_NAME_IN_B_KEY]}<br>
                    longitude: ${runInfo[constants.LONGITUDE_NAME_KEY]}<br>
                % if (constants.LON_LAT_EPSILON_KEY in runInfo) and (runInfo[constants.LON_LAT_EPSILON_KEY] >= 0.0) :
                    longitude/latitude comparison epsilon: ${runInfo[constants.LON_LAT_EPSILON_KEY]}<br>
                % endif
            </p>
            
            ## if there is a problem with the longitude/latitude correlation between the two files,
            ## make a nice big warning for the user
            % if spatial.has_key(constants.LONLAT_NOT_EQUAL_COUNT_KEY) and (spatial[constants.LONLAT_NOT_EQUAL_COUNT_KEY] > 0) :
                    WARNING: ${spatial[constants.LONLAT_NOT_EQUAL_COUNT_KEY]} data points
                    (${report.make_formatted_display_string(spatial[constants.LONLAT_NOT_EQ_PERCENT_KEY])}% of all data)
                    show possible mismatch in values stored in file a
                    and file b longitude and latitude values. Depending on the degree of mismatch, some data value comparisons
                    in this report may be distorted or spatially nonsensical. Please consider re-running this report and including an
                    examination of your longitude and latitude variables with appropriate epsilons in order to analyze the significance
                    of the difference.<br>
                    ## if we're showing images, link to graphs showing the problem
                    % if runInfo[constants.DO_MAKE_IMAGES_KEY] :
                        <%block name="lonlatInvalidImages">
                        <a href="./LonLatMismatch.A.png">
                            View mismatching points in A's lon/lat system
                        </a><br>
                        <a href="./LonLatMismatch.B.png">
                            View mismatching points in B's lon/lat system
                        </a>
                        </%block>
                    % endif
                </p>
            % endif
            
            <%block name="spatialInvalidity"></%block>
            
        ## end of the if to display lon/lat info
        % endif
        
        </%block>
        
        <%block name="comparedData"></%block>


        <%block name="attrsInfo">

            % if attributesInfo is not None and len(attributesInfo.keys()) > 0 :

                ## make a list of all the attributes we need to display
                <%
                    allAttrKeys = set()
                    for fileKey in attributesInfo.keys() :
                        for attrKey in attributesInfo[fileKey].keys() :
                            allAttrKeys.add(attrKey)
                %>

                <%block name="attrsTitle">
                <h3>Attributes</h3>
                </%block>

Alan De Smet's avatar
Alan De Smet committed
                <table>
                    <tr>
                        <th>Attribute Name</th>
                        ## loop to add headers for all files
                        % for fileKey in sorted(attributesInfo.keys()) :
                        % endfor
                    </tr>
                    ## loop to put a line in the table for each attribute
                    % for attrKey in sorted(allAttrKeys) :
                        <tr>
                            <td>${attrKey}</td>
                            ## loop to add values for each of the files
                            % for fileKey in sorted(attributesInfo.keys()) :
                                % if attrKey in attributesInfo[fileKey] :
                                    <td>${attributesInfo[fileKey][attrKey]}</td>
                                % else :
                                    <td></td>
                                % endif
                            % endfor

                        </tr>
                    % endfor

                </table>

            % endif

        </%block>