Commit e69db0db authored by Eva Schiffer's avatar Eva Schiffer
Browse files

stop stats from crashing when loading str variables

parent 98ff730b
......@@ -1384,6 +1384,13 @@ def stats_two_inputs_library_call(afn, bfn, var_list=None,
if do_pass_fail and warn_missing :
has_failed = True
continue
except Exception as ex:
tmpMsg = explain_name + " data could not be loaded. This variable will not be analyzed. " + \
"The following error was encountered while trying to load this variable:\n" + str(ex)
LOG.warning(tmpMsg)
if do_pass_fail and warn_missing:
has_failed = True
continue
# figure out what fill values we're using to detect missing data
amiss = requestedNames[display_name][FILL_VALUE_KEY] if FILL_VALUE_KEY in requestedNames[display_name] \
......@@ -1546,12 +1553,18 @@ def stats_one_input_library_call (afn, var_list=None, options_set=None, do_docum
continue
# load the variable data, filtering as needed
aData = load_variable_data(aFile, tech_name,
dataFilter=requestedNames[display_name][FILTER_FUNCTION_A_KEY] if FILTER_FUNCTION_A_KEY in requestedNames[display_name] else None,
variableToFilterOn=requestedNames[display_name][VAR_FILTER_NAME_A_KEY] if VAR_FILTER_NAME_A_KEY in requestedNames[display_name] else None,
variableBasedFilter=requestedNames[display_name][VAR_FILTER_FUNCTION_A_KEY] if VAR_FILTER_FUNCTION_A_KEY in requestedNames[display_name] else None,
altVariableFileObject=dataobj.FileInfo(requestedNames[display_name][VAR_FILTER_ALT_FILE_A_KEY]).file_object if VAR_FILTER_ALT_FILE_A_KEY in requestedNames[display_name] else None,
fileDescriptionForDisplay="file A")
try :
aData = load_variable_data(aFile, tech_name,
dataFilter=requestedNames[display_name][FILTER_FUNCTION_A_KEY] if FILTER_FUNCTION_A_KEY in requestedNames[display_name] else None,
variableToFilterOn=requestedNames[display_name][VAR_FILTER_NAME_A_KEY] if VAR_FILTER_NAME_A_KEY in requestedNames[display_name] else None,
variableBasedFilter=requestedNames[display_name][VAR_FILTER_FUNCTION_A_KEY] if VAR_FILTER_FUNCTION_A_KEY in requestedNames[display_name] else None,
altVariableFileObject=dataobj.FileInfo(requestedNames[display_name][VAR_FILTER_ALT_FILE_A_KEY]).file_object if VAR_FILTER_ALT_FILE_A_KEY in requestedNames[display_name] else None,
fileDescriptionForDisplay="file A")
except Exception as ex:
tmpMsg = explain_name + " data could not be loaded. This variable will not be analyzed. " + \
"The following error was encountered while trying to load this variable:\n" + str(ex)
LOG.warning(tmpMsg)
continue
amiss = requestedNames[display_name][FILL_VALUE_KEY] if FILL_VALUE_KEY in requestedNames[display_name] else default_missing_val
# if we still don't have a fill value, try to get it from the file
......
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