From a3964ad03ae9b3520c0d5a1e54063e3a3142f25b Mon Sep 17 00:00:00 2001
From: "(no author)" <(no author)@8a9318a1-56ba-4d59-b755-99d26321be01>
Date: Fri, 8 Oct 2010 22:23:33 +0000
Subject: [PATCH] adding more plotts to the bin/tuple analysis

git-svn-id: https://svn.ssec.wisc.edu/repos/glance/trunk@134 8a9318a1-56ba-4d59-b755-99d26321be01
---
 pyglance/glance/compare.py       | 10 +++++-----
 pyglance/glance/plotcreatefns.py | 11 +++++++++++
 2 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/pyglance/glance/compare.py b/pyglance/glance/compare.py
index 9f5d80f..8d80ade 100644
--- a/pyglance/glance/compare.py
+++ b/pyglance/glance/compare.py
@@ -1375,16 +1375,16 @@ def reportGen_library_call (a_path, b_path, var_list=[ ],
                 
                 plotFunctionGenerationObjects = [ ]
                 
+                # if the data is the same size, we can always make our basic statistical comparison plots
+                if (aData.shape == bData.shape) :
+                    plotFunctionGenerationObjects.append(plotcreate.BasicComparisonPlotsFunctionFactory())
+                
                 # if the bin and tuple are defined, try to analyze the data as complex
                 # multidimentional information requiring careful sampling
                 if ('binIndex' in varRunInfo) and ('tupleIndex' in varRunInfo) :
                     plotFunctionGenerationObjects.append(plotcreate.BinTupleAnalysisFunctionFactory())
                     
-                else :
-                    
-                    # if the data is the same size, we can always make our basic statistical comparison plots
-                    if (aData.shape == bData.shape) :
-                        plotFunctionGenerationObjects.append(plotcreate.BasicComparisonPlotsFunctionFactory())
+                else : # if it's not bin/tuple, there are lots of other posibilities
                     
                     # if it's vector data with longitude and latitude, quiver plot it on the Earth
                     if isVectorData and (not do_not_test_with_lon_lat) :
diff --git a/pyglance/glance/plotcreatefns.py b/pyglance/glance/plotcreatefns.py
index 013194f..9da0654 100644
--- a/pyglance/glance/plotcreatefns.py
+++ b/pyglance/glance/plotcreatefns.py
@@ -891,10 +891,21 @@ class BinTupleAnalysisFunctionFactory (PlottingFunctionFactory) :
                                                            variableDisplayName + " in both files" + "\n" + "for "
                                                            + binName + " # " + str(binNumber + 1) + " and case # "
                                                            + caseNumberText)
+                dataDiff = aData[binNumber][caseNumber] - bData[binNumber][caseNumber]
+                maskDiff = ~goodInAMask[binNumber][caseNumber] | ~goodInBMask[binNumber][caseNumber]
+                def make_diffplot(data=dataDiff, badMask=maskDiff, binNumber=binNumber, caseNumberText=caseNumText):
+                    return figures.create_line_plot_figure([(data, badMask, 'm', 'A - B', None)],
+                                                           "Value of " + variableDisplayName + " in File A - the value in File B\n" +
+                                                           "for " + binName + " # " + str(binNumber + 1) + " and case # " + caseNumberText)
+                    
                 functionsToReturn[str(binNumber + 1) + 'sample' + str(section + 1) + '.AB.png'] = (make_lineplot,
                                                                                            variableDisplayName + " sample in both files",
                                                                                            str(binNumber + 1) + 'sample' + str(section + 1) + '.AB.png',
                                                                                            new_list)
+                functionsToReturn[str(binNumber + 1) + 'sample' + str(section + 1) + 'ABdiff.png] '] = (make_diffplot,
+                                                                                           variableDisplayName + " difference between files",
+                                                                                           str(binNumber + 1) + 'sample' + str(section + 1) + '.ABdiff.png',
+                                                                                           new_list)
         
         return functionsToReturn
 
-- 
GitLab