Skip to content

Commit 0576bbe

Browse files
Merge pull request #1956 from UV-CDAT/fix_no_continents
Fix continents=0
2 parents 11fc132 + 6ad67a3 commit 0576bbe

File tree

3 files changed

+49
-2
lines changed

3 files changed

+49
-2
lines changed

Packages/vcs/vcs/VTKPlots.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -755,7 +755,10 @@ def onClosing(self, cell):
755755
plot.onClosing(cell)
756756

757757
def plotContinents(self, wc, projection, wrap, vp, priority, **kargs):
758-
contData = vcs2vtk.prepContinents(self.canvas._continentspath())
758+
continents_path = self.canvas._continentspath()
759+
if continents_path is None:
760+
return (None, 1, 1)
761+
contData = vcs2vtk.prepContinents(continents_path)
759762
contMapper = vtk.vtkPolyDataMapper()
760763
contMapper.SetInputData(contData)
761764
contActor = vtk.vtkActor()

testing/vcs/CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1016,13 +1016,19 @@ cdat_add_test(test_vcs_init_open_sizing
10161016
"${PYTHON_EXECUTABLE}"
10171017
${cdat_SOURCE_DIR}/testing/vcs/test_vcs_init_open_sizing.py
10181018
)
1019-
# Rename baseline
1019+
## Rename baseline
10201020
cdat_add_test(test_vcs_matplotlib_colormap
10211021
"${PYTHON_EXECUTABLE}"
10221022
${cdat_SOURCE_DIR}/testing/vcs/test_vcs_matplotlib_colormap.py
10231023
${BASELINE_DIR}/test_vcs_matplotlib_colormap.png
10241024
)
10251025

1026+
cdat_add_test(test_vcs_no_continents
1027+
"${PYTHON_EXECUTABLE}"
1028+
${cdat_SOURCE_DIR}/testing/vcs/test_vcs_no_continents.py
1029+
${BASELINE_DIR}/test_vcs_no_continents.png
1030+
)
1031+
10261032

10271033
add_subdirectory(vtk_ui)
10281034
add_subdirectory(editors)
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import cdms2
2+
import os
3+
import sys
4+
import vcs
5+
6+
# Load the clt data:
7+
dataFile = cdms2.open(os.path.join(vcs.sample_data, "clt.nc"))
8+
clt = dataFile("clt")
9+
clt = clt(latitude=(-90.0, 90.0), longitude=(-180., 175.), squeeze=1,
10+
time=('1979-1-1 0:0:0.0', '1988-12-1 0:0:0.0'))
11+
12+
# Initialize canvas:
13+
canvas = vcs.init()
14+
canvas.setantialiasing(0)
15+
canvas.setbgoutputdimensions(1200,1091,units="pixels")
16+
canvas.drawlogooff()
17+
18+
t1 = vcs.createtemplate()
19+
t1.scale(.5, "y")
20+
t1.move(-.15, "y")
21+
t2 = vcs.createtemplate(source=t1.name)
22+
t2.move(.5, 'y')
23+
24+
canvas.plot(clt, t1, continents=0, bg=True)
25+
canvas.plot(clt, t2, continents=1, bg=True)
26+
27+
# Load the image testing module:
28+
testingDir = os.path.join(os.path.dirname(__file__), "..")
29+
sys.path.append(testingDir)
30+
import checkimage
31+
32+
# Create the test image and compare:
33+
baseline = sys.argv[1]
34+
testFile = "test_vcs_no_continents.png"
35+
canvas.png(testFile)
36+
ret = checkimage.check_result_image(testFile, baseline,
37+
checkimage.defaultThreshold)
38+
sys.exit(ret)

0 commit comments

Comments
 (0)