From 97b8b5de0dbb814e2443e9af19b364472a81e54f Mon Sep 17 00:00:00 2001 From: Charles Doutriaux Date: Fri, 31 Oct 2014 16:33:34 -0700 Subject: [PATCH 1/5] some bug fix to run Jeff test bug --- Packages/vcs/Lib/VTKPlots.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Packages/vcs/Lib/VTKPlots.py b/Packages/vcs/Lib/VTKPlots.py index 6dabcec49c..60f000b62b 100644 --- a/Packages/vcs/Lib/VTKPlots.py +++ b/Packages/vcs/Lib/VTKPlots.py @@ -826,7 +826,7 @@ def plot2D(self,data1,data2,tmpl,gm): ## ok it's an extension arrow L=[mn-1.,levs[0][1]] else: - L = levs[i] + L = list(levs[i]) I = [indices[i],] else: if l[0] == L[-1] and I[-1]==indices[i]: @@ -860,13 +860,15 @@ def plot2D(self,data1,data2,tmpl,gm): cot.SetInputData(sFilter.GetOutput()) cot.SetNumberOfContours(len(l)) for j,v in enumerate(l): - cot.SetValue(j,v) + print "Contour:",j,":",v + cot.SetValue(j,v) #cot.SetScalarModeToIndex() cot.Update() mapper.SetInputConnection(cot.GetOutputPort()) lut.SetNumberOfTableValues(len(COLS[i])) for j,color in enumerate(COLS[i]): r,g,b = cmap.index[color] + print "lut:",j,color,r/100.,g/100.,b/100.,r*2.55,g*2.55,b*2.55 lut.SetTableValue(j,r/100.,g/100.,b/100.) #print l[j],vcs.colors.rgb2str(r*2.55,g*2.55,b*2.55),l[j+1] mapper.SetLookupTable(lut) @@ -1014,12 +1016,12 @@ def plot2D(self,data1,data2,tmpl,gm): if gm.ext_1 in ["y",1,True] and not numpy.allclose(levs[0],-1.e20): if isinstance(levs,numpy.ndarray): levs=levs.tolist() - if not (isinstance(levs[0],list) and numpy.allclose(levs[0][0],-1.e20)): + if not (isinstance(levs[0],list) and numpy.less_equal(levs[0][0],-1.e20)): levs.insert(0,-1.e20) if gm.ext_2 in ["y",1,True] and not numpy.allclose(levs[-1],1.e20): if isinstance(levs,numpy.ndarray): levs=levs.tolist() - if not (isinstance(levs[-1],list) and numpy.allclose(levs[-1][-1],1.e20)): + if not (isinstance(levs[-1],list) and numpy.greater_equal(levs[-1][-1],1.e20)): levs.append(1.e20) self.renderColorBar(tmpl,levs,cols,legend,cmap) From c257afb57d8b9accbe31486b5538bd0543442c0f Mon Sep 17 00:00:00 2001 From: "David C. Lonie" Date: Fri, 7 Nov 2014 08:55:59 -0500 Subject: [PATCH 2/5] Disable level compression in banded contour filter. Ref #851. --- Packages/vcs/Lib/VTKPlots.py | 1 + 1 file changed, 1 insertion(+) diff --git a/Packages/vcs/Lib/VTKPlots.py b/Packages/vcs/Lib/VTKPlots.py index 60f000b62b..968cc2edf0 100644 --- a/Packages/vcs/Lib/VTKPlots.py +++ b/Packages/vcs/Lib/VTKPlots.py @@ -859,6 +859,7 @@ def plot2D(self,data1,data2,tmpl,gm): cot.ClippingOn() cot.SetInputData(sFilter.GetOutput()) cot.SetNumberOfContours(len(l)) + cot.SetClipTolerance(0.) for j,v in enumerate(l): print "Contour:",j,":",v cot.SetValue(j,v) From ed2a08c6d51d53a1a70fc676cbcb0fbb9c478be1 Mon Sep 17 00:00:00 2001 From: "David C. Lonie" Date: Mon, 10 Nov 2014 12:07:31 -0500 Subject: [PATCH 3/5] Add regression test. --- testing/vcs/CMakeLists.txt | 8 ++++++++ testing/vcs/test_vcs_basic_gms.py | 15 ++++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/testing/vcs/CMakeLists.txt b/testing/vcs/CMakeLists.txt index 728f04c349..05c3550374 100644 --- a/testing/vcs/CMakeLists.txt +++ b/testing/vcs/CMakeLists.txt @@ -382,5 +382,13 @@ add_test(vcs_test_taylor_2_quads ${cdat_SOURCE_DIR}/testing/vcs/test_vcs_close.py "${BASELINE_DIR}/test_vcs_close.png" ) + + add_test(vcs_test_basic_isofill_bigvalues + "${PYTHON_EXECUTABLE}" + "${cdat_SOURCE_DIR}/testing/vcs/test_vcs_basic_gms.py" + --gm_type=isofill + --bigvalues + "--source=${BASELINE_DIR}/test_vcs_basic_isofill_bigvalues.png" + ) endif() diff --git a/testing/vcs/test_vcs_basic_gms.py b/testing/vcs/test_vcs_basic_gms.py index 1fc8c5932d..39130883dc 100644 --- a/testing/vcs/test_vcs_basic_gms.py +++ b/testing/vcs/test_vcs_basic_gms.py @@ -4,7 +4,6 @@ p = argparse.ArgumentParser(description="Basic gm testing code for vcs") p.add_argument("--source", dest="src", help="source image file") p.add_argument("--gm_type", dest="gm", help="gm to test") -p.add_argument("--mask", dest="mask", action="store_true",help="mask out part of data") p.add_argument("--show", dest="show", action="store_true",help="show plots on screen (no bg)") p.add_argument("--projection-type", dest="projtype", default="default", help="use a specific projection type") p.add_argument("--lat1", dest="lat1", default=0, type=float, help="First latitude") @@ -16,6 +15,10 @@ p.add_argument("--zero", dest="zero", action="store_true", help="Set the data to zero everywhere") p.add_argument("--keep", dest="keep", action="store_true",help="Save image, even if baseline matches.") +dataMods = p.add_mutually_exclusive_group() +dataMods.add_argument("--mask", dest="mask", action="store_true",help="mask out part of data") +dataMods.add_argument("--bigvalues", dest="bigvalues", action="store_true",help="replace some of the data with 1e40") + args = p.parse_args(sys.argv[1:]) gm_type= args.gm @@ -87,12 +90,16 @@ gm.mesh=True if args.mask: s=MV2.masked_less(s,1150.) + elif args.bigvalues: + s[s < 1150] = 1e40 if args.zero: s-=s else: s=f("clt",**xtra) if args.mask: s=MV2.masked_greater(s,78.) + elif args.bigvalues: + s[s > 78] = 1e40 if gm_type in ["1d","yxvsx","xyvsy","xvsy","scatter"]: s = s(latitude=(20,20,"cob"),longitude=(112,112,"cob"),squeeze=1) s2=MV2.sin(s) @@ -100,6 +107,10 @@ s2-=s2 if args.zero: s-=s + +if args.bigvalues: + gm.levels = [0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 1.e36] + if gm_type=="vector": x.plot(u,v,gm,bg=bg) elif gm_type in ["scatter","xvsy"]: @@ -109,6 +120,8 @@ fnm = "test_vcs_basic_%s" % gm_type.lower() if args.mask: fnm+="_masked" +elif args.bigvalues: + fnm+="_bigvalues" if args.projtype!="default": fnm+="_%s_proj" % args.projtype if args.zero: From ddf280418bd0880d5bee60370c9c12f28f52c7b4 Mon Sep 17 00:00:00 2001 From: Charles Doutriaux Date: Mon, 10 Nov 2014 09:41:46 -0800 Subject: [PATCH 4/5] Update VTKPlots.py removing print statement --- Packages/vcs/Lib/VTKPlots.py | 1 - 1 file changed, 1 deletion(-) diff --git a/Packages/vcs/Lib/VTKPlots.py b/Packages/vcs/Lib/VTKPlots.py index 968cc2edf0..9714c88aff 100644 --- a/Packages/vcs/Lib/VTKPlots.py +++ b/Packages/vcs/Lib/VTKPlots.py @@ -861,7 +861,6 @@ def plot2D(self,data1,data2,tmpl,gm): cot.SetNumberOfContours(len(l)) cot.SetClipTolerance(0.) for j,v in enumerate(l): - print "Contour:",j,":",v cot.SetValue(j,v) #cot.SetScalarModeToIndex() cot.Update() From 15017b8731785df4c52e5a19e60b7c08ea5fa88d Mon Sep 17 00:00:00 2001 From: Charles Doutriaux Date: Mon, 10 Nov 2014 09:42:34 -0800 Subject: [PATCH 5/5] Update VTKPlots.py another print statement removed --- Packages/vcs/Lib/VTKPlots.py | 1 - 1 file changed, 1 deletion(-) diff --git a/Packages/vcs/Lib/VTKPlots.py b/Packages/vcs/Lib/VTKPlots.py index 9714c88aff..2a0281c1d7 100644 --- a/Packages/vcs/Lib/VTKPlots.py +++ b/Packages/vcs/Lib/VTKPlots.py @@ -868,7 +868,6 @@ def plot2D(self,data1,data2,tmpl,gm): lut.SetNumberOfTableValues(len(COLS[i])) for j,color in enumerate(COLS[i]): r,g,b = cmap.index[color] - print "lut:",j,color,r/100.,g/100.,b/100.,r*2.55,g*2.55,b*2.55 lut.SetTableValue(j,r/100.,g/100.,b/100.) #print l[j],vcs.colors.rgb2str(r*2.55,g*2.55,b*2.55),l[j+1] mapper.SetLookupTable(lut)