From 487330096375ce34ce9ec4f96f71f7e85d29c762 Mon Sep 17 00:00:00 2001 From: Dan Lipsa Date: Mon, 15 Feb 2016 17:26:54 -0500 Subject: [PATCH] Add test for BUG # 1728: wrapping data creates long cells. --- testing/vcs/CMakeLists.txt | 5 ++++ testing/vcs/vcs_test_boxfill_robinson_wrap.py | 25 +++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 testing/vcs/vcs_test_boxfill_robinson_wrap.py diff --git a/testing/vcs/CMakeLists.txt b/testing/vcs/CMakeLists.txt index 38a357427d..a73aefe8d7 100644 --- a/testing/vcs/CMakeLists.txt +++ b/testing/vcs/CMakeLists.txt @@ -317,6 +317,11 @@ cdat_add_test(vcs_test_meshfill_no_wrapping "${BASELINE_DIR}/vcs_test_meshfill_no_wrapping.png" "${UVCDAT_GIT_TESTDATA_DIR}/data/heat.nc" ) +cdat_add_test(vcs_test_boxfill_robinson_wrap + "${PYTHON_EXECUTABLE}" + ${cdat_SOURCE_DIR}/testing/vcs/vcs_test_boxfill_robinson_wrap.py + "${BASELINE_DIR}/vcs_test_boxfill_robinson_wrap.png" + ) cdat_add_test(vcs_test_boxfill_10x10_numpy "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcs/test_boxfill_10x10_numpy.py diff --git a/testing/vcs/vcs_test_boxfill_robinson_wrap.py b/testing/vcs/vcs_test_boxfill_robinson_wrap.py new file mode 100644 index 0000000000..8292287ce2 --- /dev/null +++ b/testing/vcs/vcs_test_boxfill_robinson_wrap.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python +import cdms2, cdutil, genutil +import vcs,os +import sys + +# This tests if extening the longitude to more than 360 decrees is handled correctly by +# proj4. See https://github.com/UV-CDAT/uvcdat/issues/1728 for more information. +pth = os.path.join(os.path.dirname(__file__), "..") +sys.path.append(pth) +import checkimage + + +cdmsfile = cdms2.open(os.path.join(vcs.sample_data, "clt.nc")) +clt2 = cdmsfile('clt') +clt3 = clt2(latitude=(-90.0, 90.0),squeeze=1,longitude=(-180, 200.0),time=('1979-01', '1988-12'),) +canvas = vcs.init() +gmBoxfill = vcs.getboxfill('a_robinson_boxfill') +kwargs = {} +kwargs[ 'cdmsfile' ] = cdmsfile.id +kwargs['bg'] = 1 +canvas.plot(clt3, gmBoxfill, **kwargs) +fnm = "test_robinson_wrap.png" +canvas.png(fnm) +ret = checkimage.check_result_image(fnm, sys.argv[1], checkimage.defaultThreshold) +sys.exit(ret)