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
5 changes: 4 additions & 1 deletion Packages/vcs/vcs/VTKPlots.py
Original file line number Diff line number Diff line change
Expand Up @@ -755,7 +755,10 @@ def onClosing(self, cell):
plot.onClosing(cell)

def plotContinents(self, wc, projection, wrap, vp, priority, **kargs):
contData = vcs2vtk.prepContinents(self.canvas._continentspath())
continents_path = self.canvas._continentspath()
if continents_path is None:
return (None, 1, 1)
contData = vcs2vtk.prepContinents(continents_path)
contMapper = vtk.vtkPolyDataMapper()
contMapper.SetInputData(contData)
contActor = vtk.vtkActor()
Expand Down
8 changes: 7 additions & 1 deletion testing/vcs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1016,13 +1016,19 @@ cdat_add_test(test_vcs_init_open_sizing
"${PYTHON_EXECUTABLE}"
${cdat_SOURCE_DIR}/testing/vcs/test_vcs_init_open_sizing.py
)
# Rename baseline
## Rename baseline
cdat_add_test(test_vcs_matplotlib_colormap
"${PYTHON_EXECUTABLE}"
${cdat_SOURCE_DIR}/testing/vcs/test_vcs_matplotlib_colormap.py
${BASELINE_DIR}/test_vcs_matplotlib_colormap.png
)

cdat_add_test(test_vcs_no_continents
"${PYTHON_EXECUTABLE}"
${cdat_SOURCE_DIR}/testing/vcs/test_vcs_no_continents.py
${BASELINE_DIR}/test_vcs_no_continents.png
)


add_subdirectory(vtk_ui)
add_subdirectory(editors)
Expand Down
38 changes: 38 additions & 0 deletions testing/vcs/test_vcs_no_continents.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import cdms2
import os
import sys
import vcs

# Load the clt data:
dataFile = cdms2.open(os.path.join(vcs.sample_data, "clt.nc"))
clt = dataFile("clt")
clt = clt(latitude=(-90.0, 90.0), longitude=(-180., 175.), squeeze=1,
time=('1979-1-1 0:0:0.0', '1988-12-1 0:0:0.0'))

# Initialize canvas:
canvas = vcs.init()
canvas.setantialiasing(0)
canvas.setbgoutputdimensions(1200,1091,units="pixels")
canvas.drawlogooff()

t1 = vcs.createtemplate()
t1.scale(.5, "y")
t1.move(-.15, "y")
t2 = vcs.createtemplate(source=t1.name)
t2.move(.5, 'y')

canvas.plot(clt, t1, continents=0, bg=True)
canvas.plot(clt, t2, continents=1, bg=True)

# Load the image testing module:
testingDir = os.path.join(os.path.dirname(__file__), "..")
sys.path.append(testingDir)
import checkimage

# Create the test image and compare:
baseline = sys.argv[1]
testFile = "test_vcs_no_continents.png"
canvas.png(testFile)
ret = checkimage.check_result_image(testFile, baseline,
checkimage.defaultThreshold)
sys.exit(ret)