Commit 3c01b1df authored by Eva Schiffer's avatar Eva Schiffer
Browse files

showing the value of single value variables in reports

parent 7f4765c8
......@@ -721,9 +721,12 @@ def report_one_input_library_call (a_path, var_list=None,
if runInfo[DO_MAKE_REPORT_KEY] :
# hang on to some info on our variable
tempShape = variable_stats["General Statistics"]["shape"]
tempValue = None if SINGLE_VAL_MSG not in tempShape else variable_stats["General Statistics"]["max"] # since it's the only value, it's also the max!
variableInspections[displayName] = {
VARIABLE_RUN_INFO_KEY: varRunInfo,
VAR_SHAPE_KEY: variable_stats["General Statistics"]["shape"],
VARIABLE_RUN_INFO_KEY: varRunInfo,
VAR_SHAPE_KEY: tempShape,
VAR_SINGLE_VAL_KEY: tempValue,
}
LOG.info ('\tgenerating report for: ' + explanationName)
......@@ -1093,14 +1096,16 @@ def report_two_inputs_library_call (a_path, b_path, var_list=None,
# hang on to our good % and other info to describe our comparison
tempVarStats = variable_stats.dictionary_form()
epsilonPassedPercent = (1.0 - epsilon_failed_fraction) * 100.0
finitePassedPercent = (1.0 - non_finite_fail_fraction) * 100.0
finitePassedPercent = (1.0 - non_finite_fail_fraction) * 100.0
tempShape = tempVarStats["General Statistics"]["shape"]
tempValue = None if SINGLE_VAL_MSG not in tempShape else tempVarStats["General Statistics"]["max_a"] # since it's the only value, it's also the max!
variableComparisons[displayName] = {
PASSED_EPSILON_PERCENT_KEY: epsilonPassedPercent,
FINITE_SIMILAR_PERCENT_KEY: finitePassedPercent,
R_SQUARED_COEFF_VALUE_KEY: r_squared_value,
VARIABLE_RUN_INFO_KEY: varRunInfo,
VAR_SHAPE_KEY: tempVarStats["General Statistics"]
["shape"],
VAR_SHAPE_KEY: tempShape,
VAR_SINGLE_VAL_KEY: tempValue,
}
variableStatsCollection[displayName] = tempVarStats
......
......@@ -196,7 +196,9 @@ VARIABLE_RUN_INFO_KEY = 'variable_run_info'
PASSED_EPSILON_PERCENT_KEY = 'pass_epsilon_percent'
FINITE_SIMILAR_PERCENT_KEY = 'finite_similar_percent'
R_SQUARED_COEFF_VALUE_KEY = 'r_squared_correlation'
VAR_SHAPE_KEY = 'variable_data_shape'
VAR_SINGLE_VAL_KEY = 'single_value'
# image types
......@@ -242,7 +244,14 @@ VARIABLE_RUN_INFO_DICT_KEY = 'variables'
ATTRS_INFO_DICT_KEY = 'attributesInfo'
ALL_REPORTS_DICT_KEY = 'allReports'
DEFINITIONS_INFO_KEY = 'definitions'
DEFINITIONS_INFO_KEY = 'definitions'
# end of constants for keying the functions in the plot function list
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# message constants
SINGLE_VAL_MSG = "a single scalar value"
if __name__=='__main__':
pass
......@@ -31,7 +31,6 @@ Copyright (c) 2011 University of Wisconsin SSEC. All rights reserved.
## report on all the variables that were analyzed
<blockquote>
<p>
## TODO replace the table with floating boxes at some point
<table>
<tr>
<th>Variable Name</th>
......@@ -48,7 +47,8 @@ Copyright (c) 2011 University of Wisconsin SSEC. All rights reserved.
if constants.DISPLAY_NAME_KEY in tempVarRunInfo :
varDisplayName = tempVarRunInfo[constants.DISPLAY_NAME_KEY]
varDataShape = str(tempVariableInfo[constants.VAR_SHAPE_KEY])
varDataShape = str(tempVariableInfo[constants.VAR_SHAPE_KEY])
tempSingleVal = tempVariableInfo[constants.VAR_SINGLE_VAL_KEY]
%>
<tr>
<td>
......@@ -56,8 +56,12 @@ Copyright (c) 2011 University of Wisconsin SSEC. All rights reserved.
</td>
<td>
% if varDataShape is not None and len(varDataShape) > 0 :
${varDataShape}
%else :
% if tempSingleVal is not None :
${varDataShape} = ${report.make_formatted_display_string(tempSingleVal, '%.6g')}
% else :
${varDataShape}
% endif
% else :
--
% endif
</td>
......
......@@ -77,6 +77,7 @@ Copyright (c) 2011 University of Wisconsin SSEC. All rights reserved.
allNone = None
numEpsilon = 0
numEpPercent = 0
numSingleVal = 0
for varKey in variables :
tmpDidPass = variables[varKey][constants.VARIABLE_RUN_INFO_KEY][constants.DID_VARIABLE_PASS_KEY]
numPass += 1 if tmpDidPass is not None and tmpDidPass else 0
......@@ -86,8 +87,10 @@ Copyright (c) 2011 University of Wisconsin SSEC. All rights reserved.
tempEpsilon = variables[varKey][constants.VARIABLE_RUN_INFO_KEY][constants.EPSILON_KEY]
tempEpsilonPer = variables[varKey][constants.VARIABLE_RUN_INFO_KEY][constants.EPSILON_PERCENT_KEY]
tempSingleVal = variables[varKey][constants.VAR_SINGLE_VAL_KEY]
numEpsilon += 1 if tempEpsilon is not None else 0
numEpPercent += 1 if tempEpsilonPer is not None else 0
numSingleVal += 1 if tempSingleVal is not None else 0
%>
## only show the summary info if we did any comparisons at all
% if allNone is not None :
......@@ -149,13 +152,18 @@ Copyright (c) 2011 University of Wisconsin SSEC. All rights reserved.
finiteSimilarPercent = tempVariableInfo[constants.FINITE_SIMILAR_PERCENT_KEY]
didPass = tempVarRunInfo [constants.DID_VARIABLE_PASS_KEY]
varDataShape = str(tempVariableInfo[constants.VAR_SHAPE_KEY])
tempSingleVal = tempVariableInfo[constants.VAR_SINGLE_VAL_KEY]
%>
<tr>
<td><a href="${tempVarRunInfo[constants.VAR_REPORT_PATH_KEY]}">${varDisplayName}</a></td>
<td>
% if varDataShape is not None and len(varDataShape) > 0 :
${varDataShape}
%else :
% if tempSingleVal is not None :
${varDataShape} = ${report.make_formatted_display_string(tempSingleVal, '%.6g')}
% else :
${varDataShape}
% endif
% else :
--
% endif
</td>
......@@ -163,7 +171,7 @@ Copyright (c) 2011 University of Wisconsin SSEC. All rights reserved.
<td class="n">
% if tempVarRunInfo[constants.EPSILON_KEY] is not None :
${tempVarRunInfo[constants.EPSILON_KEY]}
%else :
% else :
--
% endif
</td>
......
......@@ -10,6 +10,7 @@ Copyright (c) 2010 University of Wisconsin SSEC. All rights reserved.
import glance.data as dataobj
import glance.delta as delta
from glance.constants import SINGLE_VAL_MSG
import numpy as np
......@@ -650,7 +651,7 @@ class GeneralStatistics (StatisticalData) :
# if we should also do extra stats, do so
if doExtras :
self.num_data_points = dataObject.masks.missing_mask.size if not noData else 0
self.shape = dataObject.masks.missing_mask.shape if not dataObject.is_scalar else "a single scalar value"
self.shape = dataObject.masks.missing_mask.shape if not dataObject.is_scalar else SINGLE_VAL_MSG
# if we have a comparison object analyze the data associated with that comparison
elif diffInfoObject is not None :
......@@ -669,11 +670,11 @@ class GeneralStatistics (StatisticalData) :
# if we have at least one scalar, we need to build the shape info differently
if diffInfoObject.a_data_object.is_scalar or diffInfoObject.b_data_object.is_scalar :
if diffInfoObject.a_data_object.is_scalar and diffInfoObject.b_data_object.is_scalar :
self.shape = "a single scalar value"
self.shape = SINGLE_VAL_MSG
elif diffInfoObject.a_data_object.is_scalar :
self.shape = "a single scalar value in A and " + str(diffInfoObject.b_data_object.masks.missing_mask.shape) + " in B"
self.shape = SINGLE_VAL_MSG + " in A and " + str(diffInfoObject.b_data_object.masks.missing_mask.shape) + " in B"
elif diffInfoObject.b_data_object.is_scalar :
self.shape = str(diffInfoObject.a_data_object.masks.missing_mask.shape) + " in A and a single scalar value in B"
self.shape = str(diffInfoObject.a_data_object.masks.missing_mask.shape) + " in A and " + SINGLE_VAL_MSG + " in B"
# also calculate the invalid points
self.spatially_invalid_pts_ignored_in_a = np.sum(diffInfoObject.a_data_object.masks.ignore_mask)
self.spatially_invalid_pts_ignored_in_b = np.sum(diffInfoObject.b_data_object.masks.ignore_mask)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment