Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions Packages/vcs/Lib/VTKPlots.py
Original file line number Diff line number Diff line change
Expand Up @@ -825,7 +825,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]:
Expand Down Expand Up @@ -858,8 +858,9 @@ 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):
cot.SetValue(j,v)
cot.SetValue(j,v)
#cot.SetScalarModeToIndex()
cot.Update()
mapper.SetInputConnection(cot.GetOutputPort())
Expand Down Expand Up @@ -1027,12 +1028,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)
Expand Down
8 changes: 8 additions & 0 deletions testing/vcs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -390,5 +390,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()

15 changes: 14 additions & 1 deletion testing/vcs/test_vcs_basic_gms.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are you sure about this @dlonie don't we use this option for some tests?

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")
Expand All @@ -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")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no worries I see it here.

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
Expand Down Expand Up @@ -87,19 +90,27 @@
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)
if args.zero:
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"]:
Expand All @@ -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:
Expand Down