diff --git a/CMake/cdat_modules/cdat_external.cmake b/CMake/cdat_modules/cdat_external.cmake index 0b3facc102..4a74637a85 100644 --- a/CMake/cdat_modules/cdat_external.cmake +++ b/CMake/cdat_modules/cdat_external.cmake @@ -16,7 +16,7 @@ if (CDAT_BUILD_VCS_LEGACY) set(qt_flags "--enable-qt-framework") endif() - set(cdat_xtra_flags "--enable-vcs-legacy ${qt_flags} --with-qt=${QT_ROOT} --with-qt-lib=${QT_LIB_DIR} --with-qt-inc=${QT_INC_DIR}" --with-qt-bin=${QT_BINARY_DIR}) + set(cdat_xtra_flags "--enable-vcs-legacy ${qt_flags} --with-qt=${QT_ROOT} --with-qt-lib=${QT_LIB_DIR} --with-qt-inc=${QT_INC_DIR} --with-qt-bin=${QT_BINARY_DIR}") endif() if (CDAT_BUILD_WITH_LIBDRS) @@ -25,6 +25,7 @@ endif() set(cdat_build_dir ${CMAKE_CURRENT_BINARY_DIR}/cdat-build) +set(WORKING_DIR "${cdat_CMAKE_BINARY_DIR}") configure_file(${cdat_CMAKE_SOURCE_DIR}/cdat_modules_extra/cdat_python_install_step.cmake.in ${cdat_CMAKE_BINARY_DIR}/cdat_python_install_step.cmake @ONLY) @@ -37,7 +38,7 @@ ExternalProject_Add(CDAT PATCH_COMMAND "" CONFIGURE_COMMAND "" BUILD_COMMAND "" - INSTALL_COMMAND ${CMAKE_COMMAND} -DPYTHON_INSTALL_ARGS=${cdat_xtra_flags} -P ${cdat_CMAKE_BINARY_DIR}/cdat_python_install_step.cmake + INSTALL_COMMAND env "PYTHONPATH=$ENV{PYTHONPATH}" ${CMAKE_COMMAND} -DPYTHON_INSTALL_ARGS=${cdat_xtra_flags} -P ${cdat_CMAKE_BINARY_DIR}/cdat_python_install_step.cmake DEPENDS ${CDAT_deps} ) diff --git a/CMake/cdat_modules/pixman_external.cmake b/CMake/cdat_modules/pixman_external.cmake index 2b3ea894b3..bd043c7a00 100644 --- a/CMake/cdat_modules/pixman_external.cmake +++ b/CMake/cdat_modules/pixman_external.cmake @@ -1,7 +1,7 @@ set(pixman_source "${CMAKE_CURRENT_BINARY_DIR}/build/pixman") set(pixman_install "${cdat_EXTERNALS}") -#set(pixman_configure_args "--disable-gtk") +set(pixman_configure_args "--disable-gtk") ExternalProject_Add(pixman LIST_SEPARATOR ^^ @@ -12,7 +12,7 @@ ExternalProject_Add(pixman URL_MD5 ${PIX_MD5} BUILD_IN_SOURCE 1 PATCH_COMMAND "" - CONFIGURE_COMMAND ${CMAKE_COMMAND} -DINSTALL_DIR=${pixman_install} -DWORKING_DIR=${pixman_source} -P ${cdat_CMAKE_BINARY_DIR}/cdat_configure_step.cmake + CONFIGURE_COMMAND ${CMAKE_COMMAND} -DCONFIGURE_ARGS=${pixman_configure_args} -DINSTALL_DIR=${pixman_install} -DWORKING_DIR=${pixman_source} -P ${cdat_CMAKE_BINARY_DIR}/cdat_configure_step.cmake DEPENDS ${pixman_deps} ${ep_log_options} ) diff --git a/CMake/cdat_modules/pyqt_external.cmake b/CMake/cdat_modules/pyqt_external.cmake index b84ef95619..34f9569a2c 100644 --- a/CMake/cdat_modules/pyqt_external.cmake +++ b/CMake/cdat_modules/pyqt_external.cmake @@ -2,7 +2,22 @@ # set(PyQt_source "${CMAKE_CURRENT_BINARY_DIR}/build/PyQt") message("[INFO] Using environment PYTHONPATH \"$ENV{PYTHONPATH}\"") -set(PyQt_configure_command env PYTHONPATH=$ENV{PYTHONPATH} ${PYTHON_EXECUTABLE} configure.py -q ${QT_QMAKE_EXECUTABLE} --confirm-license -b ${CMAKE_INSTALL_PREFIX}/bin -d ${PYTHON_SITE_PACKAGES} -v ${CMAKE_INSTALL_PREFIX}/include -v ${CMAKE_INSTALL_PREFIX}/share -p ${CMAKE_INSTALL_PREFIX}/share/plugins -n ${CMAKE_INSTALL_PREFIX}/share/qsci --assume-shared -e QtGui -e QtHelp -e QtMultimedia -e QtNetwork -e QtDeclarative -e QtOpenGL -e QtScript -e QtScriptTools -e QtSql -e QtSvg -e QtTest -e QtWebKit -e QtXml -e QtXmlPatterns -e QtCore) +set(PyQt_configure_command + env PYTHONPATH=${PYTHONPATH} + "${PYTHON_EXECUTABLE}" configure.py + -q "${QT_QMAKE_EXECUTABLE}" + --confirm-license + -b "${CMAKE_INSTALL_PREFIX}/bin" + -d "${PYTHON_SITE_PACKAGES}" + -v "${CMAKE_INSTALL_PREFIX}/include" + -v "${CMAKE_INSTALL_PREFIX}/share" + -p "${CMAKE_INSTALL_PREFIX}/share/plugins" + -n "${CMAKE_INSTALL_PREFIX}/share/qsci" + --assume-shared + -e QtGui -e QtHelp -e QtMultimedia -e QtNetwork -e QtDeclarative -e QtOpenGL + -e QtScript -e QtScriptTools -e QtSql -e QtSvg -e QtTest -e QtWebKit + -e QtXml -e QtXmlPatterns -e QtCore +) ExternalProject_Add(PyQt DOWNLOAD_DIR ${CDAT_PACKAGE_CACHE_DIR} diff --git a/CMake/cdat_modules/pyqt_pkg.cmake b/CMake/cdat_modules/pyqt_pkg.cmake index 13a36e7fbf..a049bc7281 100644 --- a/CMake/cdat_modules/pyqt_pkg.cmake +++ b/CMake/cdat_modules/pyqt_pkg.cmake @@ -2,14 +2,14 @@ set(PYQT_MAJOR 4) set(PYQT_MINOR 8) set(PYQT_PATCH 3) set(PYQT_MAJOR_SRC 4) -set(PYQT_MINOR_SRC 10) -set(PYQT_PATCH_SRC 1) +set(PYQT_MINOR_SRC 11) +set(PYQT_PATCH_SRC 3) set(PYQT_VERSION ${PYQT_MAJOR_SRC}.${PYQT_MINOR_SRC}.${PYQT_PATCH_SRC}) set(PYQT_URL ${LLNL_URL}) set(PYQT_GZ_APPLE PyQt-mac-gpl-${PYQT_VERSION}.tar.gz) set(PYQT_GZ_UNIX PyQt-x11-gpl-${PYQT_VERSION}.tar.gz) -set(PYQT_MD5_APPLE f8feb678212cf4f84d5cf5317b1f5bc2 ) -set(PYQT_MD5_UNIX e5973c4ec0b0469f329bc00209d2ad9c ) +set(PYQT_MD5_APPLE 9bd050f1d0c91510ea8be9f41878144c ) +set(PYQT_MD5_UNIX 997c3e443165a89a559e0d96b061bf70 ) set(PYQT_SOURCE ${PYQT_URL}/${PYQT_GZ_${CMAKE_PLATFORM}}) set(PYQT_MD5 ${PYQT_MD5_${CMAKE_PLATFORM}}) diff --git a/CMake/cdat_modules/pyspharm_external.cmake b/CMake/cdat_modules/pyspharm_external.cmake index 792abec58c..316f379aba 100644 --- a/CMake/cdat_modules/pyspharm_external.cmake +++ b/CMake/cdat_modules/pyspharm_external.cmake @@ -10,7 +10,7 @@ ExternalProject_Add(pyspharm BUILD_IN_SOURCE 1 CONFIGURE_COMMAND "" BUILD_COMMAND env LD_LIBRARY_PATH=$ENV{LD_LIBRARY_PATH} PYTHONPATH=$ENV{PYTHONPATH} ${PYTHON_EXECUTABLE} setup.py build - INSTALL_COMMAND env LD_LIBRARY_PATH=$ENV{LD_LIBRARY_PATH} PYTHONPATH=$ENV{PYTHONPATH} ${PYTHON_EXECUTABLE} setup.py install + INSTALL_COMMAND env LD_LIBRARY_PATH=$ENV{LD_LIBRARY_PATH} PYTHONPATH=$ENV{PYTHONPATH} ${PYTHON_EXECUTABLE} setup.py install --prefix=${PYTHON_SITE_PACKAGES_PREFIX} DEPENDS ${pyspharm_deps} ${ep_log_options} ) diff --git a/CMake/cdat_modules/python_pkg.cmake b/CMake/cdat_modules/python_pkg.cmake index 983ce468bc..680cd29921 100644 --- a/CMake/cdat_modules/python_pkg.cmake +++ b/CMake/cdat_modules/python_pkg.cmake @@ -13,36 +13,37 @@ add_cdat_package(Python ${PYTHON_MAJOR_SRC}.${PYTHON_MINOR_SRC}.${PYTHON_PATCH_S # FIXME: Name style set(CDAT_OS_XTRA_PATH "") -set(PYTHON_SITE_PACKAGES ${CMAKE_INSTALL_PREFIX}) +set(PYTHON_SITE_PACKAGES_PREFIX ${CMAKE_INSTALL_PREFIX}) +set(PYTHON_SITE_PACKAGES ${PYTHON_SITE_PACKAGES_PREFIX}/lib/python${PYVER}/site-packages) if (APPLE) - set(PYTHON_SITE_PACKAGES ${CMAKE_INSTALL_PREFIX}/Library/Frameworks/Python.framework/Versions/${PYVER}) + set(PYTHON_SITE_PACKAGES ${PYTHON_SITE_PACKAGES_PREFIX}/Library/Frameworks/Python.framework/Versions/${PYVER}/lib/python${PYVER}/site-packages) endif() -set(PYTHONPATH ${PYTHON_SITE_PACKAGES}/lib/python${PYVER}/site-packages:${PYTHON_SITE_PACKAGES}/lib/python/site-packages) +set(PYTHONPATH ${PYTHON_SITE_PACKAGES}) if (CDAT_USE_SYSTEM_PYTHON) - include(FindPythonInterp) + find_package(PythonInterp) set(PYVER ${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}) # \NOTE This is required or else FindPythonLibs may find whatever version is # listed first internally and if that version exists on the system. For example # a system might have python version 2.6 and 2.7 both installed. set(Python_ADDITIONAL_VERSIONS ${PYVER}) - include(FindPythonLibs) + find_package(PythonLibs) + set(PYTHON_SITE_PACKAGES ${CMAKE_INSTALL_PREFIX}/lib/python${PYVER}/site-packages) message("[INFO] Using system python ${PYTHON_EXECUTABLE}") message("[INFO] Putting packages in directory ${PYTHON_SITE_PACKAGES}") set(PYTHON_EXTRA_PREFIX "--prefix=${CMAKE_INSTALL_PREFIX}") message("[INFO] Setting up prefix for installing python packages into: ${PYTHON_EXTRA_PREFIX}") set(ENV{LD_LIBRARY_PATH} $ENV{LD_LIBRARY_PATH}) set(PYTHONPATH "${PYTHON_SITE_PACKAGES}:$ENV{PYTHONPATH}") + set(ENV{PYTHONPATH} "${PYTHONPATH}") message("[INFO] Set PYTHONPATH to $ENV{PYTHONPATH}") get_filename_component(PYTHON_EXECUTABLE_PATH ${PYTHON_EXECUTABLE} PATH) set(PYTHON_LIBRARY ${PYTHON_LIBRARIES}) message("[INFO] set PYTHON_LIBRARY TO" ${PYTHON_LIBRARY}) set(PYTHON_INCLUDE ${PYTHON_INCLUDE_DIRS}) - if(APPLE) set(CDAT_OS_XTRA_PATH ${CMAKE_INSTALL_PREFIX}/Library/Frameworks/Python.framework/Versions/${PYVER}/bin) endif() - else () set(PYTHON_EXECUTABLE ${CMAKE_INSTALL_PREFIX}/bin/python) message("[INFO] Building python at ${PYTHON_EXECUTABLE}") diff --git a/CMake/cdat_modules/sip_pkg.cmake b/CMake/cdat_modules/sip_pkg.cmake index e41d6386c3..12de0d6869 100644 --- a/CMake/cdat_modules/sip_pkg.cmake +++ b/CMake/cdat_modules/sip_pkg.cmake @@ -3,13 +3,13 @@ set(SIP_MAJOR 4) set(SIP_MINOR 12) set(SIP_PATCH 1) set(SIP_MAJOR_SRC 4) -set(SIP_MINOR_SRC 14) -set(SIP_PATCH_SRC 6) +set(SIP_MINOR_SRC 16) +set(SIP_PATCH_SRC 4) set(SIP_VERSION ${SIP_MAJOR_SRC}.${SIP_MINOR_SRC}.${SIP_PATCH_SRC}) set(SIP_URL http://www.riverbankcomputing.com/static/Downloads/sip${SIP_MAJOR_SRC}) set(SIP_URL ${LLNL_URL}) set(SIP_GZ sip-${SIP_MAJOR_SRC}.${SIP_MINOR_SRC}.${SIP_PATCH_SRC}.tar.gz) -set(SIP_MD5 d6493b9f0a7911566545f694327314c4 ) +set(SIP_MD5 a9840670a064dbf8f63a8f653776fec9 ) set(SIP_SOURCE ${SIP_URL}/${SIP_GZ}) diff --git a/CMake/cdat_modules/windspharm_external.cmake b/CMake/cdat_modules/windspharm_external.cmake index 967bc4ea0a..a1c93750e5 100644 --- a/CMake/cdat_modules/windspharm_external.cmake +++ b/CMake/cdat_modules/windspharm_external.cmake @@ -10,7 +10,7 @@ ExternalProject_Add(windspharm BUILD_IN_SOURCE 1 CONFIGURE_COMMAND "" BUILD_COMMAND ${PYTHON_EXECUTABLE} setup.py build - INSTALL_COMMAND ${PYTHON_EXECUTABLE} setup.py install ${PYTHON_EXTRA_PREFIX} + INSTALL_COMMAND env "PYTHONPATH=$ENV{PYTHONPATH}" "${PYTHON_EXECUTABLE}" setup.py install "${PYTHON_EXTRA_PREFIX}" DEPENDS ${windspharm_deps} ${ep_log_options} ) diff --git a/CMake/cdat_modules_extra/ESMP_install_step.cmake.in b/CMake/cdat_modules_extra/ESMP_install_step.cmake.in index 1084e5237d..2b8c2882e6 100644 --- a/CMake/cdat_modules_extra/ESMP_install_step.cmake.in +++ b/CMake/cdat_modules_extra/ESMP_install_step.cmake.in @@ -2,7 +2,7 @@ include(@cdat_CMAKE_BINARY_DIR@/cdat_common_environment.cmake) file(GLOB_RECURSE ESMP_esmfmkfile "@cdat_EXTERNALS@/lib/libO/*.mk") -file(RELATIVE_PATH _rel_path @PYTHON_SITE_PACKAGES@/ESMP/src ${ESMP_esmfmkfile}) +file(RELATIVE_PATH _rel_path @PYTHON_SITE_PACKGES_PREFIX@/ESMP/src ${ESMP_esmfmkfile}) set(ENV{ESMFMKFILE} ${_rel_path}) foreach( item ${ESMP_esmfmkfile}) diff --git a/CMake/cdat_modules_extra/cdat_common_environment.cmake.in b/CMake/cdat_modules_extra/cdat_common_environment.cmake.in index 8320c282f8..1bcffa94ee 100644 --- a/CMake/cdat_modules_extra/cdat_common_environment.cmake.in +++ b/CMake/cdat_modules_extra/cdat_common_environment.cmake.in @@ -35,10 +35,10 @@ endif() set(ENV{EXTERNALS} "@cdat_EXTERNALS@") -set(PYTHONUSERBASE @PYTHON_SITE_PACKAGES@) +set(PYTHONUSERBASE @PYTHON_SITE_PACKAGES_PREFIX@) #if ("@EGG_INSTALLER@" STREQUAL "PIP") # # Set python userbase so that pip install packages locally -# set(PYTHONUSERBASE @PYTHON_SITE_PACKAGES@) +# set(PYTHONUSERBASE @CMAKE_INSTALL_PREFIX@) # set(EGG_CMD env @LIBRARY_PATH@=$ENV{@LIBRARY_PATH@} PYTHONUSERBASE=${PYTHONUSERBASE} @PIP_BINARY@ install --user -v --download-cache @CDAT_PACKAGE_CACHE_DIR@ ) # if (NOT "${PIP_CERTIFICATE}" STREQUAL "") # set(EGG_CMD ${EGG_CMD} --cert=${PIP_CERTIFICATE}) diff --git a/CMake/cdat_modules_extra/ffmpeg_configure_step.cmake.in b/CMake/cdat_modules_extra/ffmpeg_configure_step.cmake.in index 04777ab4c9..f0d19839a9 100644 --- a/CMake/cdat_modules_extra/ffmpeg_configure_step.cmake.in +++ b/CMake/cdat_modules_extra/ffmpeg_configure_step.cmake.in @@ -11,8 +11,8 @@ if (CDAT_BUILD_YASM) endif() EXECUTE_PROCESS( - COMMAND sh configure ${_yasmexe} --disable-static --disable-network --disable-zlib --disable-ffserver --disable-ffplay --disable-decoders --enable-shared --enable-swscale --prefix=@ffmpeg_install@ - #COMMAND sh configure --prefix=@ffmpeg_install@ ${_yasmexe} + COMMAND sh configure ${_yasmexe} --extra-cxxflags=@ffmpeg_source@ --disable-static --disable-network --disable-zlib --disable-ffserver --disable-ffplay --disable-decoders --enable-shared --enable-swscale --prefix=@ffmpeg_install@ + #COMMAND sh configure --prefix=@ffmpeg_install@ ${_yasmexe} --extra-cxxflags=@ffmpeg_source@ WORKING_DIRECTORY "@ffmpeg_source@" RESULT_VARIABLE rv ) diff --git a/CMake/cdat_modules_extra/install.py.in b/CMake/cdat_modules_extra/install.py.in index ea16440a7d..c8c8aa0322 100644 --- a/CMake/cdat_modules_extra/install.py.in +++ b/CMake/cdat_modules_extra/install.py.in @@ -261,6 +261,13 @@ SOURCE = 'CDAT' def get_version(): return Version +def get_prefix(): + import os + try: + return os.environ["UVCDAT_SETUP_PATH"] + except KeyError: + raise RuntimeError("UVCDAT environment not configured. Please source the setup_runtime script.") + def runCheck(): import cdat_info,os if cdat_info.ping_checked is False: diff --git a/CMake/cdat_modules_extra/pyzmq_install_step.cmake.in b/CMake/cdat_modules_extra/pyzmq_install_step.cmake.in index 63ca883f82..da21d89c1e 100644 --- a/CMake/cdat_modules_extra/pyzmq_install_step.cmake.in +++ b/CMake/cdat_modules_extra/pyzmq_install_step.cmake.in @@ -7,7 +7,7 @@ if(APPLE) endif() execute_process( - COMMAND env @LIBRARY_PATH@="$ENV{LD_LIBRARY_PATH}" "@PYTHON_EXECUTABLE@" setup.py install --zmq=@cdat_EXTERNALS@ + COMMAND env @LIBRARY_PATH@="$ENV{LD_LIBRARY_PATH}" "@PYTHON_EXECUTABLE@" setup.py install --zmq=@cdat_EXTERNALS@ --prefix=@PYTHON_SITE_PACKAGES_PREFIX@ WORKING_DIRECTORY "@pyzmq_binary@" RESULT_VARIABLE res OUTPUT_VARIABLE pyzmq_OUT diff --git a/CMake/cmake_modules/FindPythonInterp.cmake b/CMake/cmake_modules/FindPythonInterp.cmake new file mode 100644 index 0000000000..e13416f5d9 --- /dev/null +++ b/CMake/cmake_modules/FindPythonInterp.cmake @@ -0,0 +1,141 @@ +# - Find python interpreter +# This module finds if Python interpreter is installed and determines where the +# executables are. This code sets the following variables: +# +# PYTHONINTERP_FOUND - Was the Python executable found +# PYTHON_EXECUTABLE - path to the Python interpreter +# +# PYTHON_VERSION_STRING - Python version found e.g. 2.5.2 +# PYTHON_VERSION_MAJOR - Python major version found e.g. 2 +# PYTHON_VERSION_MINOR - Python minor version found e.g. 5 +# PYTHON_VERSION_PATCH - Python patch version found e.g. 2 +# +# The Python_ADDITIONAL_VERSIONS variable can be used to specify a list of +# version numbers that should be taken into account when searching for Python. +# You need to set this variable before calling find_package(PythonInterp). + +#============================================================================= +# Copyright 2005-2010 Kitware, Inc. +# Copyright 2011 Bjoern Ricks +# Copyright 2012 Rolf Eike Beer +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +unset(_Python_NAMES) + +set(_PYTHON1_VERSIONS 1.6 1.5) +set(_PYTHON2_VERSIONS 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0) +set(_PYTHON3_VERSIONS 3.4 3.3 3.2 3.1 3.0) + +if(PythonInterp_FIND_VERSION) + if(PythonInterp_FIND_VERSION MATCHES "^[0-9]+\\.[0-9]+(\\.[0-9]+.*)?$") + string(REGEX REPLACE "^([0-9]+\\.[0-9]+).*" "\\1" _PYTHON_FIND_MAJ_MIN "${PythonInterp_FIND_VERSION}") + string(REGEX REPLACE "^([0-9]+).*" "\\1" _PYTHON_FIND_MAJ "${_PYTHON_FIND_MAJ_MIN}") + list(APPEND _Python_NAMES python${_PYTHON_FIND_MAJ_MIN} python${_PYTHON_FIND_MAJ}) + unset(_PYTHON_FIND_OTHER_VERSIONS) + if(NOT PythonInterp_FIND_VERSION_EXACT) + foreach(_PYTHON_V ${_PYTHON${_PYTHON_FIND_MAJ}_VERSIONS}) + if(NOT _PYTHON_V VERSION_LESS _PYTHON_FIND_MAJ_MIN) + list(APPEND _PYTHON_FIND_OTHER_VERSIONS ${_PYTHON_V}) + endif() + endforeach() + endif() + unset(_PYTHON_FIND_MAJ_MIN) + unset(_PYTHON_FIND_MAJ) + else() + list(APPEND _Python_NAMES python${PythonInterp_FIND_VERSION}) + set(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON${PythonInterp_FIND_VERSION}_VERSIONS}) + endif() +else() + set(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON3_VERSIONS} ${_PYTHON2_VERSIONS} ${_PYTHON1_VERSIONS}) +endif() + +list(APPEND _Python_NAMES python) + +# Search for the current active python version first +find_program(PYTHON_EXECUTABLE NAMES ${_Python_NAMES}) + +# Set up the versions we know about, in the order we will search. Always add +# the user supplied additional versions to the front. +set(_Python_VERSIONS + ${Python_ADDITIONAL_VERSIONS} + ${_PYTHON_FIND_OTHER_VERSIONS} + ) + +unset(_PYTHON_FIND_OTHER_VERSIONS) +unset(_PYTHON1_VERSIONS) +unset(_PYTHON2_VERSIONS) +unset(_PYTHON3_VERSIONS) + +# Search for newest python version if python executable isn't found +if(NOT PYTHON_EXECUTABLE) + foreach(_CURRENT_VERSION ${_Python_VERSIONS}) + set(_Python_NAMES python${_CURRENT_VERSION}) + if(WIN32) + list(APPEND _Python_NAMES python) + endif() + find_program(PYTHON_EXECUTABLE + NAMES ${_Python_NAMES} + PATHS [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath] + ) + endforeach() +endif() + +# determine python version string +if(PYTHON_EXECUTABLE) + execute_process(COMMAND "${PYTHON_EXECUTABLE}" -c + "import sys; sys.stdout.write(';'.join([str(x) for x in sys.version_info[:3]]))" + OUTPUT_VARIABLE _VERSION + RESULT_VARIABLE _PYTHON_VERSION_RESULT + ERROR_QUIET) + if(NOT _PYTHON_VERSION_RESULT) + string(REPLACE ";" "." PYTHON_VERSION_STRING "${_VERSION}") + list(GET _VERSION 0 PYTHON_VERSION_MAJOR) + list(GET _VERSION 1 PYTHON_VERSION_MINOR) + list(GET _VERSION 2 PYTHON_VERSION_PATCH) + if(PYTHON_VERSION_PATCH EQUAL 0) + # it's called "Python 2.7", not "2.7.0" + string(REGEX REPLACE "\\.0$" "" PYTHON_VERSION_STRING "${PYTHON_VERSION_STRING}") + endif() + else() + # sys.version predates sys.version_info, so use that + execute_process(COMMAND "${PYTHON_EXECUTABLE}" -c "import sys; sys.stdout.write(sys.version)" + OUTPUT_VARIABLE _VERSION + RESULT_VARIABLE _PYTHON_VERSION_RESULT + ERROR_QUIET) + if(NOT _PYTHON_VERSION_RESULT) + string(REGEX REPLACE " .*" "" PYTHON_VERSION_STRING "${_VERSION}") + string(REGEX REPLACE "^([0-9]+)\\.[0-9]+.*" "\\1" PYTHON_VERSION_MAJOR "${PYTHON_VERSION_STRING}") + string(REGEX REPLACE "^[0-9]+\\.([0-9])+.*" "\\1" PYTHON_VERSION_MINOR "${PYTHON_VERSION_STRING}") + if(PYTHON_VERSION_STRING MATCHES "^[0-9]+\\.[0-9]+\\.[0-9]+.*") + string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" PYTHON_VERSION_PATCH "${PYTHON_VERSION_STRING}") + else() + set(PYTHON_VERSION_PATCH "0") + endif() + else() + # sys.version was first documented for Python 1.5, so assume + # this is older. + set(PYTHON_VERSION_STRING "1.4") + set(PYTHON_VERSION_MAJOR "1") + set(PYTHON_VERSION_MAJOR "4") + set(PYTHON_VERSION_MAJOR "0") + endif() + endif() + unset(_PYTHON_VERSION_RESULT) + unset(_VERSION) +endif() + +# handle the QUIETLY and REQUIRED arguments and set PYTHONINTERP_FOUND to TRUE if +# all listed variables are TRUE +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(PythonInterp REQUIRED_VARS PYTHON_EXECUTABLE VERSION_VAR PYTHON_VERSION_STRING) + +mark_as_advanced(PYTHON_EXECUTABLE) diff --git a/CMake/cmake_modules/FindPythonLibs.cmake b/CMake/cmake_modules/FindPythonLibs.cmake new file mode 100644 index 0000000000..0fc806de18 --- /dev/null +++ b/CMake/cmake_modules/FindPythonLibs.cmake @@ -0,0 +1,275 @@ +# - Find python libraries +# This module finds if Python is installed and determines where the +# include files and libraries are. It also determines what the name of +# the library is. This code sets the following variables: +# +# PYTHONLIBS_FOUND - have the Python libs been found +# PYTHON_LIBRARIES - path to the python library +# PYTHON_INCLUDE_PATH - path to where Python.h is found (deprecated) +# PYTHON_INCLUDE_DIRS - path to where Python.h is found +# PYTHON_DEBUG_LIBRARIES - path to the debug library (deprecated) +# PYTHONLIBS_VERSION_STRING - version of the Python libs found (since CMake 2.8.8) +# +# The Python_ADDITIONAL_VERSIONS variable can be used to specify a list of +# version numbers that should be taken into account when searching for Python. +# You need to set this variable before calling find_package(PythonLibs). +# +# If you'd like to specify the installation of Python to use, you should modify +# the following cache variables: +# PYTHON_LIBRARY - path to the python library +# PYTHON_INCLUDE_DIR - path to where Python.h is found + +#============================================================================= +# Copyright 2001-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +include(CMakeFindFrameworks) +# Search for the python framework on Apple. +CMAKE_FIND_FRAMEWORKS(Python) + +set(_PYTHON1_VERSIONS 1.6 1.5) +set(_PYTHON2_VERSIONS 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0) +set(_PYTHON3_VERSIONS 3.4 3.3 3.2 3.1 3.0) + +if(PythonLibs_FIND_VERSION) + if(PythonLibs_FIND_VERSION MATCHES "^[0-9]+\\.[0-9]+(\\.[0-9]+.*)?$") + string(REGEX REPLACE "^([0-9]+\\.[0-9]+).*" "\\1" _PYTHON_FIND_MAJ_MIN "${PythonLibs_FIND_VERSION}") + string(REGEX REPLACE "^([0-9]+).*" "\\1" _PYTHON_FIND_MAJ "${_PYTHON_FIND_MAJ_MIN}") + unset(_PYTHON_FIND_OTHER_VERSIONS) + if(PythonLibs_FIND_VERSION_EXACT) + if(_PYTHON_FIND_MAJ_MIN STREQUAL PythonLibs_FIND_VERSION) + set(_PYTHON_FIND_OTHER_VERSIONS "${PythonLibs_FIND_VERSION}") + else() + set(_PYTHON_FIND_OTHER_VERSIONS "${PythonLibs_FIND_VERSION}" "${_PYTHON_FIND_MAJ_MIN}") + endif() + else() + foreach(_PYTHON_V ${_PYTHON${_PYTHON_FIND_MAJ}_VERSIONS}) + if(NOT _PYTHON_V VERSION_LESS _PYTHON_FIND_MAJ_MIN) + list(APPEND _PYTHON_FIND_OTHER_VERSIONS ${_PYTHON_V}) + endif() + endforeach() + endif() + unset(_PYTHON_FIND_MAJ_MIN) + unset(_PYTHON_FIND_MAJ) + else() + set(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON${PythonLibs_FIND_VERSION}_VERSIONS}) + endif() +else() + set(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON3_VERSIONS} ${_PYTHON2_VERSIONS} ${_PYTHON1_VERSIONS}) +endif() + +# Set up the versions we know about, in the order we will search. Always add +# the user supplied additional versions to the front. +set(_Python_VERSIONS + ${Python_ADDITIONAL_VERSIONS} + ${_PYTHON_FIND_OTHER_VERSIONS} + ) + +unset(_PYTHON_FIND_OTHER_VERSIONS) +unset(_PYTHON1_VERSIONS) +unset(_PYTHON2_VERSIONS) +unset(_PYTHON3_VERSIONS) + +foreach(_CURRENT_VERSION ${_Python_VERSIONS}) + string(REPLACE "." "" _CURRENT_VERSION_NO_DOTS ${_CURRENT_VERSION}) + if(WIN32) + find_library(PYTHON_DEBUG_LIBRARY + NAMES python${_CURRENT_VERSION_NO_DOTS}_d python + PATHS + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs/Debug + [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs/Debug + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs + [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs + ) + endif() + + find_library(PYTHON_LIBRARY + NAMES + python${_CURRENT_VERSION_NO_DOTS} + python${_CURRENT_VERSION}mu + python${_CURRENT_VERSION}m + python${_CURRENT_VERSION}u + python${_CURRENT_VERSION} + PATHS + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs + [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs + # Avoid finding the .dll in the PATH. We want the .lib. + NO_SYSTEM_ENVIRONMENT_PATH + ) + # Look for the static library in the Python config directory + find_library(PYTHON_LIBRARY + NAMES python${_CURRENT_VERSION_NO_DOTS} python${_CURRENT_VERSION} + # Avoid finding the .dll in the PATH. We want the .lib. + NO_SYSTEM_ENVIRONMENT_PATH + # This is where the static library is usually located + PATH_SUFFIXES python${_CURRENT_VERSION}/config + ) + + # For backward compatibility, honour value of PYTHON_INCLUDE_PATH, if + # PYTHON_INCLUDE_DIR is not set. + if(DEFINED PYTHON_INCLUDE_PATH AND NOT DEFINED PYTHON_INCLUDE_DIR) + set(PYTHON_INCLUDE_DIR "${PYTHON_INCLUDE_PATH}" CACHE PATH + "Path to where Python.h is found" FORCE) + endif() + + set(PYTHON_FRAMEWORK_INCLUDES) + if(Python_FRAMEWORKS AND NOT PYTHON_INCLUDE_DIR) + foreach(dir ${Python_FRAMEWORKS}) + set(PYTHON_FRAMEWORK_INCLUDES ${PYTHON_FRAMEWORK_INCLUDES} + ${dir}/Versions/${_CURRENT_VERSION}/include/python${_CURRENT_VERSION}) + endforeach() + endif() + + find_path(PYTHON_INCLUDE_DIR + NAMES Python.h + PATHS + ${PYTHON_FRAMEWORK_INCLUDES} + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/include + [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/include + PATH_SUFFIXES + python${_CURRENT_VERSION}mu + python${_CURRENT_VERSION}m + python${_CURRENT_VERSION}u + python${_CURRENT_VERSION} + ) + + # For backward compatibility, set PYTHON_INCLUDE_PATH. + set(PYTHON_INCLUDE_PATH "${PYTHON_INCLUDE_DIR}") + + if(PYTHON_INCLUDE_DIR AND EXISTS "${PYTHON_INCLUDE_DIR}/patchlevel.h") + file(STRINGS "${PYTHON_INCLUDE_DIR}/patchlevel.h" python_version_str + REGEX "^#define[ \t]+PY_VERSION[ \t]+\"[^\"]+\"") + string(REGEX REPLACE "^#define[ \t]+PY_VERSION[ \t]+\"([^\"]+)\".*" "\\1" + PYTHONLIBS_VERSION_STRING "${python_version_str}") + unset(python_version_str) + endif() + + if(PYTHON_LIBRARY AND PYTHON_INCLUDE_DIR) + break() + endif() +endforeach() + +mark_as_advanced( + PYTHON_DEBUG_LIBRARY + PYTHON_LIBRARY + PYTHON_INCLUDE_DIR +) + +# We use PYTHON_INCLUDE_DIR, PYTHON_LIBRARY and PYTHON_DEBUG_LIBRARY for the +# cache entries because they are meant to specify the location of a single +# library. We now set the variables listed by the documentation for this +# module. +set(PYTHON_INCLUDE_DIRS "${PYTHON_INCLUDE_DIR}") +set(PYTHON_DEBUG_LIBRARIES "${PYTHON_DEBUG_LIBRARY}") + +# These variables have been historically named in this module different from +# what SELECT_LIBRARY_CONFIGURATIONS() expects. +set(PYTHON_LIBRARY_DEBUG "${PYTHON_DEBUG_LIBRARY}") +set(PYTHON_LIBRARY_RELEASE "${PYTHON_LIBRARY}") +include(SelectLibraryConfigurations) +SELECT_LIBRARY_CONFIGURATIONS(PYTHON) +# SELECT_LIBRARY_CONFIGURATIONS() sets ${PREFIX}_FOUND if it has a library. +# Unset this, this prefix doesn't match the module prefix, they are different +# for historical reasons. +unset(PYTHON_FOUND) + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(PythonLibs + REQUIRED_VARS PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS + VERSION_VAR PYTHONLIBS_VERSION_STRING) + +# PYTHON_ADD_MODULE( src1 src2 ... srcN) is used to build modules for python. +# PYTHON_WRITE_MODULES_HEADER() writes a header file you can include +# in your sources to initialize the static python modules +function(PYTHON_ADD_MODULE _NAME ) + get_property(_TARGET_SUPPORTS_SHARED_LIBS + GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS) + option(PYTHON_ENABLE_MODULE_${_NAME} "Add module ${_NAME}" TRUE) + option(PYTHON_MODULE_${_NAME}_BUILD_SHARED + "Add module ${_NAME} shared" ${_TARGET_SUPPORTS_SHARED_LIBS}) + + # Mark these options as advanced + mark_as_advanced(PYTHON_ENABLE_MODULE_${_NAME} + PYTHON_MODULE_${_NAME}_BUILD_SHARED) + + if(PYTHON_ENABLE_MODULE_${_NAME}) + if(PYTHON_MODULE_${_NAME}_BUILD_SHARED) + set(PY_MODULE_TYPE MODULE) + else() + set(PY_MODULE_TYPE STATIC) + set_property(GLOBAL APPEND PROPERTY PY_STATIC_MODULES_LIST ${_NAME}) + endif() + + set_property(GLOBAL APPEND PROPERTY PY_MODULES_LIST ${_NAME}) + add_library(${_NAME} ${PY_MODULE_TYPE} ${ARGN}) +# target_link_libraries(${_NAME} ${PYTHON_LIBRARIES}) + + if(PYTHON_MODULE_${_NAME}_BUILD_SHARED) + set_target_properties(${_NAME} PROPERTIES PREFIX "${PYTHON_MODULE_PREFIX}") + if(WIN32 AND NOT CYGWIN) + set_target_properties(${_NAME} PROPERTIES SUFFIX ".pyd") + endif() + endif() + + endif() +endfunction() + +function(PYTHON_WRITE_MODULES_HEADER _filename) + + get_property(PY_STATIC_MODULES_LIST GLOBAL PROPERTY PY_STATIC_MODULES_LIST) + + get_filename_component(_name "${_filename}" NAME) + string(REPLACE "." "_" _name "${_name}") + string(TOUPPER ${_name} _nameUpper) + set(_filename ${CMAKE_CURRENT_BINARY_DIR}/${_filename}) + + set(_filenameTmp "${_filename}.in") + file(WRITE ${_filenameTmp} "/*Created by cmake, do not edit, changes will be lost*/\n") + file(APPEND ${_filenameTmp} +"#ifndef ${_nameUpper} +#define ${_nameUpper} + +#include + +#ifdef __cplusplus +extern \"C\" { +#endif /* __cplusplus */ + +") + + foreach(_currentModule ${PY_STATIC_MODULES_LIST}) + file(APPEND ${_filenameTmp} "extern void init${PYTHON_MODULE_PREFIX}${_currentModule}(void);\n\n") + endforeach() + + file(APPEND ${_filenameTmp} +"#ifdef __cplusplus +} +#endif /* __cplusplus */ + +") + + + foreach(_currentModule ${PY_STATIC_MODULES_LIST}) + file(APPEND ${_filenameTmp} "int ${_name}_${_currentModule}(void) \n{\n static char name[]=\"${PYTHON_MODULE_PREFIX}${_currentModule}\"; return PyImport_AppendInittab(name, init${PYTHON_MODULE_PREFIX}${_currentModule});\n}\n\n") + endforeach() + + file(APPEND ${_filenameTmp} "void ${_name}_LoadAllPythonModules(void)\n{\n") + foreach(_currentModule ${PY_STATIC_MODULES_LIST}) + file(APPEND ${_filenameTmp} " ${_name}_${_currentModule}();\n") + endforeach() + file(APPEND ${_filenameTmp} "}\n\n") + file(APPEND ${_filenameTmp} "#ifndef EXCLUDE_LOAD_ALL_FUNCTION\nvoid CMakeLoadAllPythonModules(void)\n{\n ${_name}_LoadAllPythonModules();\n}\n#endif\n\n#endif\n") + +# with configure_file() cmake complains that you may not use a file created using file(WRITE) as input file for configure_file() + execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${_filenameTmp}" "${_filename}" OUTPUT_QUIET ERROR_QUIET) + +endfunction() diff --git a/CMakeLists.txt b/CMakeLists.txt index a5431e7d61..c1f39572be 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -257,6 +257,7 @@ set_property(CACHE EGG_INSTALLER PROPERTY STRINGS "PIP" "EASY_INSTALL") set(PIP_CERTIFICATE "" CACHE STRING "Certificate to use for PIP (LLNL issue really)") # Options for various types of builds +option(CDAT_USE_SYSTEM_PYTHON "Use system Python" OFF) # Default state set(CDAT_BUILD_LEAN OFF) @@ -491,7 +492,9 @@ include(scikits_pkg) include(scipy_pkg) ## Part of setuptools no need to extra build it ## include(distribute_pkg) -include(pip_pkg) +if (NOT CDAT_USE_SYSTEM_PYTHON) + include(pip_pkg) +endif() include(shapely_pkg) include(pygments_pkg) include(markupsafe_pkg) @@ -538,8 +541,10 @@ endif() if (CDAT_BUILD_GUI) include(qt4_pkg) - include(sip_pkg) - include(pyqt_pkg) + if (NOT CDAT_USE_SYSTEM_PYTHON) + include(sip_pkg) + include(pyqt_pkg) + endif() include(spyder_pkg) endif() diff --git a/Packages/DV3D/DV3DPlot.py b/Packages/DV3D/DV3DPlot.py index 39aad75a33..61b5719b38 100644 --- a/Packages/DV3D/DV3DPlot.py +++ b/Packages/DV3D/DV3DPlot.py @@ -1023,7 +1023,8 @@ def toggleLogoVisibility( self ): def addLogo(self): if self.logoRepresentation == None: - defaultLogoFile = os.path.join(sys.prefix,"share","vcs","uvcdat.png") + import cdat_info + defaultLogoFile = os.path.join(cdat_info.get_prefix(),"share","vcs","uvcdat.png") reader = vtk.vtkPNGReader() reader.SetFileName( defaultLogoFile ) reader.Update() diff --git a/Packages/DV3D/demo/demo_plots/clt_demo.py b/Packages/DV3D/demo/demo_plots/clt_demo.py index 85b38a829e..8f64a84717 100644 --- a/Packages/DV3D/demo/demo_plots/clt_demo.py +++ b/Packages/DV3D/demo/demo_plots/clt_demo.py @@ -1,7 +1,7 @@ import vcs, cdms2, sys x = vcs.init() -f = cdms2.open(sys.prefix+"/sample_data/clt.nc") +f = cdms2.open(vcs.prefix+"/sample_data/clt.nc") v = f["clt"] dv3d = vcs.get3d_scalar() x.plot( v, dv3d ) diff --git a/Packages/DV3D/demo/demo_plots/clt_test_demo.py b/Packages/DV3D/demo/demo_plots/clt_test_demo.py index e4941c4f76..1338150f3b 100644 --- a/Packages/DV3D/demo/demo_plots/clt_test_demo.py +++ b/Packages/DV3D/demo/demo_plots/clt_test_demo.py @@ -1,7 +1,7 @@ def simpleanimation(): import vcs, cdms2, sys x = vcs.init() - f = cdms2.open(sys.prefix+"/sample_data/clt.nc") + f = cdms2.open(vcs.prefix+"/sample_data/clt.nc") v = f["clt"] dv3d = vcs.get3d_scalar() x.plot( v, dv3d ) @@ -10,7 +10,7 @@ def simpleanimation(): def simplevector(): import vcs, cdms2, sys x = vcs.init() - f = cdms2.open(sys.prefix+"/sample_data/clt.nc") + f = cdms2.open(vcs.prefix+"/sample_data/clt.nc") v = f["v"] u = f["u"] dv3d = vcs.get3d_vector() @@ -21,7 +21,7 @@ def simplevector(): def simplevolume(): import vcs, cdms2, sys x = vcs.init() - f = cdms2.open(sys.prefix+"/sample_data/geos5-sample.nc") + f = cdms2.open(vcs.prefix+"/sample_data/geos5-sample.nc") u = f["uwnd"] dv3d = vcs.get3d_scalar() dv3d.VerticalScaling = 3.0 @@ -39,4 +39,4 @@ def simplevolume(): x.interact() if __name__ == "__main__": - simplevolume() \ No newline at end of file + simplevolume() diff --git a/Packages/DV3D/demo/demo_plots/clt_vector_demo.py b/Packages/DV3D/demo/demo_plots/clt_vector_demo.py index 7444d61c5b..601fef5b07 100644 --- a/Packages/DV3D/demo/demo_plots/clt_vector_demo.py +++ b/Packages/DV3D/demo/demo_plots/clt_vector_demo.py @@ -1,6 +1,6 @@ import vcs, cdms2, sys x = vcs.init() -f = cdms2.open(sys.prefix+"/sample_data/clt.nc") +f = cdms2.open(vcs.prefix+"/sample_data/clt.nc") v = f["v"] u = f["u"] dv3d = vcs.get3d_vector() diff --git a/Packages/DV3D/demo/demo_plots/clt_xyt_demo.py b/Packages/DV3D/demo/demo_plots/clt_xyt_demo.py index 8cbe1f2079..0cb409fef1 100644 --- a/Packages/DV3D/demo/demo_plots/clt_xyt_demo.py +++ b/Packages/DV3D/demo/demo_plots/clt_xyt_demo.py @@ -1,6 +1,6 @@ import vcs, cdms2, sys x = vcs.init() -f = cdms2.open(sys.prefix+"/sample_data/clt.nc") +f = cdms2.open(vcs.prefix+"/sample_data/clt.nc") v = f["clt"] dv3d = vcs.get3d_scalar('Hovmoller3D') dv3d.ToggleSurfacePlot = vcs.on diff --git a/Packages/cdutil/Lib/continent_fill.py b/Packages/cdutil/Lib/continent_fill.py index 9698038e63..7ef0b1f95e 100644 --- a/Packages/cdutil/Lib/continent_fill.py +++ b/Packages/cdutil/Lib/continent_fill.py @@ -148,7 +148,7 @@ def plot(self,x=None,template=None,bg=0,ratio=None): if __name__ == '__main__': import os,sys,cdutil,vcs,cdms2 as cdms - fnm=os.path.join(sys.prefix,'sample_data','clt.nc') + fnm=os.path.join(vcs.prefix,'sample_data','clt.nc') f=cdms.open(fnm) s=f('clt',0,longitude=(-180.,180.)) x=vcs.init() diff --git a/Packages/cdutil/Lib/create_landsea_mask.py b/Packages/cdutil/Lib/create_landsea_mask.py index 8b2181c102..a10698993f 100644 --- a/Packages/cdutil/Lib/create_landsea_mask.py +++ b/Packages/cdutil/Lib/create_landsea_mask.py @@ -182,7 +182,7 @@ def generateLandSeaMask(target,source=None,threshold_1 = .2, threshold_2 = .3,re raise Exception, "Error: target grid must be rectilinear" if source is None: - source = cdms2.open(os.path.join(sys.prefix,'share','cdutil','navy_land.nc'))('sftlf') + source = cdms2.open(os.path.join(cdat_info.get_prefix(),'share','cdutil','navy_land.nc'))('sftlf') try: navy_frac_t = source.regrid(target,regridTool='regrid2') diff --git a/Packages/cdutil/Lib/sftbyrgn.py b/Packages/cdutil/Lib/sftbyrgn.py index e8e3a4315a..9dc359bf6c 100644 --- a/Packages/cdutil/Lib/sftbyrgn.py +++ b/Packages/cdutil/Lib/sftbyrgn.py @@ -64,7 +64,7 @@ def generateSurfaceTypeByRegionMask(mask,sftbyrgn=None,sftbyrgnmask=215,regions mask = cdutil.generateLandSeaMask(mask)*100. if sftbyrgn is None: - sftbyrgn = cdms2.open(os.path.join(sys.prefix,'share','cdutil','sftbyrgn.nc'))('sftbyrgn') + sftbyrgn = cdms2.open(os.path.join(cdat_info.get_prefix(),'share','cdutil','sftbyrgn.nc'))('sftbyrgn') if regions is None: if verbose: print 'Preparing regions' diff --git a/Packages/cmor/Test/cmor_speed_and_compression.py b/Packages/cmor/Test/cmor_speed_and_compression.py index 35b4a39847..d51b7e78b5 100644 --- a/Packages/cmor/Test/cmor_speed_and_compression.py +++ b/Packages/cmor/Test/cmor_speed_and_compression.py @@ -1,4 +1,4 @@ -import cmor,numpy,sys,os +import cmor,numpy,sys,os,cdat_info try: import cdms2 cdms2.setNetcdfShuffleFlag(0) @@ -56,7 +56,7 @@ ## read in data, just one slice -f=cdms2.open(sys.prefix+'/sample_data/tas_ccsr-95a.xml') +f=cdms2.open(cdat_info.get_prefix()+'/sample_data/tas_ccsr-95a.xml') s=f("tas",time=slice(0,1),squeeze=1) diff --git a/Packages/cmor/Test/cmor_speed_and_compression_01.py b/Packages/cmor/Test/cmor_speed_and_compression_01.py index b084b7441c..c19e8b6d5e 100644 --- a/Packages/cmor/Test/cmor_speed_and_compression_01.py +++ b/Packages/cmor/Test/cmor_speed_and_compression_01.py @@ -1,4 +1,4 @@ -import cmor,numpy,sys,os +import cmor,numpy,sys,os,cdat_info try: import cdms2 cdms2.setNetcdfShuffleFlag(0) @@ -56,7 +56,7 @@ ## read in data, just one slice -f=cdms2.open(sys.prefix+'/sample_data/tas_ccsr-95a.xml') +f=cdms2.open(cdat_info.get_prefix()+'/sample_data/tas_ccsr-95a.xml') s=f("tas",time=slice(0,12),squeeze=1) ntimes = 12 diff --git a/Packages/cmor/Test/test_compression.py b/Packages/cmor/Test/test_compression.py index 5d2287b14b..f9306704d0 100644 --- a/Packages/cmor/Test/test_compression.py +++ b/Packages/cmor/Test/test_compression.py @@ -5,9 +5,9 @@ print 'This test requires cdms2 for I/O' sys.exit() -import cmor,numpy +import cmor,numpy,cdat_info -f=cdms2.open(os.path.join(sys.prefix,'sample_data/clt.nc')) +f=cdms2.open(os.path.join(cdat_info.get_prefix(),'sample_data/clt.nc')) pth = os.path.split(os.path.realpath(os.curdir)) if pth[-1]=='Test': diff --git a/Packages/demo/Script/tutorials/CDMS_Basics_1.py b/Packages/demo/Script/tutorials/CDMS_Basics_1.py index e7730a27d5..4fc1c15715 100644 --- a/Packages/demo/Script/tutorials/CDMS_Basics_1.py +++ b/Packages/demo/Script/tutorials/CDMS_Basics_1.py @@ -1,9 +1,10 @@ # Adapted for numpy/ma/cdms2 by convertcdms.py # Import the cdms module and the sys module import cdms2 as cdms,sys +import cdat_info # Construct the string containing the path to the data_file -file_name=sys.prefix+'/sample_data/clt.nc' +file_name=cdat_info.get_prefix()+'/sample_data/clt.nc' # open the file with the cdms interface file=cdms.open(file_name) diff --git a/Packages/demo/Script/tutorials/CDMS_Basics_2.py b/Packages/demo/Script/tutorials/CDMS_Basics_2.py index 99695729a9..388f53583a 100644 --- a/Packages/demo/Script/tutorials/CDMS_Basics_2.py +++ b/Packages/demo/Script/tutorials/CDMS_Basics_2.py @@ -1,6 +1,8 @@ # Adapted for numpy/ma/cdms2 by convertcdms.py import cdms2 as cdms,sys -f=cdms.open(sys.prefix+'/sample_data/clt.nc') +import cdat_info + +f=cdms.open(cdat_info.get_prefix()+'/sample_data/clt.nc') # Query "file" attributes print f.listglobal() diff --git a/Packages/demo/Script/tutorials/Files_1.py b/Packages/demo/Script/tutorials/Files_1.py index 4f8ea74073..3a3001c27a 100644 --- a/Packages/demo/Script/tutorials/Files_1.py +++ b/Packages/demo/Script/tutorials/Files_1.py @@ -1,7 +1,8 @@ # Adapted for numpy/ma/cdms2 by convertcdms.py import cdms2 as cdms, sys +import cdat_info -file=sys.prefix+'/sample_data/clt.nc' +file=cdat_info.get_prefix()+'/sample_data/clt.nc' # Open the file via cdms f=cdms.open(file) diff --git a/Packages/demo/Script/tutorials/Files_2.py b/Packages/demo/Script/tutorials/Files_2.py index 6fb775c38d..4362fa2181 100644 --- a/Packages/demo/Script/tutorials/Files_2.py +++ b/Packages/demo/Script/tutorials/Files_2.py @@ -1,9 +1,10 @@ # Adapted for numpy/ma/cdms2 by convertcdms.py import string,sys,MV2 as MV +import cdat_info # First of all we need to open the ASCII file # For this we used the Python built-in command "open" -f=open(sys.prefix+'/sample_data/test_col.asc') +f=open(cdat_info.get_prefix()+'/sample_data/test_col.asc') # Now we need to read its content # To read all of its content we use the "readlines" command diff --git a/Packages/demo/Script/tutorials/Files_3.py b/Packages/demo/Script/tutorials/Files_3.py index c2d44a1dcc..7092d5941e 100644 --- a/Packages/demo/Script/tutorials/Files_3.py +++ b/Packages/demo/Script/tutorials/Files_3.py @@ -1,8 +1,9 @@ # Adapted for numpy/ma/cdms2 by convertcdms.py import cdms2 as cdms import sys +import cdat_info -path=sys.prefix+'/sample_data/' +path=cdat_info.get_prefix()+'/sample_data/' files = [ path+'u_2000.nc', path+'u_2001.nc', diff --git a/Packages/demo/Script/tutorials/Loops_1.py b/Packages/demo/Script/tutorials/Loops_1.py index e010e622c8..971654cdd0 100644 --- a/Packages/demo/Script/tutorials/Loops_1.py +++ b/Packages/demo/Script/tutorials/Loops_1.py @@ -1,7 +1,8 @@ # Adapted for numpy/ma/cdms2 by convertcdms.py import cdms2 as cdms,sys,os +import cdat_info -path=sys.prefix+'/sample_data/' +path=cdat_info.get_prefix()+'/sample_data/' # List files in sample_data directory my_files=os.listdir(path) diff --git a/Packages/demo/Script/tutorials/Loops_2.py b/Packages/demo/Script/tutorials/Loops_2.py index 61be733d23..6619e66193 100644 --- a/Packages/demo/Script/tutorials/Loops_2.py +++ b/Packages/demo/Script/tutorials/Loops_2.py @@ -1,9 +1,10 @@ # Adapted for numpy/ma/cdms2 by convertcdms.py import cdms2 as cdms, MV2 as MV import sys +import cdat_info # Creates string for path to data -pth=sys.prefix+'/sample_data/' +pth=cdat_info.get_prefix()+'/sample_data/' # Creates list containg path to files files = [ pth+'u_2000.nc', diff --git a/Packages/demo/Script/tutorials/Loops_3.py b/Packages/demo/Script/tutorials/Loops_3.py index 4ccb42ba73..cc667f851f 100644 --- a/Packages/demo/Script/tutorials/Loops_3.py +++ b/Packages/demo/Script/tutorials/Loops_3.py @@ -1,8 +1,9 @@ # Adapted for numpy/ma/cdms2 by convertcdms.py import cdms2 as cdms, MV2 as MV, genutil import sys +import cdat_info -pth=sys.prefix+'/sample_data/' +pth=cdat_info.get_prefix()+'/sample_data/' files = [ pth+'u_2000.nc', pth+'u_2001.nc', diff --git a/Packages/demo/Script/tutorials/adv_subset.py b/Packages/demo/Script/tutorials/adv_subset.py index c2cfe144c5..30e54b7861 100755 --- a/Packages/demo/Script/tutorials/adv_subset.py +++ b/Packages/demo/Script/tutorials/adv_subset.py @@ -24,13 +24,14 @@ import ioapiTools as ioT import cdms2 as cdms +import cdat_info import cdtime import os, sys ## Setup ## input file iFile = "CCTM_ACONC.D1.001" -iFile = os.path.join (sys.prefix,'sample_data/' + iFile) +iFile = os.path.join (cdat_info.get_prefix(),'sample_data/' + iFile) ## variable of interest varName = "o3" diff --git a/Packages/demo/Script/tutorials/animate.py b/Packages/demo/Script/tutorials/animate.py index 0100270514..38fb33646f 100644 --- a/Packages/demo/Script/tutorials/animate.py +++ b/Packages/demo/Script/tutorials/animate.py @@ -15,7 +15,7 @@ import vcs, cdms2 as cdms, cdutil, time, os, sys # Open data file: -filepath = os.path.join(sys.prefix, 'sample_data/clt.nc') +filepath = os.path.join(vcs.prefix, 'sample_data/clt.nc') cdmsfile = cdms.open( filepath ) # Extract a 3 dimensional data set and get a subset of the time dimension diff --git a/Packages/demo/Script/tutorials/average_var.py b/Packages/demo/Script/tutorials/average_var.py index 6f13b252eb..bb9239d737 100755 --- a/Packages/demo/Script/tutorials/average_var.py +++ b/Packages/demo/Script/tutorials/average_var.py @@ -14,6 +14,7 @@ import ioapiTools as ioT from mx import DateTime as D import cdutil +import cdat_info import sys, os ## Setup @@ -22,7 +23,7 @@ ## potential IOAPI files of interest, ## can use regular expression syntex searchStr = "CCTM_ACONC.D1.*" -searchStr = os.path.join (sys.prefix,'sample_data/' + searchStr) +searchStr = os.path.join (cdat_info.get_prefix(),'sample_data/' + searchStr) ## dates of interest: (year, month, day, hour) ## should be have #hrs as a multiple of 24 diff --git a/Packages/demo/Script/tutorials/boxfill_file.py b/Packages/demo/Script/tutorials/boxfill_file.py index 27a887a919..59f938d416 100644 --- a/Packages/demo/Script/tutorials/boxfill_file.py +++ b/Packages/demo/Script/tutorials/boxfill_file.py @@ -12,7 +12,7 @@ import vcs, cdms2 as cdms, cdutil, time, os, sys # Open data file: -filepath = os.path.join(sys.prefix, 'sample_data/clt.nc') +filepath = os.path.join(vcs.prefix, 'sample_data/clt.nc') cdmsfile = cdms.open( filepath ) # Extract a 3 dimensional data set and get a subset of the time dimension diff --git a/Packages/demo/Script/tutorials/change_datatype.py b/Packages/demo/Script/tutorials/change_datatype.py index 799cd75b63..792b5f77ce 100755 --- a/Packages/demo/Script/tutorials/change_datatype.py +++ b/Packages/demo/Script/tutorials/change_datatype.py @@ -14,12 +14,13 @@ import ioapiTools as ioT import numpy +import cdat_info import sys, os ## Setup ## input file iFile = "CCTM_ACONC.D1.001" -iFile = os.path.join (sys.prefix,'sample_data/' + iFile) +iFile = os.path.join (cdat_info.get_prefix(),'sample_data/' + iFile) ## variable of interest varName = "o3" diff --git a/Packages/demo/Script/tutorials/change_date.py b/Packages/demo/Script/tutorials/change_date.py index 30dd853647..886a349071 100755 --- a/Packages/demo/Script/tutorials/change_date.py +++ b/Packages/demo/Script/tutorials/change_date.py @@ -11,11 +11,12 @@ import ioapiTools as ioT from mx import DateTime as D import sys, os +import cdat_info ## Setup ## input file iFile = "CCTM_ACONC.D1.001" -iFile = os.path.join (sys.prefix,'sample_data/' + iFile) +iFile = os.path.join (cdat_info.get_prefix(),'sample_data/' + iFile) oFile1 = "var_newdate.ioapi" diff --git a/Packages/demo/Script/tutorials/change_variable.py b/Packages/demo/Script/tutorials/change_variable.py index 369489893a..f5df0ad876 100755 --- a/Packages/demo/Script/tutorials/change_variable.py +++ b/Packages/demo/Script/tutorials/change_variable.py @@ -15,11 +15,12 @@ import ioapiTools as ioT import sys, os +import cdat_info ## Setup ## input file iFile = "CCTM_ACONC.D1.001" -iFile = os.path.join (sys.prefix,'sample_data/' + iFile) +iFile = os.path.join (cdat_info.get_prefix(),'sample_data/' + iFile) oFile1 = "nox.ioapi" diff --git a/Packages/demo/Script/tutorials/compare_datasets.py b/Packages/demo/Script/tutorials/compare_datasets.py index dd1d567669..8f3522c1f6 100644 --- a/Packages/demo/Script/tutorials/compare_datasets.py +++ b/Packages/demo/Script/tutorials/compare_datasets.py @@ -5,7 +5,7 @@ from genutil import statistics -file1 = os.path.join(sys.prefix, 'sample_data/era40_tas_sample.nc') +file1 = os.path.join(vcs.prefix, 'sample_data/era40_tas_sample.nc') f1 = cdms2.open( file1 ) f1.showvariable() @@ -16,7 +16,7 @@ print f1.getAxis('time').asComponentTime()[-1] # 1993-12-1 0:0:0.0 -file2 = os.path.join(sys.prefix, 'sample_data/era15_tas_sample.nc') +file2 = os.path.join(vcs.prefix, 'sample_data/era15_tas_sample.nc') f2 = cdms2.open( file2 ) f2.showvariable() diff --git a/Packages/demo/Script/tutorials/continents_file.py b/Packages/demo/Script/tutorials/continents_file.py index 3590321563..d35d9c5337 100644 --- a/Packages/demo/Script/tutorials/continents_file.py +++ b/Packages/demo/Script/tutorials/continents_file.py @@ -12,7 +12,7 @@ import vcs, cdms2 as cdms, cdutil, time, os, sys # Open data file: -filepath = os.path.join(sys.prefix, 'sample_data/clt.nc') +filepath = os.path.join(vcs.prefix, 'sample_data/clt.nc') cdmsfile = cdms.open( filepath ) # Extract a 3 dimensional data set and get a subset of the time dimension diff --git a/Packages/demo/Script/tutorials/coord_conv.py b/Packages/demo/Script/tutorials/coord_conv.py index 06f35947e7..4f8e2f6393 100755 --- a/Packages/demo/Script/tutorials/coord_conv.py +++ b/Packages/demo/Script/tutorials/coord_conv.py @@ -28,12 +28,12 @@ import ioapiTools as ioT import sys, os - +import cdat_info ## Setup ## input file iFile = "CCTM_ACONC.D1.001" -iFile = os.path.join (sys.prefix,'sample_data/' + iFile) +iFile = os.path.join (cdat_info.get_prefix(),'sample_data/' + iFile) ## variable of interest varName = "o3" diff --git a/Packages/demo/Script/tutorials/extract_and_plot.py b/Packages/demo/Script/tutorials/extract_and_plot.py index 5a54d3fd50..70c39da113 100644 --- a/Packages/demo/Script/tutorials/extract_and_plot.py +++ b/Packages/demo/Script/tutorials/extract_and_plot.py @@ -12,7 +12,7 @@ import vcs, cdms2 as cdms, cdutil, time, os, sys # Open data file: -filepath = os.path.join(sys.prefix, 'sample_data/ts_da.nc') +filepath = os.path.join(vcs.prefix, 'sample_data/ts_da.nc') cdmsfile = cdms.open( filepath ) # Extract a 3 dimensional data set @@ -49,7 +49,7 @@ v.plot( dc ) # Extract a 4 dimensional dataset -filepath = os.path.join(sys.prefix, 'sample_data/ta_ncep_87-6-88-4.nc') +filepath = os.path.join(vcs.prefix, 'sample_data/ta_ncep_87-6-88-4.nc') cdmsfile = cdms.open( filepath ) data = cdmsfile('ta') diff --git a/Packages/demo/Script/tutorials/eztemplate_legend_horiz_per_row.py b/Packages/demo/Script/tutorials/eztemplate_legend_horiz_per_row.py index 83616500db..d7db7f5715 100644 --- a/Packages/demo/Script/tutorials/eztemplate_legend_horiz_per_row.py +++ b/Packages/demo/Script/tutorials/eztemplate_legend_horiz_per_row.py @@ -4,7 +4,7 @@ import EzTemplate # Open file and retrieve data variable. -fname = os.path.join(sys.prefix, 'sample_data/clt.nc') +fname = os.path.join(vcs.prefix, 'sample_data/clt.nc') cfile = cdms.open(fname) data = cfile('clt') diff --git a/Packages/demo/Script/tutorials/eztemplate_legend_mix_local_global.py b/Packages/demo/Script/tutorials/eztemplate_legend_mix_local_global.py index bd40782346..227c151938 100644 --- a/Packages/demo/Script/tutorials/eztemplate_legend_mix_local_global.py +++ b/Packages/demo/Script/tutorials/eztemplate_legend_mix_local_global.py @@ -4,7 +4,7 @@ import EzTemplate # Open file and retrieve data variable. -fname = os.path.join(sys.prefix, 'sample_data/clt.nc') +fname = os.path.join(vcs.prefix, 'sample_data/clt.nc') cfile = cdms.open(fname) data = cfile('clt') diff --git a/Packages/demo/Script/tutorials/eztemplate_legend_side_each.py b/Packages/demo/Script/tutorials/eztemplate_legend_side_each.py index c654d1b360..d29f10fe70 100644 --- a/Packages/demo/Script/tutorials/eztemplate_legend_side_each.py +++ b/Packages/demo/Script/tutorials/eztemplate_legend_side_each.py @@ -4,7 +4,7 @@ import EzTemplate # Open file and retrieve data variable. -fname = os.path.join(sys.prefix, 'sample_data/clt.nc') +fname = os.path.join(vcs.prefix, 'sample_data/clt.nc') cfile = cdms.open(fname) data = cfile('clt') diff --git a/Packages/demo/Script/tutorials/eztemplate_legend_vert_per_row.py b/Packages/demo/Script/tutorials/eztemplate_legend_vert_per_row.py index 9548b218ca..7235d1bf41 100644 --- a/Packages/demo/Script/tutorials/eztemplate_legend_vert_per_row.py +++ b/Packages/demo/Script/tutorials/eztemplate_legend_vert_per_row.py @@ -4,7 +4,7 @@ import EzTemplate # Open file and retrieve data variable. -fname = os.path.join(sys.prefix, 'sample_data/clt.nc') +fname = os.path.join(vcs.prefix, 'sample_data/clt.nc') cfile = cdms.open(fname) data = cfile('clt') diff --git a/Packages/demo/Script/tutorials/eztemplate_margins_legend_direction.py b/Packages/demo/Script/tutorials/eztemplate_margins_legend_direction.py index c25120ffe0..44d2a1dca3 100644 --- a/Packages/demo/Script/tutorials/eztemplate_margins_legend_direction.py +++ b/Packages/demo/Script/tutorials/eztemplate_margins_legend_direction.py @@ -4,7 +4,7 @@ import EzTemplate # Open file and retrieve data variable. -fname = os.path.join(sys.prefix, 'sample_data/clt.nc') +fname = os.path.join(vcs.prefix, 'sample_data/clt.nc') cfile = cdms.open(fname) data = cfile('clt') diff --git a/Packages/demo/Script/tutorials/eztemplate_margins_legend_thickness.py b/Packages/demo/Script/tutorials/eztemplate_margins_legend_thickness.py index b15e23285a..dc34edaaf8 100644 --- a/Packages/demo/Script/tutorials/eztemplate_margins_legend_thickness.py +++ b/Packages/demo/Script/tutorials/eztemplate_margins_legend_thickness.py @@ -4,7 +4,7 @@ import EzTemplate # Open file and retrieve data variable. -fname = os.path.join(sys.prefix, 'sample_data/clt.nc') +fname = os.path.join(vcs.prefix, 'sample_data/clt.nc') cfile = cdms.open(fname) data = cfile('clt') diff --git a/Packages/demo/Script/tutorials/eztemplate_reverse.py b/Packages/demo/Script/tutorials/eztemplate_reverse.py index bc4f1eadb0..361ff152ab 100644 --- a/Packages/demo/Script/tutorials/eztemplate_reverse.py +++ b/Packages/demo/Script/tutorials/eztemplate_reverse.py @@ -4,7 +4,7 @@ import EzTemplate # Open file and retrieve data variable. -fname = os.path.join(sys.prefix, 'sample_data/clt.nc') +fname = os.path.join(vcs.prefix, 'sample_data/clt.nc') cfile = cdms.open(fname) data = cfile('clt') diff --git a/Packages/demo/Script/tutorials/eztemplate_simple.py b/Packages/demo/Script/tutorials/eztemplate_simple.py index 1482e460f3..e1751a6805 100644 --- a/Packages/demo/Script/tutorials/eztemplate_simple.py +++ b/Packages/demo/Script/tutorials/eztemplate_simple.py @@ -4,7 +4,7 @@ import EzTemplate # Open file and retrieve data variable. -fname = os.path.join(sys.prefix, 'sample_data/clt.nc') +fname = os.path.join(vcs.prefix, 'sample_data/clt.nc') cfile = cdms.open(fname) data = cfile('clt') diff --git a/Packages/demo/Script/tutorials/eztemplate_spacing.py b/Packages/demo/Script/tutorials/eztemplate_spacing.py index 27d4ba1bde..3093a51ff1 100644 --- a/Packages/demo/Script/tutorials/eztemplate_spacing.py +++ b/Packages/demo/Script/tutorials/eztemplate_spacing.py @@ -4,7 +4,7 @@ import EzTemplate # Open file and retrieve data variable. -fname = os.path.join(sys.prefix, 'sample_data/clt.nc') +fname = os.path.join(vcs.prefix, 'sample_data/clt.nc') cfile = cdms.open(fname) data = cfile('clt') diff --git a/Packages/demo/Script/tutorials/global_anomalies.py b/Packages/demo/Script/tutorials/global_anomalies.py index 28b414a4a1..6c724c1daa 100644 --- a/Packages/demo/Script/tutorials/global_anomalies.py +++ b/Packages/demo/Script/tutorials/global_anomalies.py @@ -33,7 +33,7 @@ model_description='' # loop over all models--similar to a fortran do loop for i in range(0,len(model)): - file_xml = os.path.join(sys.prefix,'sample_data/'+var+'_'+model[i]+'.xml') + file_xml = os.path.join(vcs.prefix,'sample_data/'+var+'_'+model[i]+'.xml') a=cdms2.open(file_xml) data=a[var] print '---- ', i, model[i],data.shape @@ -59,7 +59,7 @@ #end_time = cdtime.comptime(1984,12,1) # for i in range(0,len(model)): - file_xml = os.path.join(sys.prefix,'sample_data/'+var+'_'+model[i]+'.xml') + file_xml = os.path.join(vcs.prefix,'sample_data/'+var+'_'+model[i]+'.xml') a=cdms2.open(file_xml) data=a(var,time=(start_time,end_time),squeeze=1) a.close() diff --git a/Packages/demo/Script/tutorials/isofill_file.py b/Packages/demo/Script/tutorials/isofill_file.py index 7761198714..f7b8269f58 100644 --- a/Packages/demo/Script/tutorials/isofill_file.py +++ b/Packages/demo/Script/tutorials/isofill_file.py @@ -3,7 +3,7 @@ import vcs, cdms2 as cdms, cdutil, time, os, sys # Open data file: -filepath = os.path.join(sys.prefix, 'sample_data/clt.nc') +filepath = os.path.join(vcs.prefix, 'sample_data/clt.nc') cdmsfile = cdms.open( filepath ) # Extract a 3 dimensional data set and get a subset of the time dimension diff --git a/Packages/demo/Script/tutorials/isoline_file.py b/Packages/demo/Script/tutorials/isoline_file.py index d0466933c9..7959159853 100644 --- a/Packages/demo/Script/tutorials/isoline_file.py +++ b/Packages/demo/Script/tutorials/isoline_file.py @@ -3,7 +3,7 @@ import vcs, cdms2 as cdms, cdutil, time, os, sys # Open data file: -filepath = os.path.join(sys.prefix, 'sample_data/clt.nc') +filepath = os.path.join(vcs.prefix, 'sample_data/clt.nc') cdmsfile = cdms.open( filepath ) # Extract a 3 dimensional data set and get a subset of the time dimension diff --git a/Packages/demo/Script/tutorials/mask_variable.py b/Packages/demo/Script/tutorials/mask_variable.py index 848fd1bae0..b2d43dc13c 100755 --- a/Packages/demo/Script/tutorials/mask_variable.py +++ b/Packages/demo/Script/tutorials/mask_variable.py @@ -13,14 +13,15 @@ import ioapiTools as ioT import numpy import sys, os +import cdat_info ## Setup ## input file iFile = "CCTM_CONC.D1.001" -iFile = os.path.join (sys.prefix,'sample_data/' + iFile) +iFile = os.path.join (cdat_info.get_prefix(),'sample_data/' + iFile) gridFile = "GRIDCRO2D_D1.001" -gridFile = os.path.join (sys.prefix,'sample_data/' + gridFile) +gridFile = os.path.join (cdat_info.get_prefix(),'sample_data/' + gridFile) ## output file oFile1 = "o3_masked.nc" diff --git a/Packages/demo/Script/tutorials/open_and_plot.py b/Packages/demo/Script/tutorials/open_and_plot.py index ca46285ebf..2709f095e7 100644 --- a/Packages/demo/Script/tutorials/open_and_plot.py +++ b/Packages/demo/Script/tutorials/open_and_plot.py @@ -9,7 +9,7 @@ import cdms2 as cdms, vcs, os, sys # Open data file: -filepath = os.path.join(sys.prefix, 'sample_data/clt.nc') +filepath = os.path.join(vcs.prefix, 'sample_data/clt.nc') cdmsfile = cdms.open( filepath ) cdmsfile.listvariables() data = cdmsfile('clt') diff --git a/Packages/demo/Script/tutorials/orientation_and_output.py b/Packages/demo/Script/tutorials/orientation_and_output.py index b4f4d0ce8c..520f599961 100644 --- a/Packages/demo/Script/tutorials/orientation_and_output.py +++ b/Packages/demo/Script/tutorials/orientation_and_output.py @@ -12,7 +12,7 @@ import vcs, cdms2 as cdms, cdutil, time, os, sys # Open data file: -filepath = os.path.join(sys.prefix, 'sample_data/clt.nc') +filepath = os.path.join(vcs.prefix, 'sample_data/clt.nc') cdmsfile = cdms.open( filepath ) # Extract a 3 dimensional data set diff --git a/Packages/demo/Script/tutorials/output_file.py b/Packages/demo/Script/tutorials/output_file.py index a4ce42a658..4691b70947 100644 --- a/Packages/demo/Script/tutorials/output_file.py +++ b/Packages/demo/Script/tutorials/output_file.py @@ -3,7 +3,7 @@ import vcs, cdms2 as cdms, cdutil, time, os, sys # Open data file: -filepath = os.path.join(sys.prefix, 'sample_data/clt.nc') +filepath = os.path.join(vcs.prefix, 'sample_data/clt.nc') cdmsfile = cdms.open( filepath ) # Extract a 3 dimensional data set and get a subset of the time dimension @@ -37,4 +37,4 @@ v.gs('test.png')# generate ghostscript png output file # generate ghostscript tiff output file -v.gs('test.tif', device = 'tiff24nc', orientation = 'l', resolution = '172.x172.') \ No newline at end of file +v.gs('test.tif', device = 'tiff24nc', orientation = 'l', resolution = '172.x172.') diff --git a/Packages/demo/Script/tutorials/overlay_file.py b/Packages/demo/Script/tutorials/overlay_file.py index dd18f7a127..9c58c91bd0 100644 --- a/Packages/demo/Script/tutorials/overlay_file.py +++ b/Packages/demo/Script/tutorials/overlay_file.py @@ -3,7 +3,7 @@ import vcs, cdms2 as cdms, cdutil, time, os, sys # Open data file: -filepath = os.path.join(sys.prefix, 'sample_data/clt.nc') +filepath = os.path.join(vcs.prefix, 'sample_data/clt.nc') cdmsfile = cdms.open( filepath ) diff --git a/Packages/demo/Script/tutorials/plot_keyword_arguments.py b/Packages/demo/Script/tutorials/plot_keyword_arguments.py index e8a9244b21..81c03e1fb7 100644 --- a/Packages/demo/Script/tutorials/plot_keyword_arguments.py +++ b/Packages/demo/Script/tutorials/plot_keyword_arguments.py @@ -12,7 +12,7 @@ import vcs, cdms2 as cdms, cdutil, time, os, sys # Open data file: -filepath = os.path.join(sys.prefix, 'sample_data/clt.nc') +filepath = os.path.join(vcs.prefix, 'sample_data/clt.nc') cdmsfile = cdms.open( filepath ) # Extract a 3 dimensional data set and get a subset of the time dimension diff --git a/Packages/demo/Script/tutorials/redecorate.py b/Packages/demo/Script/tutorials/redecorate.py index b40d43f27c..d16a98c0ff 100644 --- a/Packages/demo/Script/tutorials/redecorate.py +++ b/Packages/demo/Script/tutorials/redecorate.py @@ -2,7 +2,7 @@ # import needed modules import cdms2, vcs, cdutil, genutil, cdtime, sys, os # get an xml file or just a netcdf file -file = os.path.join(sys.prefix,'sample_data/tas_ccsr-95a.xml') +file = os.path.join(vcs.prefix,'sample_data/tas_ccsr-95a.xml') a=cdms2.open(file) # get the data and print out it's shape diff --git a/Packages/demo/Script/tutorials/regrid_mask_anomaly.py b/Packages/demo/Script/tutorials/regrid_mask_anomaly.py index 6819ffe7fe..f548d00ff3 100644 --- a/Packages/demo/Script/tutorials/regrid_mask_anomaly.py +++ b/Packages/demo/Script/tutorials/regrid_mask_anomaly.py @@ -4,7 +4,7 @@ from regrid2 import Regridder # Open data file -file1 = os.path.join(sys.prefix, 'sample_data/hadcrut2_sample.nc') +file1 = os.path.join(vcs.prefix, 'sample_data/hadcrut2_sample.nc') a = cdms2.open(file1) print a.listvariable() @@ -36,7 +36,7 @@ # Get the ERA40 data for both 2-meter temperature (tas) and ssts (sst) # on original grid -file2 = os.path.join(sys.prefix, 'sample_data/era40_tas_sample.nc') +file2 = os.path.join(vcs.prefix, 'sample_data/era40_tas_sample.nc') b = cdms2.open(file2) # get data print "reading 'tas' data, please wait..." @@ -45,7 +45,7 @@ # close the file b.close() # now get the 'sst' data -file3 = os.path.join(sys.prefix, 'sample_data/era40_sst_sample.nc') +file3 = os.path.join(vcs.prefix, 'sample_data/era40_sst_sample.nc') b = cdms2.open(file3) # get data print "reading 'sst' data, please wait..." @@ -78,7 +78,7 @@ # extract a land/sea mask and regrid it to our desired 5 degree grid # (these data are percent land coverage [0-100]) -file4 = os.path.join(sys.prefix, 'sample_data/geo.1deg.ctl') +file4 = os.path.join(vcs.prefix, 'sample_data/geo.1deg.ctl') c = cdms2.open(file4) fraction=c('sftlf',squeeze=1) c.close() diff --git a/Packages/demo/Script/tutorials/scan_var.py b/Packages/demo/Script/tutorials/scan_var.py index acffe8b7cb..5a97c27c45 100755 --- a/Packages/demo/Script/tutorials/scan_var.py +++ b/Packages/demo/Script/tutorials/scan_var.py @@ -10,6 +10,7 @@ import ioapiTools as ioT from mx import DateTime as D import sys, os +import cdat_info ## Setup @@ -17,7 +18,7 @@ ## potential IOAPI files of interest, ## can use regular expression syntex searchStr = "CCTM_ACONC.D1.*" -searchStr = os.path.join (sys.prefix,'sample_data/' + searchStr) +searchStr = os.path.join (cdat_info.get_prefix(),'sample_data/' + searchStr) ## dates of interest: (year, month, day, hour) date1 = D.DateTime(2001,6,1,6) diff --git a/Packages/demo/Script/tutorials/scatter_file.py b/Packages/demo/Script/tutorials/scatter_file.py index 1bb1305c0b..f2646dce9e 100644 --- a/Packages/demo/Script/tutorials/scatter_file.py +++ b/Packages/demo/Script/tutorials/scatter_file.py @@ -3,7 +3,7 @@ import vcs, cdms2 as cdms, cdutil, time, os, sys # Open data file: -filepath = os.path.join(sys.prefix, 'sample_data/clt.nc') +filepath = os.path.join(vcs.prefix, 'sample_data/clt.nc') cdmsfile = cdms.open( filepath ) # Extract two 3 dimensional data sets and get a subset of the time dimension diff --git a/Packages/demo/Script/tutorials/show_continents.py b/Packages/demo/Script/tutorials/show_continents.py index 63b36bf01b..54df4727a5 100644 --- a/Packages/demo/Script/tutorials/show_continents.py +++ b/Packages/demo/Script/tutorials/show_continents.py @@ -3,7 +3,7 @@ import vcs, cdms2 as cdms, cdutil, time, os, sys # Open data file: -filepath = os.path.join(sys.prefix, 'sample_data/clt.nc') +filepath = os.path.join(vcs.prefix, 'sample_data/clt.nc') cdmsfile = cdms.open( filepath ) # Extract a 3 dimensional data set and get a subset of the time dimension @@ -30,4 +30,4 @@ print "continent_type ", continent_type[i] v.plot(data, continents=i) time.sleep(2) - v.clear() \ No newline at end of file + v.clear() diff --git a/Packages/demo/Script/tutorials/simple_x_y_line_plot.py b/Packages/demo/Script/tutorials/simple_x_y_line_plot.py index 2db1ec338f..4c233ee3e8 100644 --- a/Packages/demo/Script/tutorials/simple_x_y_line_plot.py +++ b/Packages/demo/Script/tutorials/simple_x_y_line_plot.py @@ -12,7 +12,7 @@ import vcs, cdms2 as cdms, cdutil, time, os, sys # Open data file: -filepath = os.path.join(sys.prefix, 'sample_data/clt.nc') +filepath = os.path.join(vcs.prefix, 'sample_data/clt.nc') cdmsfile = cdms.open( filepath ) # Extract a 3 dimensional data set and get a subset of the time dimension diff --git a/Packages/demo/Script/tutorials/skew-t-basic.py b/Packages/demo/Script/tutorials/skew-t-basic.py index 77b9255b19..29ae7c95a5 100644 --- a/Packages/demo/Script/tutorials/skew-t-basic.py +++ b/Packages/demo/Script/tutorials/skew-t-basic.py @@ -9,7 +9,7 @@ ## Now open the sample dataset and reads in the data for temperature as a function of level ## Open the file, read the T -f=cdms.open(os.path.join(sys.prefix,'sample_data','thermo.nc')) +f=cdms.open(os.path.join(vcs.prefix,'sample_data','thermo.nc')) t=f('t') # In this example we need to redefine the the "level" axis on "ta" because it needs to be in Pa diff --git a/Packages/demo/Script/tutorials/skew-t-more.py b/Packages/demo/Script/tutorials/skew-t-more.py index 47b3893da8..1082ff0893 100644 --- a/Packages/demo/Script/tutorials/skew-t-more.py +++ b/Packages/demo/Script/tutorials/skew-t-more.py @@ -52,7 +52,7 @@ ## Now open the sample dataset and reads in the data for temperature as a function of level ## Open the file, read the T -f=cdms.open(os.path.join(sys.prefix,'sample_data','thermo.nc')) +f=cdms.open(os.path.join(vcs.prefix,'sample_data','thermo.nc')) t=f('t') # In this example we need to redefine the the "level" axis on "ta" because it needs to be in Pa diff --git a/Packages/demo/Script/tutorials/skew-t-windbarbs.py b/Packages/demo/Script/tutorials/skew-t-windbarbs.py index 1d006000af..eff0355d1a 100644 --- a/Packages/demo/Script/tutorials/skew-t-windbarbs.py +++ b/Packages/demo/Script/tutorials/skew-t-windbarbs.py @@ -43,7 +43,7 @@ ## Now open the sample dataset and reads in the data for temperature as a function of level ## Open the file, read the T -f=cdms.open(os.path.join(sys.prefix,'sample_data','thermo.nc')) +f=cdms.open(os.path.join(vcs.prefix,'sample_data','thermo.nc')) t=f('t') # In this example we need to redefine the the "level" axis on "ta" because it needs to be in Pa @@ -71,7 +71,7 @@ template.ylabel1.y=template.data.x1*.9 ## Read winds from a file -f=cdms.open(os.path.join(sys.prefix,'sample_data','thermo.nc')) +f=cdms.open(os.path.join(vcs.prefix,'sample_data','thermo.nc')) u=f('ua',time=slice(0,1),longitude=0,latitude=0,squeeze=1) v=f('va',time=slice(0,1),longitude=0,latitude=0,squeeze=1) diff --git a/Packages/demo/Script/tutorials/spatial_subset.py b/Packages/demo/Script/tutorials/spatial_subset.py index ad8358f40a..6f9c57e19f 100755 --- a/Packages/demo/Script/tutorials/spatial_subset.py +++ b/Packages/demo/Script/tutorials/spatial_subset.py @@ -26,12 +26,12 @@ import ioapiTools as ioT import sys, os - +import cdat_info ## Setup ## input file iFile = "CCTM_ACONC.D1.001" -iFile = os.path.join (sys.prefix,'sample_data/' + iFile) +iFile = os.path.join (cdat_info.get_prefix(),'sample_data/' + iFile) ## output files oFile1 = "var_sub1.nc" diff --git a/Packages/demo/Script/tutorials/spinning_earth.py b/Packages/demo/Script/tutorials/spinning_earth.py index 20ddae5ba1..13f2fa6acc 100644 --- a/Packages/demo/Script/tutorials/spinning_earth.py +++ b/Packages/demo/Script/tutorials/spinning_earth.py @@ -9,8 +9,8 @@ import os, sys import cdms2 as cdms,vcs -f=cdms.open(os.path.join(sys.prefix, 'sample_data/tas_mo.nc')) -f1=cdms.open(os.path.join(sys.prefix, 'sample_data/clt.nc')) +f=cdms.open(os.path.join(vcs.prefix, 'sample_data/tas_mo.nc')) +f1=cdms.open(os.path.join(vcs.prefix, 'sample_data/clt.nc')) ## Retrieve 2 years s=f('tas',time=('1980','1982','co'),longitude=(-180,180)) diff --git a/Packages/demo/Script/tutorials/statistics_tutorial.py b/Packages/demo/Script/tutorials/statistics_tutorial.py index 01cf523b91..7887e55530 100644 --- a/Packages/demo/Script/tutorials/statistics_tutorial.py +++ b/Packages/demo/Script/tutorials/statistics_tutorial.py @@ -38,6 +38,8 @@ # First of all let us define our 2 periods of interest # import cdtime +import cdat_info + # # Period 1 with start at 1980 and end at 1985 # @@ -56,7 +58,7 @@ # Let us retrieve data for surface air temperature (tas) # for each of these 2 periods we just defined. # -ncep = os.path.join(sys.prefix, 'sample_data', 'tas_mo.nc') +ncep = os.path.join(cdat_info.get_prefix(), 'sample_data', 'tas_mo.nc') f = cdms2.open(ncep) ncep1 = f('tas', time = (a1, b1, 'co')) diff --git a/Packages/demo/Script/tutorials/template_file.py b/Packages/demo/Script/tutorials/template_file.py index 67b18673b7..d034a36fd0 100644 --- a/Packages/demo/Script/tutorials/template_file.py +++ b/Packages/demo/Script/tutorials/template_file.py @@ -3,7 +3,7 @@ import vcs, cdms2 as cdms, cdutil, time, os, sys # Open data file: -filepath = os.path.join(sys.prefix, 'sample_data/clt.nc') +filepath = os.path.join(vcs.prefix, 'sample_data/clt.nc') cdmsfile = cdms.open( filepath ) # Extract a 3 dimensional data set and get a subset of the time dimension diff --git a/Packages/demo/Script/tutorials/temporal_subset.py b/Packages/demo/Script/tutorials/temporal_subset.py index cd6b9b5070..19bfd82aed 100755 --- a/Packages/demo/Script/tutorials/temporal_subset.py +++ b/Packages/demo/Script/tutorials/temporal_subset.py @@ -21,12 +21,12 @@ import ioapiTools as ioT from mx import DateTime as D -import sys, os +import sys, os, cdat_info ## Setup ## input file iFile = "CCTM_ACONC.D1.001" -iFile = os.path.join (sys.prefix,'sample_data/' + iFile) +iFile = os.path.join (cdat_info.get_prefix(),'sample_data/' + iFile) ## output files oFile1 = "var_tempsub1.nc" diff --git a/Packages/demo/Script/tutorials/test_wk_01.py b/Packages/demo/Script/tutorials/test_wk_01.py index a9b6ec0a76..52e1273690 100644 --- a/Packages/demo/Script/tutorials/test_wk_01.py +++ b/Packages/demo/Script/tutorials/test_wk_01.py @@ -2,16 +2,17 @@ import sys import cdms2 as cdms,WK,MV2 as MV import vcs.test.support +import vcs bg = 0 # vcs.test.support.bg nmonths = 5 ## Getting about nmonths months worth of data W = WK.WK() -f=cdms.open(sys.prefix + "/bin/tutorials/WK/data.nc") +f=cdms.open(vcs.prefix + "/bin/tutorials/WK/data.nc") s=f("rlut",time=slice(0,nmonths*30),latitude=(-15,15)) f.close() -f=cdms.open(sys.prefix + "/bin/tutorials/WK/results.nc") +f=cdms.open(vcs.prefix + "/bin/tutorials/WK/results.nc") ## Process the data, i.e compute spectral wave number and frequencies power = W.process(s) @@ -31,7 +32,7 @@ ## Now tries to do plot this... WP = WK.WKPlot() -WP.x.scriptrun(sys.prefix + "/bin/tutorials/WK/colormap.scr") +WP.x.scriptrun(vcs.prefix + "/bin/tutorials/WK/colormap.scr") WP.x.setcolormap("cmap") print 'Plotting 1' WP.plot_figure1(S,A,bg=bg) diff --git a/Packages/demo/Script/tutorials/vector_file.py b/Packages/demo/Script/tutorials/vector_file.py index f584d55562..945ffb367a 100644 --- a/Packages/demo/Script/tutorials/vector_file.py +++ b/Packages/demo/Script/tutorials/vector_file.py @@ -3,7 +3,7 @@ import vcs, cdms2 as cdms, cdutil, time, os, sys # Open data file: -filepath = os.path.join(sys.prefix, 'sample_data/clt.nc') +filepath = os.path.join(vcs.prefix, 'sample_data/clt.nc') cdmsfile = cdms.open( filepath ) # Extract two 3 dimensional data sets and get a subset of the time dimension diff --git a/Packages/demo/Script/tutorials/vertical_subset.py b/Packages/demo/Script/tutorials/vertical_subset.py index 5b5538113e..a61bb2a013 100755 --- a/Packages/demo/Script/tutorials/vertical_subset.py +++ b/Packages/demo/Script/tutorials/vertical_subset.py @@ -15,11 +15,12 @@ import ioapiTools as ioT from mx import DateTime as D import sys, os +import cdat_info ## Setup ## input file iFile = "CCTM_CONC.D1.001" -iFile = os.path.join (sys.prefix,'sample_data/' + iFile) +iFile = os.path.join (cdat_info.get_prefix(),'sample_data/' + iFile) ## output files oFile1 = "var_vertsub1.nc" diff --git a/Packages/demo/Script/tutorials/write_ioapi.py b/Packages/demo/Script/tutorials/write_ioapi.py index c089b66b4e..c1bc5f68bd 100755 --- a/Packages/demo/Script/tutorials/write_ioapi.py +++ b/Packages/demo/Script/tutorials/write_ioapi.py @@ -9,13 +9,13 @@ import ioapiTools as ioT import sys, os - +import cdat_info ## Setup ## input file iFile = "CCTM_ACONC.D1.001" -iFile = os.path.join (sys.prefix,'sample_data/' + iFile) +iFile = os.path.join (cdat_info.get_prefix(),'sample_data/' + iFile) ## output files oFile1 = "var1.ioapi" diff --git a/Packages/demo/Script/tutorials/write_netCDF.py b/Packages/demo/Script/tutorials/write_netCDF.py index 61370b6a4c..80f2bb64b7 100755 --- a/Packages/demo/Script/tutorials/write_netCDF.py +++ b/Packages/demo/Script/tutorials/write_netCDF.py @@ -10,13 +10,13 @@ import ioapiTools as ioT import sys, os - +import cdat_info ## Setup ## input file iFile = "CCTM_ACONC.D1.001" -iFile = os.path.join (sys.prefix,'sample_data/' + iFile) +iFile = os.path.join (cdat_info.get_prefix(),'sample_data/' + iFile) ## output files oFile1 = "var1.nc" diff --git a/Packages/genutil/Test/test_ascii.py b/Packages/genutil/Test/test_ascii.py index 73353507ab..28e558916e 100644 --- a/Packages/genutil/Test/test_ascii.py +++ b/Packages/genutil/Test/test_ascii.py @@ -1,9 +1,9 @@ -import genutil,sys +import genutil,sys,cdat_info ## Test reading of ascii file organized in columns print 'Testing genutil.ASCII.read_col' try: - vars = genutil.ASCII.read_col(sys.prefix+'/sample_data/test_col.asc',header=4,cskip=1,idrow=True,axis=True) + vars = genutil.ASCII.read_col(cdat_info.get_prefix()+'/sample_data/test_col.asc',header=4,cskip=1,idrow=True,axis=True) except Exception,err: print 'genutil.ASCII: Data reading failed!\nCheck genutil.ASCII\nError message: %s' % err sys.exit(1) @@ -31,7 +31,7 @@ print 'Testing genutil.ASCII.readAscii' try: - vars = genutil.ASCII.readAscii(sys.prefix+'/sample_data/testASCII.asc',header=5) + vars = genutil.ASCII.readAscii(cdat_info.get_prefix()+'/sample_data/testASCII.asc',header=5) except: print 'genutil.ASCII.readAscii error: could not read in data test, check headr keyword?' sys.exit(1) @@ -47,7 +47,7 @@ shapes = [(46,72),(1,2, 80, 97),(46,),(72,)] ids = ['clt','u','latitude','longitude'] try: - vars = genutil.ASCII.readAscii(sys.prefix+'/sample_data/testASCII.asc',header=5,shape=shapes,ids=ids) + vars = genutil.ASCII.readAscii(cdat_info.get_prefix()+'/sample_data/testASCII.asc',header=5,shape=shapes,ids=ids) except Exception,err: print 'genutil.ASCII.readAscii error: could not read in data test\nCheck shape or ids options\nError message was: %s' % err sys.exit(1) diff --git a/Packages/gui_support/Lib/__init__.py b/Packages/gui_support/Lib/__init__.py index 1914612dea..d0f71aa2cf 100644 --- a/Packages/gui_support/Lib/__init__.py +++ b/Packages/gui_support/Lib/__init__.py @@ -15,10 +15,10 @@ def buildDate(): """ Returns the date python was built, and the date VCDAT was built """ - fnm = os.path.join(sys.prefix,'bin','python') + fnm = os.path.join(cdat_info.get_prefix(),'bin','python') a=os.stat(fnm)[8] p=time.asctime(time.localtime(a)) - fnm = os.path.join(sys.prefix,'bin','cdat') + fnm = os.path.join(cdat_info.get_prefix(),'bin','cdat') a=os.stat(fnm)[8] return p, time.asctime(time.localtime(a)) diff --git a/Packages/vcs/Lib/Canvas.py b/Packages/vcs/Lib/Canvas.py index 3ac403eb05..06df910305 100644 --- a/Packages/vcs/Lib/Canvas.py +++ b/Packages/vcs/Lib/Canvas.py @@ -5464,7 +5464,7 @@ def setcontinentstype(self, value): self._continents = os.path.join(os.environ.get("HOME",""),os.environ.get(vcs.getdotdirectory()[1],vcs.getdotdirectory()[0]),"data_continent_%s" % nms[value-1]) if not os.path.exists(self._continents): #fallback on installed with system one - self._continents = os.path.join(sys.prefix,"share","vcs","data_continent_%s" % nms[value-1]) + self._continents = os.path.join(vcs.prefix,"share","vcs","data_continent_%s" % nms[value-1]) else: raise Exception("Error continents value must be file or int < 12") elif isinstance(value,str): @@ -5475,7 +5475,7 @@ def setcontinentstype(self, value): warnings.warn("Continents file not found: %s, substituing with coarse continents" % self._continents) self._continents = os.path.join(os.environ.get("HOME",""),os.environ.get(vcs.getdotdirectory()[1],vcs.getdotdirectory()[0]),"data_continent_coarse") if not os.path.exists(self._continent): - self._continents = os.path.join(sys.prefix,"share","vcs","data_continent_coarse") + self._continents = os.path.join(vcs.prefix,"share","vcs","data_continent_coarse") return ############################################################################# diff --git a/Packages/vcs/Lib/__init__.py b/Packages/vcs/Lib/__init__.py index f1496b305c..ebde96a78b 100755 --- a/Packages/vcs/Lib/__init__.py +++ b/Packages/vcs/Lib/__init__.py @@ -25,6 +25,7 @@ _doValidation = True next_canvas_id = 1 import cdat_info +prefix = cdat_info.get_prefix() cdat_info.pingPCMDIdb("cdat","vcs") import thread import time diff --git a/Packages/vcs/Lib/vcs2vtk.py b/Packages/vcs/Lib/vcs2vtk.py index 0fe6ca382e..30b5a0036f 100644 --- a/Packages/vcs/Lib/vcs2vtk.py +++ b/Packages/vcs/Lib/vcs2vtk.py @@ -11,7 +11,7 @@ import warnings import cdtime -f = open(os.path.join(sys.prefix,"share","vcs","wmo_symbols.json")) +f = open(os.path.join(vcs.prefix,"share","vcs","wmo_symbols.json")) wmo = json.load(f) def applyAttributesFromVCStmpl(tmpl,tmplattribute,txtobj=None): diff --git a/Packages/vcs/Test/port2vtk.py b/Packages/vcs/Test/port2vtk.py index caf43a53b5..e2aa72c056 100644 --- a/Packages/vcs/Test/port2vtk.py +++ b/Packages/vcs/Test/port2vtk.py @@ -111,7 +111,7 @@ import sys,cdms2 -f=cdms2.open(sys.prefix+"/sample_data/clt.nc") +f=cdms2.open(vcs.prefix+"/sample_data/clt.nc") s=f("clt") iso=x.createisofill() x.plot(s,iso) diff --git a/Packages/vcs/Test/testInteractor.py b/Packages/vcs/Test/testInteractor.py index 18c6ee168b..e460bf4127 100644 --- a/Packages/vcs/Test/testInteractor.py +++ b/Packages/vcs/Test/testInteractor.py @@ -3,7 +3,7 @@ import cdms2 import os -f=cdms2.open(os.path.join(sys.prefix,"sample_data","clt.nc")) +f=cdms2.open(os.path.join(vcs.prefix,"sample_data","clt.nc")) s=f("clt",slice(0,1),squeeze=1) x=vcs.init() x.plot(s) diff --git a/Packages/vcs/Test/test_anim_minmax.py b/Packages/vcs/Test/test_anim_minmax.py index 7eea338b80..e3677d25d8 100644 --- a/Packages/vcs/Test/test_anim_minmax.py +++ b/Packages/vcs/Test/test_anim_minmax.py @@ -1,6 +1,6 @@ import sys,cdms2,vcs x=vcs.init() -f=cdms2.open(sys.prefix+"/sample_data/clt.nc") +f=cdms2.open(vcs.prefix+"/sample_data/clt.nc") s=f("clt")#,time=slice(0,3)) x.plot(s) diff --git a/Packages/vcs/Test/test_basic_animation.py b/Packages/vcs/Test/test_basic_animation.py index 37b149ffd9..420bd50f8f 100644 --- a/Packages/vcs/Test/test_basic_animation.py +++ b/Packages/vcs/Test/test_basic_animation.py @@ -10,9 +10,9 @@ i = vtk.vtkRenderWindowInteractor() i.SetRenderWindow(renWin) i.Initialize() -f=cdms2.open(os.path.join(sys.prefix,'sample_data','clt.nc')) +f=cdms2.open(os.path.join(vcs.prefix,'sample_data','clt.nc')) s=f("clt")[:3] -#f=cdms2.open(os.path.join(sys.prefix,"sample_data","sampleCurveGrid4.nc")) +#f=cdms2.open(os.path.join(vcs.prefix,"sample_data","sampleCurveGrid4.nc")) #s=f("sample") x=vcs.init() tmpl = x.createtemplate() diff --git a/Packages/vcs/Test/test_basic_overlay.py b/Packages/vcs/Test/test_basic_overlay.py index 200728904c..5a93ffc585 100644 --- a/Packages/vcs/Test/test_basic_overlay.py +++ b/Packages/vcs/Test/test_basic_overlay.py @@ -10,10 +10,10 @@ i = vtk.vtkRenderWindowInteractor() i.SetRenderWindow(renWin) i.Initialize() -f=cdms2.open(os.path.join(sys.prefix,'sample_data','clt.nc')) +f=cdms2.open(os.path.join(vcs.prefix,'sample_data','clt.nc')) s=f("clt") s2 = f("u") -#f=cdms2.open(os.path.join(sys.prefix,"sample_data","sampleCurveGrid4.nc")) +#f=cdms2.open(os.path.join(vcs.prefix,"sample_data","sampleCurveGrid4.nc")) #s=f("sample") x=vcs.init() x.backgroundcolor = 65*2.55,65*2.55,65*2.55 diff --git a/Packages/vcs/Test/test_basic_polar_plots.py b/Packages/vcs/Test/test_basic_polar_plots.py index 1d151f4a53..b4aa933c76 100644 --- a/Packages/vcs/Test/test_basic_polar_plots.py +++ b/Packages/vcs/Test/test_basic_polar_plots.py @@ -11,7 +11,7 @@ b.projection = p -f=cdms2.open(os.path.join(sys.prefix,"sample_data","clt.nc")) +f=cdms2.open(os.path.join(vcs.prefix,"sample_data","clt.nc")) s=f("clt",slice(0,1),longitude=(0,360),squeeze=1) #s=f("clt",slice(0,1),squeeze=1) diff --git a/Packages/vcs/Test/test_basic_vectors.py b/Packages/vcs/Test/test_basic_vectors.py index cdbc3f3266..fea2f42a8e 100644 --- a/Packages/vcs/Test/test_basic_vectors.py +++ b/Packages/vcs/Test/test_basic_vectors.py @@ -4,7 +4,7 @@ import sys x=vcs.init() -f=cdms2.open(os.path.join(sys.prefix,'sample_data','clt.nc')) +f=cdms2.open(os.path.join(vcs.prefix,'sample_data','clt.nc')) u=f("u") v=f("v") diff --git a/Packages/vcs/Test/test_clear.py b/Packages/vcs/Test/test_clear.py index 8d91c7dc2d..9a2fc6367b 100644 --- a/Packages/vcs/Test/test_clear.py +++ b/Packages/vcs/Test/test_clear.py @@ -5,7 +5,7 @@ import vtk import os -f=cdms2.open(os.path.join(sys.prefix,'sample_data','clt.nc')) +f=cdms2.open(os.path.join(vcs.prefix,'sample_data','clt.nc')) s=f("clt") x=vcs.init() bg = False diff --git a/Packages/vcs/Test/test_contours.py b/Packages/vcs/Test/test_contours.py index 5aa6cda17b..f2cd585959 100644 --- a/Packages/vcs/Test/test_contours.py +++ b/Packages/vcs/Test/test_contours.py @@ -2,7 +2,7 @@ import cdms2 import sys import os -f=cdms2.open(os.path.join(sys.prefix,"sample_data","clt.nc")) +f=cdms2.open(os.path.join(vcs.prefix,"sample_data","clt.nc")) s=f("clt",time=slice(0,1),squeeze=1) print s.shape #s[:23,:36] = 0. diff --git a/Packages/vcs/Test/test_contours_new.py b/Packages/vcs/Test/test_contours_new.py index a3ee2f3872..130c5e8034 100644 --- a/Packages/vcs/Test/test_contours_new.py +++ b/Packages/vcs/Test/test_contours_new.py @@ -4,7 +4,7 @@ import os import MV2 -f=cdms2.open(os.path.join(sys.prefix,"sample_data","clt.nc")) +f=cdms2.open(os.path.join(vcs.prefix,"sample_data","clt.nc")) s=f("clt",time=slice(0,1),squeeze=1) s=MV2.masked_less(s,65.) x=vcs.init() diff --git a/Packages/vcs/Test/test_dv3d-1.py b/Packages/vcs/Test/test_dv3d-1.py index 80a2a91abb..e0d4540de0 100644 --- a/Packages/vcs/Test/test_dv3d-1.py +++ b/Packages/vcs/Test/test_dv3d-1.py @@ -39,7 +39,7 @@ class DataType: print "Reading variable %s in dataset %s " % ( varname, datasetPath ) -# f = cdms2.open( os.path.join( sys.prefix, "sample_data", "geos5-sample.nc") ) +# f = cdms2.open( os.path.join( vcs.prefix, "sample_data", "geos5-sample.nc") ) # u = f["uwnd"] # dv3d = vcs.create3d_scalar('hoffmuller','xyt') diff --git a/Packages/vcs/Test/test_dv3d.py b/Packages/vcs/Test/test_dv3d.py index 7354d2791e..caa3592d31 100644 --- a/Packages/vcs/Test/test_dv3d.py +++ b/Packages/vcs/Test/test_dv3d.py @@ -38,7 +38,7 @@ class DataType: # print "Reading variable %s in dataset %s " % ( varname, datasetPath ) -# f = cdms2.open( os.path.join( sys.prefix, "sample_data", "geos5-sample.nc") ) +# f = cdms2.open( os.path.join( vcs.prefix, "sample_data", "geos5-sample.nc") ) # u = f["uwnd"] # dv3d = vcs.create3d_scalar('hoffmuller','xyt') diff --git a/Packages/vcs/Test/test_dv3d_vectors.py b/Packages/vcs/Test/test_dv3d_vectors.py index df7692a919..fcc32cc6b0 100644 --- a/Packages/vcs/Test/test_dv3d_vectors.py +++ b/Packages/vcs/Test/test_dv3d_vectors.py @@ -33,7 +33,7 @@ class DataType: else: - f = cdms2.open( os.path.join( sys.prefix, "sample_data", "geos5-sample.nc") ) + f = cdms2.open( os.path.join( vcs.prefix, "sample_data", "geos5-sample.nc") ) u = f["uwnd"] v = f["vwnd"] diff --git a/Packages/vcs/Test/test_isofill2.py b/Packages/vcs/Test/test_isofill2.py index 97223da239..47c51957d3 100644 --- a/Packages/vcs/Test/test_isofill2.py +++ b/Packages/vcs/Test/test_isofill2.py @@ -1,7 +1,7 @@ import vcs import cdms2 import sys -f=cdms2.open(sys.prefix+"/sample_data/clt.nc") +f=cdms2.open(vcs.prefix+"/sample_data/clt.nc") s=f("clt",time=slice(0,1),squeeze=1) x=vcs.init() x.scriptrun("Test/isoleg.scr") diff --git a/Packages/vcs/Test/test_line_plot.py b/Packages/vcs/Test/test_line_plot.py index 6e60bf9b61..6286061c8e 100644 --- a/Packages/vcs/Test/test_line_plot.py +++ b/Packages/vcs/Test/test_line_plot.py @@ -1,6 +1,7 @@ import cdms2 import sys -f=cdms2.open(sys.prefix+"/sample_data/clt.nc") +import cdat_info +f=cdms2.open(cdat_info.get_prefix()+"/sample_data/clt.nc") s=f("clt",latitude=(45,45,'cob'),longitude=(10,10,'cob'),squeeze=1) print s.shape diff --git a/Packages/vcs/Test/test_none_no_getsize.py b/Packages/vcs/Test/test_none_no_getsize.py index 49400750f4..583e4a0686 100644 --- a/Packages/vcs/Test/test_none_no_getsize.py +++ b/Packages/vcs/Test/test_none_no_getsize.py @@ -9,7 +9,7 @@ import cdms2 import sys -f=cdms2.open(os.path.join(sys.prefix,"sample_data","clt.nc")) +f=cdms2.open(os.path.join(vcs.prefix,"sample_data","clt.nc")) s=f("clt",latitude=(45,45,"cob"),longitude=(23,23,"cob"),squeeze=1) #s+=100. x.plot(s,y) diff --git a/Packages/vcs/Test/test_open_close.py b/Packages/vcs/Test/test_open_close.py index 32ab975eeb..e8a2c8a04b 100644 --- a/Packages/vcs/Test/test_open_close.py +++ b/Packages/vcs/Test/test_open_close.py @@ -4,7 +4,7 @@ import vtk import os -f=cdms2.open(os.path.join(sys.prefix,'sample_data','clt.nc')) +f=cdms2.open(os.path.join(vcs.prefix,'sample_data','clt.nc')) s=f("clt") x=vcs.init() x.open() diff --git a/installation/control.py b/installation/control.py index f4019a8e09..a44589c91f 100644 --- a/installation/control.py +++ b/installation/control.py @@ -59,7 +59,7 @@ "Packages/esg", "Packages/ncml", "Packages/DV3D", - "Packages/vcs", + "Packages/vcs", "Packages/vcsaddons", "Packages/cdutil", "Packages/unidata", diff --git a/installation/standard.py b/installation/standard.py index 90d22d5dbb..4041e18297 100644 --- a/installation/standard.py +++ b/installation/standard.py @@ -71,7 +71,7 @@ action['setup.py'] = 'PATH=%s/bin:$PATH %s setup.py install --prefix=%s ; ' \ % (sys.exec_prefix, sys.executable, target_prefix) install_script_path = os.path.join(libcdms_dir, 'install_script') -action['install_script'] = install_script_path + ' %s %s ; ' % (target_prefix, sys.exec_prefix) +action['install_script'] = install_script_path + ' %s %s ; ' % (target_prefix, sys.executable) for k in ['makefile','Makefile','MAKEFILE']: action[k] = make_code + " PYPREFIX='%s' PREFIX='%s' install ; " % (sys.exec_prefix,target_prefix) action['autogen.sh'] = "autogen.sh ; ./configure --prefix=%s --with-python=%s ; make -j1 ; make -j1 install ;" % (os.environ.get("EXTERNALS",os.path.join(sys.prefix,'Externals')), os.path.join(sys.exec_prefix,'bin','python')) diff --git a/libcdms/cdms.sh b/libcdms/cdms.sh index e6e8838201..cc84377f7c 100755 --- a/libcdms/cdms.sh +++ b/libcdms/cdms.sh @@ -83,26 +83,28 @@ if (test ! -d $1/man) then mkdir --parents $1/man/man3 fi PREFIX=$1; +echo "argv[1] = $1" +echo "argv[2] = $2" if (test "$2" = "" ) then - PYPREFIX=${PREFIX} + PYTHON_EXECUTABLE="${PREFIX}/bin/python" else - PYPREFIX=`(cd $2;pwd)` + PYTHON_EXECUTABLE="$2" fi echo "prefix" ${PREFIX} -echo "pyprefix" ${PYPREFIX} +echo "PYTHON_EXECUTABLE" ${PYTHON_EXECUTABLE} /bin/rm -fr ${PREFIX}/lib/libcdms.a ${PREFIX}/include/cdms -CDMS_INCLUDE_DRS=`${PYPREFIX}/bin/python -c "import sys, os;sys.path.insert(0,os.path.join('${PREFIX}','lib','python%i.%i' % sys.version_info[:2],'site-packages')) ; import cdat_info;print cdat_info.CDMS_INCLUDE_DRS,"` -CDMS_INCLUDE_HDF=`${PYPREFIX}/bin/python -c "import sys, os;sys.path.insert(0,os.path.join('${PREFIX}','lib','python%i.%i' % sys.version_info[:2],'site-packages')) ; import cdat_info;print cdat_info.CDMS_INCLUDE_HDF,"` -#CDMS_LIBRARY_HDF5=`${PYPREFIX}/bin/python -c "import sys, os;sys.path.insert(0,os.path.join('${PREFIX}','lib','python%i.%i' % sys.version_info[:2],'site-packages')) ; import cdat_info;print cdat_info.CDMS_LIBRARY_HDF5,"` -CDMS_INCLUDE_PP=`${PYPREFIX}/bin/python -c "import sys, os;sys.path.insert(0,os.path.join('${PREFIX}','lib','python%i.%i' % sys.version_info[:2],'site-packages')) ; import cdat_info;print cdat_info.CDMS_INCLUDE_PP,"` -CDMS_INCLUDE_QL=`${PYPREFIX}/bin/python -c "import sys, os;sys.path.insert(0,os.path.join('${PREFIX}','lib','python%i.%i' % sys.version_info[:2],'site-packages')) ; import cdat_info;print cdat_info.CDMS_INCLUDE_QL,"` -drs_file=`${PYPREFIX}/bin/python -c "import cdat_info;print cdat_info.drs_file,"` -#CDMS_INCLUDE_DAP=`${PYPREFIX}/bin/python -c "import sys, os;sys.path.insert(0,os.path.join('${PREFIX}','lib','python%i.%i' % sys.version_info[:2],'site-packages')) ; import cdat_info;print cdat_info.CDMS_INCLUDE_DAP,"` -#CDMS_DAP_DIR=`${PYPREFIX}/bin/python -c "import sys, os;sys.path.insert(0,os.path.join('${PREFIX}','lib','python%i.%i' % sys.version_info[:2],'site-packages')) ; import cdat_info;print cdat_info.CDMS_DAP_DIR,"` -CDMS_HDF_DIR=`${PYPREFIX}/bin/python -c "import sys, os;sys.path.insert(0,os.path.join('${PREFIX}','lib','python%i.%i' % sys.version_info[:2],'site-packages')) ; import cdat_info;print cdat_info.CDMS_HDF_DIR,"` -CDMS_GRIB2LIB_DIR=`${PYPREFIX}/bin/python -c "import sys, os;sys.path.insert(0,os.path.join('${PREFIX}','lib','python%i.%i' % sys.version_info[:2],'site-packages')) ; import cdat_info;print cdat_info.CDMS_GRIB2LIB_DIR,"` -netcdf_directory=`${PYPREFIX}/bin/python -c "import sys, os;sys.path.insert(0,os.path.join('${PREFIX}','lib','python%i.%i' % sys.version_info[:2],'site-packages')) ; import cdat_info;print cdat_info.netcdf_directory,"` -netcdf_include_directory=`${PYPREFIX}/bin/python -c "import sys, os;sys.path.insert(0,os.path.join('${PREFIX}','lib','python%i.%i' % sys.version_info[:2],'site-packages')) ; import cdat_info;print cdat_info.netcdf_include_directory,"` +CDMS_INCLUDE_DRS=`${PYTHON_EXECUTABLE} -c "import sys, os;sys.path.insert(0,os.path.join('${PREFIX}','lib','python%i.%i' % sys.version_info[:2],'site-packages')) ; import cdat_info;print cdat_info.CDMS_INCLUDE_DRS,"` +CDMS_INCLUDE_HDF=`${PYTHON_EXECUTABLE} -c "import sys, os;sys.path.insert(0,os.path.join('${PREFIX}','lib','python%i.%i' % sys.version_info[:2],'site-packages')) ; import cdat_info;print cdat_info.CDMS_INCLUDE_HDF,"` +#CDMS_LIBRARY_HDF5=`${PYTHON_EXECUTABLE} -c "import sys, os;sys.path.insert(0,os.path.join('${PREFIX}','lib','python%i.%i' % sys.version_info[:2],'site-packages')) ; import cdat_info;print cdat_info.CDMS_LIBRARY_HDF5,"` +CDMS_INCLUDE_PP=`${PYTHON_EXECUTABLE} -c "import sys, os;sys.path.insert(0,os.path.join('${PREFIX}','lib','python%i.%i' % sys.version_info[:2],'site-packages')) ; import cdat_info;print cdat_info.CDMS_INCLUDE_PP,"` +CDMS_INCLUDE_QL=`${PYTHON_EXECUTABLE} -c "import sys, os;sys.path.insert(0,os.path.join('${PREFIX}','lib','python%i.%i' % sys.version_info[:2],'site-packages')) ; import cdat_info;print cdat_info.CDMS_INCLUDE_QL,"` +drs_file=`${PYTHON_EXECUTABLE} -c "import cdat_info;print cdat_info.drs_file,"` +#CDMS_INCLUDE_DAP=`${PYTHON_EXECUTABLE} -c "import sys, os;sys.path.insert(0,os.path.join('${PREFIX}','lib','python%i.%i' % sys.version_info[:2],'site-packages')) ; import cdat_info;print cdat_info.CDMS_INCLUDE_DAP,"` +#CDMS_DAP_DIR=`${PYTHON_EXECUTABLE} -c "import sys, os;sys.path.insert(0,os.path.join('${PREFIX}','lib','python%i.%i' % sys.version_info[:2],'site-packages')) ; import cdat_info;print cdat_info.CDMS_DAP_DIR,"` +CDMS_HDF_DIR=`${PYTHON_EXECUTABLE} -c "import sys, os;sys.path.insert(0,os.path.join('${PREFIX}','lib','python%i.%i' % sys.version_info[:2],'site-packages')) ; import cdat_info;print cdat_info.CDMS_HDF_DIR,"` +CDMS_GRIB2LIB_DIR=`${PYTHON_EXECUTABLE} -c "import sys, os;sys.path.insert(0,os.path.join('${PREFIX}','lib','python%i.%i' % sys.version_info[:2],'site-packages')) ; import cdat_info;print cdat_info.CDMS_GRIB2LIB_DIR,"` +netcdf_directory=`${PYTHON_EXECUTABLE} -c "import sys, os;sys.path.insert(0,os.path.join('${PREFIX}','lib','python%i.%i' % sys.version_info[:2],'site-packages')) ; import cdat_info;print cdat_info.netcdf_directory,"` +netcdf_include_directory=`${PYTHON_EXECUTABLE} -c "import sys, os;sys.path.insert(0,os.path.join('${PREFIX}','lib','python%i.%i' % sys.version_info[:2],'site-packages')) ; import cdat_info;print cdat_info.netcdf_include_directory,"` netcdf_library_directory=${netcdf_directory}/lib echo "${libcdms_dir}/configure --srcdir=${libcdms_dir} --enable-dap=${CDMS_INCLUDE_DAP} --enable-drs=${CDMS_INCLUDE_DRS} --enable-hdf=${CDMS_INCLUDE_HDF} --enable-pp=${CDMS_INCLUDE_PP} --enable-ql=${CDMS_INCLUDE_QL} --cache-file=/dev/null --prefix=${PREFIX} --with-nclib=${netcdf_library_directory} --with-ncinc=${netcdf_include_directory} --with-daplib=${CDMS_DAP_DIR}/lib --with-dapinc=${CDMS_DAP_DIR}/include --with-hdfinc=${CDMS_HDF_DIR}/include --with-hdflib=${CDMS_HDF_DIR}/lib --with-hdf5lib=${CDMS_LIBRARY_HDF5} --with-grib2lib=${CDMS_GRIB2LIB_DIR}/lib --with-jasperlib=${CDMS_GRIB2LIB_DIR}/lib --with-grib2inc=${CDMS_GRIB2LIB_DIR}/include --enable-grib2 " #./configure --enable-dap=${CDMS_INCLUDE_DAP} --enable-drs=${CDMS_INCLUDE_DRS} --enable-hdf=${CDMS_INCLUDE_HDF} --enable-pp=${CDMS_INCLUDE_PP} --enable-ql=${CDMS_INCLUDE_QL} --cache-file=/dev/null --prefix=${PREFIX} --with-nclib=${netcdf_library_directory} --with-ncinc=${netcdf_include_directory} --with-daplib=${CDMS_DAP_DIR}/lib --with-dapinc=${CDMS_DAP_DIR}/include --with-hdfinc=${CDMS_HDF_DIR}/include --with-hdflib=${CDMS_HDF_DIR}/lib --with-hdf5lib=${CDMS_LIBRARY_HDF5} --with-grib2lib=${CDMS_GRIB2LIB_DIR}/lib --with-jasperlib=${CDMS_GRIB2LIB_DIR}/lib --with-grib2inc=${CDMS_GRIB2LIB_DIR}/include --enable-grib2 || exit 1 diff --git a/testing/cdms2/CMakeLists.txt b/testing/cdms2/CMakeLists.txt index a6ea43694e..9e0a3dfb06 100644 --- a/testing/cdms2/CMakeLists.txt +++ b/testing/cdms2/CMakeLists.txt @@ -2,122 +2,122 @@ # cdms2 tests add_test("test_ascontiguous_regrid_nan_issue" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/cdms2/test_ascontiguous_regrid_nan_issue.py ) add_test("test_dim_unlimited" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/cdms2/test_dim_unlimited.py TestCDATLite) add_test("CDMS_Test_01" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/cdms2/cdtest01.py) add_test("CDMS_Test_02" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/cdms2/cdtest02.py) add_test("CDMS_Test_03" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/cdms2/cdtest03.py) add_test("CDMS_Test_04" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/cdms2/cdtest04.py) add_test("CDMS_Test_05" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/cdms2/cdtest05.py) add_test("CDMS_Test_06" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/cdms2/cdtest06.py) add_test("CDMS_Test_07" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/cdms2/cdtest07.py) add_test("CDMS_Test_08" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/cdms2/cdtest08.py) add_test("CDMS_Test_09" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/cdms2/cdtest09.py) add_test("CDMS_Test_10" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/cdms2/cdtest10.py) add_test("CDMS_Test_11" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/cdms2/cdtest11.py) add_test("CDMS_Test_12" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/cdms2/cdtest12.py) add_test("CDMS_Test_13" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/cdms2/cdtest13.py) add_test("CDMS_Test_14" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/cdms2/cdtest14.py) add_test("CDMS_Test_15" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/cdms2/cdtest15.py) add_test("CDMS_Test_16" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/cdms2/cdtest16.py) add_test("CDMS_Test_17" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/cdms2/cdtest17.py) add_test("CDMS_Test_18" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/cdms2/cdtest18.py) if(CDAT_DOWNLOAD_SAMPLE_DATA) add_test("CDMS_Test_JSON" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/cdms2/test_dump_load_jsn.py) endif() add_test("CDMS_Test_multiple_formats" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/cdms2/test_all_formats.py) add_test("CDMS_Test_write_compressed" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/cdms2/test_compression.py) add_test("CDMS_Test_Aurore" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/cdms2/test_aurore.py) add_test("CDMS_Test_setting_bad_cal" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/cdms2/test_cal_bug.py) add_test("CDMS_Test_detecting_axes_type" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/cdms2/test_isLatLonLevTim.py) add_test("CDMS_Test_pack" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/cdms2/test_pack_data.py) add_test("CDMS_asdatetime" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/cdms2/test_cdms2_axis_as_datetime.py) add_test("test_cdms2_full_averagering_full_missing" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/cdms2/test_full_averaging.py ) diff --git a/testing/cdms2/cdtest17.py b/testing/cdms2/cdtest17.py index f85f526899..cc2059adf8 100644 --- a/testing/cdms2/cdtest17.py +++ b/testing/cdms2/cdtest17.py @@ -1,6 +1,6 @@ -import sys,cdms2 +import sys,cdms2,cdat_info print 'Test 17: Slicing and keeping dims ...', -f=cdms2.open(sys.prefix+'/sample_data/clt.nc') +f=cdms2.open(cdat_info.get_prefix()+'/sample_data/clt.nc') s=f("clt") s0=s[0] assert s0.getAxis(0).isLatitude() == True diff --git a/testing/cdms2/cdtest19.py b/testing/cdms2/cdtest19.py index 40709edf3f..7ec9f6eddc 100644 --- a/testing/cdms2/cdtest19.py +++ b/testing/cdms2/cdtest19.py @@ -5,6 +5,7 @@ import cdms2, os, numpy import cdms2.forecast import cdms2.tvariable +import cdat_info from markError import NTIME,NLAT,NLON,x,clearError,markError,reportError clearError() @@ -42,7 +43,7 @@ f2.close() f3.close() -os.system(sys.prefix+"/bin/cdscan -q --forecast -x 'test_fc.xml' test_fc?") +os.system(cdat_info.get_prefix()+"/bin/cdscan -q --forecast -x 'test_fc.xml' test_fc?") # Read in the data. diff --git a/testing/cdms2/test_dump_load_jsn.py b/testing/cdms2/test_dump_load_jsn.py index 28f6ff0393..c1223ff7ea 100644 --- a/testing/cdms2/test_dump_load_jsn.py +++ b/testing/cdms2/test_dump_load_jsn.py @@ -1,5 +1,5 @@ -import cdms2,sys,numpy -f=cdms2.open(sys.prefix+"/sample_data/clt.nc") +import cdms2,sys,numpy,cdat_info +f=cdms2.open(cdat_info.get_prefix()+"/sample_data/clt.nc") s=f("clt") jsn = s.dumps() diff --git a/testing/cdutil/CMakeLists.txt b/testing/cdutil/CMakeLists.txt index 3defce3ed2..359550bf22 100644 --- a/testing/cdutil/CMakeLists.txt +++ b/testing/cdutil/CMakeLists.txt @@ -2,52 +2,52 @@ # cdutil tests add_test("test_departures_time_bounds" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/cdutil/test_dep_bounds.py TestCDATLite) if(CDAT_DOWNLOAD_SAMPLE_DATA) add_test("test_VariablesMatcher_1" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/cdutil/test_VariablesMatcher_1.py) add_test("test_VariablesMatcher_2" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/cdutil/test_VariablesMatcher_2.py) add_test("test_VariablesMatcher_3" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/cdutil/test_VariablesMatcher_3.py) add_test("test_averager" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/cdutil/test_averager.py) add_test("test_daily_bounds" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/cdutil/test_daily_bounds.py) add_test("test_gen_mask" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/cdutil/test_gen_mask.py) add_test("test_keep_missing_value" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/cdutil/test_keep_missing_value.py) add_test("test_missing_season" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/cdutil/test_missing_season.py) add_test("test_sftbyrgn" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/cdutil/test_sftbyrgn.py) add_test("test_times" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/cdutil/test_times.py) add_test("test_times_2" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/cdutil/test_times_2.py) add_test("test_times_3" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/cdutil/test_times_3.py) add_test("test_vert" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/cdutil/test_vert.py) add_test("test_years" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/cdutil/test_years.py) endif() diff --git a/testing/cdutil/test_VariablesMatcher_1.py b/testing/cdutil/test_VariablesMatcher_1.py index 9b283e8626..2f4ce638d7 100755 --- a/testing/cdutil/test_VariablesMatcher_1.py +++ b/testing/cdutil/test_VariablesMatcher_1.py @@ -1,13 +1,13 @@ #!/usr/bin/env python -import cdutil,os,sys,numpy -ref = os.path.join(sys.prefix,'sample_data','tas_dnm-95a.xml') +import cdutil,os,sys,numpy,cdat_info +ref = os.path.join(cdat_info.get_prefix(),'sample_data','tas_dnm-95a.xml') # Reference Ref=cdutil.VariableConditioner(ref) Ref.var='tas' Ref.id='JONES'# optional # Test -tst = os.path.join(sys.prefix,'sample_data','tas_ccsr-95a.xml') +tst = os.path.join(cdat_info.get_prefix(),'sample_data','tas_ccsr-95a.xml') Tst=cdutil.VariableConditioner(tst) Tst.var='tas' Tst.id='NCEP' #optional diff --git a/testing/cdutil/test_VariablesMatcher_2.py b/testing/cdutil/test_VariablesMatcher_2.py index eb05534430..53a67629d3 100755 --- a/testing/cdutil/test_VariablesMatcher_2.py +++ b/testing/cdutil/test_VariablesMatcher_2.py @@ -3,20 +3,20 @@ """In this example we now retrieve NCEP and ECMWF for the year 1981, mask the land on their grid and apply an external data mask (the JONES variable). Finally the variables are once again put on the 10x10 grid where we apply a mask. Try not apply the mask on the final grid and note the difference (tip: to do so, simply change the definition of FG to: FG=cdutil.MaskedGridMaker() ) """ -import cdutil,os,sys,numpy +import cdutil,os,sys,numpy,cdat_info # First let's creates the mask (it is the same for NCEP and ECMWF since they are on the same grid). -refmsk = os.path.join(sys.prefix,'sample_data','sftlf_dnm.nc') +refmsk = os.path.join(cdat_info.get_prefix(),'sample_data','sftlf_dnm.nc') M=cdutil.WeightsMaker(refmsk, var='sftlf_dnm', values=[1.]) # Reference -ref = os.path.join(sys.prefix,'sample_data','tas_dnm-95a.xml') +ref = os.path.join(cdat_info.get_prefix(),'sample_data','tas_dnm-95a.xml') Ref=cdutil.VariableConditioner(ref, weightsMaker=M) Ref.var='tas' Ref.id='D1' Ref.cdmsKeywords={'time':('1979','1980','co')} # Test -tstmsk = os.path.join(sys.prefix,'sample_data','sftlf_ccsr.nc') +tstmsk = os.path.join(cdat_info.get_prefix(),'sample_data','sftlf_ccsr.nc') M=cdutil.WeightsMaker(tstmsk, var='sftlf_ccsr', values=[1.]) -tst = os.path.join(sys.prefix,'sample_data','tas_ccsr-95a.xml') +tst = os.path.join(cdat_info.get_prefix(),'sample_data','tas_ccsr-95a.xml') Tst=cdutil.VariableConditioner(tst, weightsMaker=M) Tst.var='tas' Tst.id='D2' diff --git a/testing/cdutil/test_VariablesMatcher_3.py b/testing/cdutil/test_VariablesMatcher_3.py index a53e7ace36..e2a223414f 100755 --- a/testing/cdutil/test_VariablesMatcher_3.py +++ b/testing/cdutil/test_VariablesMatcher_3.py @@ -10,12 +10,13 @@ """ import cdutil, MV2 as MV, os,sys +import cdat_info # First let's create the mask (it is the same for NCEP and ECMWF since they are on the same grid) -refmsk = os.path.join(sys.prefix,'sample_data','sftlf_dnm.nc') +refmsk = os.path.join(cdat_info.get_prefix(),'sample_data','sftlf_dnm.nc') M=cdutil.WeightsMaker(refmsk, var='sftlf_dnm', values=[1.]) # Reference -ref = os.path.join(sys.prefix,'sample_data','tas_dnm-95a.xml') +ref = os.path.join(cdat_info.get_prefix(),'sample_data','tas_dnm-95a.xml') Ref=cdutil.VariableConditioner(ref, weightsMaker=M) Ref.var='tas' Ref.id='ECMWF' @@ -33,7 +34,7 @@ Ref.weightedGridMaker=ECMWFGrid # Test -tstmsk = os.path.join(sys.prefix,'sample_data','sftlf_ccsr.nc') +tstmsk = os.path.join(cdat_info.get_prefix(),'sample_data','sftlf_ccsr.nc') M=cdutil.WeightsMaker(tstmsk, var='sftlf_ccsr', values=[1.]) tst = os.path.join(cdutil.__path__[0],'..','..','..','..','sample_data','tas_ccsr-95a.xml') Tst=cdutil.VariableConditioner(tst, weightsMaker=M) @@ -69,7 +70,7 @@ def myMakeMask(array, range): # Final Grid # We need a mask for the final grid -fgmask=os.path.join(sys.prefix,'sample_data','sftlf_10x10.nc') +fgmask=os.path.join(cdat_info.get_prefix(),'sample_data','sftlf_10x10.nc') M2=cdutil.WeightsMaker(source=fgmask, var='sftlf', values=[100.]) FG=cdutil.WeightedGridMaker(weightsMaker=M2) FG.longitude.n=36 diff --git a/testing/cdutil/test_averager.py b/testing/cdutil/test_averager.py index ff04160cef..11f51acf96 100644 --- a/testing/cdutil/test_averager.py +++ b/testing/cdutil/test_averager.py @@ -1,9 +1,9 @@ # Adapted for numpy/ma/cdms2 by convertcdms.py """This is a set of tests for averager - which can be used to calculate area weighted averages.""" -import cdms2, MV2, numpy, numpy.ma, cdtime, os, sys +import cdms2, MV2, numpy, numpy.ma, cdtime, os, sys, cdat_info from cdutil import area_weights, averager, AveragerError cdms2.setAutoBounds('on') -f=cdms2.open(os.path.join(sys.prefix,'sample_data','tas_ukmo_con.nc')) +f=cdms2.open(os.path.join(cdat_info.get_prefix(),'sample_data','tas_ukmo_con.nc')) x = f('tas') ans = averager(x, axis='yt', weights = ['weighted','equal'], combinewts=1) ans = averager(x, axis='yt', weights = ['weighted','equal'], combinewts=1) @@ -163,7 +163,7 @@ # # The values in this file were calculated using old routines in CDAT2.4 # -fcheck = cdms2.open(os.path.join(sys.prefix,'sample_data','tas_gavg_rnl_ecm.nc')) +fcheck = cdms2.open(os.path.join(cdat_info.get_prefix(),'sample_data','tas_gavg_rnl_ecm.nc')) start = cdtime.componenttime(1979, 1, 1) end = cdtime.componenttime(1979, 12, 1) correct = fcheck('tas', time=(start, end)) @@ -172,7 +172,7 @@ # The source for the averages in the above file is the raw data in the file below. # The difference in units (degrees C and degrees K) should be the obvious answer. # -f = cdms2.open(os.path.join(sys.prefix,'sample_data','tas_ecm_1979.nc')) +f = cdms2.open(os.path.join(cdat_info.get_prefix(),'sample_data','tas_ecm_1979.nc')) # # I can invoke averager by passing the f('tas') as the variable instead of first extracting @@ -230,7 +230,7 @@ # # This test is to verify the action='sum' option # -tasm_file = os.path.join(sys.prefix,'sample_data','tas_cru_1979.nc') +tasm_file = os.path.join(cdat_info.get_prefix(),'sample_data','tas_cru_1979.nc') ftasm = cdms2.open(tasm_file) xtasm = ftasm('tas') @@ -250,7 +250,7 @@ # # Real world Averager Test #2 # -newf = cdms2.open(os.path.join(sys.prefix,'sample_data','clt.nc')) +newf = cdms2.open(os.path.join(cdat_info.get_prefix(),'sample_data','clt.nc')) u = newf('u') u2 = averager(u, axis='1') u3 = averager(u, axis='(plev)') diff --git a/testing/cdutil/test_daily_bounds.py b/testing/cdutil/test_daily_bounds.py index 038d05178c..5822546695 100644 --- a/testing/cdutil/test_daily_bounds.py +++ b/testing/cdutil/test_daily_bounds.py @@ -1,9 +1,9 @@ #!/usr/bin/env python # Adapted for numpy/ma/cdms2 by convertcdms.py -import cdms2,cdutil,os,sys,numpy +import cdms2,cdutil,os,sys,numpy,cdat_info ## Test 6h data -f=cdms2.open(os.path.join(sys.prefix,'sample_data','psl_6h.nc')) +f=cdms2.open(os.path.join(cdat_info.get_prefix(),'sample_data','psl_6h.nc')) s=f('psl') t=s.getTime() @@ -22,7 +22,7 @@ [ 42., 48.]]))) ## test daily -f=cdms2.open(os.path.join(sys.prefix,'sample_data','ts_da.nc')) +f=cdms2.open(os.path.join(cdat_info.get_prefix(),'sample_data','ts_da.nc')) s=f('ts') t=s.getTime() print 'daily data, before:' diff --git a/testing/cdutil/test_gen_mask.py b/testing/cdutil/test_gen_mask.py index 5755486e27..8b8c51c63a 100644 --- a/testing/cdutil/test_gen_mask.py +++ b/testing/cdutil/test_gen_mask.py @@ -1,15 +1,15 @@ -import cdms2,sys,cdutil,os +import cdms2,sys,cdutil,os,cdat_info -f=cdms2.open(os.path.join(sys.prefix,"sample_data","navy_land.nc")) +f=cdms2.open(os.path.join(cdat_info.get_prefix(),"sample_data","navy_land.nc")) navy_frac = f("sftlf")/100. -target = cdms2.open(os.path.join(sys.prefix,'sample_data','clt.nc'))("clt",slice(0,1)).getGrid() +target = cdms2.open(os.path.join(cdat_info.get_prefix(),'sample_data','clt.nc'))("clt",slice(0,1)).getGrid() mask = cdutil.generateLandSeaMask(target,navy_frac) -target = cdms2.open(os.path.join(sys.prefix,'sample_data','clt.nc'))("clt",slice(0,1)) +target = cdms2.open(os.path.join(cdat_info.get_prefix(),'sample_data','clt.nc'))("clt",slice(0,1)) mask = cdutil.generateLandSeaMask(target,navy_frac) target=cdms2.createGaussianGrid(64) mask = cdutil.generateLandSeaMask(target) -target = cdms2.open(os.path.join(sys.prefix,'sample_data','clt.nc'))("clt",slice(0,1),latitude=(15,85),longitude=(-175,-65)).getGrid() +target = cdms2.open(os.path.join(cdat_info.get_prefix(),'sample_data','clt.nc'))("clt",slice(0,1),latitude=(15,85),longitude=(-175,-65)).getGrid() mask = cdutil.generateLandSeaMask(target) #import vcs diff --git a/testing/cdutil/test_keep_missing_value.py b/testing/cdutil/test_keep_missing_value.py index d41e15dc03..db7d04052d 100644 --- a/testing/cdutil/test_keep_missing_value.py +++ b/testing/cdutil/test_keep_missing_value.py @@ -3,8 +3,9 @@ import MV2 import cdutil import numpy +import cdat_info -f=cdms2.open(sys.prefix+"/sample_data/clt.nc") +f=cdms2.open(cdat_info.get_prefix()+"/sample_data/clt.nc") s=f("clt") assert(numpy.allclose(s.missing_value,1.e20)) s.set_fill_value(1.e36) diff --git a/testing/cdutil/test_missing_season.py b/testing/cdutil/test_missing_season.py index 8d8f871bd7..11ca5a8976 100644 --- a/testing/cdutil/test_missing_season.py +++ b/testing/cdutil/test_missing_season.py @@ -1,6 +1,6 @@ -import cdms2,cdutil,sys,MV2,numpy,os +import cdms2,cdutil,sys,MV2,numpy,os,cdat_info -f=cdms2.open(os.path.join(sys.prefix,'sample_data','clt.nc')) +f=cdms2.open(os.path.join(cdat_info.get_prefix(),'sample_data','clt.nc')) s=f("clt") cdutil.setTimeBoundsMonthly(s) diff --git a/testing/cdutil/test_sftbyrgn.py b/testing/cdutil/test_sftbyrgn.py index a28ff97e56..811691316a 100644 --- a/testing/cdutil/test_sftbyrgn.py +++ b/testing/cdutil/test_sftbyrgn.py @@ -10,9 +10,9 @@ Newsftbyrgn """ -import cdms2,cdutil,MV2,os,sys +import cdms2,cdutil,MV2,os,sys,cdat_info bg=0 -din=cdms2.open(os.path.join(sys.prefix,"sample_data","clt.nc"))("clt",slice(0,1)) +din=cdms2.open(os.path.join(cdat_info.get_prefix(),"sample_data","clt.nc"))("clt",slice(0,1)) print 'generating mask' sftlf = cdutil.generateLandSeaMask(din)*100. diff --git a/testing/cdutil/test_times.py b/testing/cdutil/test_times.py index 2bea6ab824..bc170f5ae8 100644 --- a/testing/cdutil/test_times.py +++ b/testing/cdutil/test_times.py @@ -8,8 +8,8 @@ cdms2.setAutoBounds('on') -f = cdms2.open(os.path.join(sys.prefix,'sample_data','tas_mo.nc')) -fsc = cdms2.open(os.path.join(sys.prefix,'sample_data','tas_mo_clim.nc')) +f = cdms2.open(os.path.join(vcs.prefix,'sample_data','tas_mo.nc')) +fsc = cdms2.open(os.path.join(vcs.prefix,'sample_data','tas_mo_clim.nc')) print "Step #0 : Reading data" s=f(var,longitude=(0,360,'co')) @@ -28,7 +28,7 @@ a=cdtime.comptime(1980) b=cdtime.comptime(1980,5) -f = cdms2.open(os.path.join(sys.prefix,'sample_data','tas_6h.nc')) +f = cdms2.open(os.path.join(vcs.prefix,'sample_data','tas_6h.nc')) s=f(var,time=(a,b,'co'),squeeze=1) print "Test #2 : 6hourly AND get" diff --git a/testing/cdutil/test_times_2.py b/testing/cdutil/test_times_2.py index a402236f84..03eaf0c548 100644 --- a/testing/cdutil/test_times_2.py +++ b/testing/cdutil/test_times_2.py @@ -1,5 +1,5 @@ # Adapted for numpy/ma/cdms2 by convertcdms.py -import cdms2,cdutil,numpy.ma, MV2, os, sys +import cdms2,cdutil,numpy.ma, MV2, os, sys, cdat_info cdms2.setAutoBounds('on') # centroid test @@ -25,7 +25,7 @@ print 'Centroid Normal:',cdutil.times.centroid(a,[0,365]) print 'Centroid Cyclic:',cdutil.times.cyclicalcentroid(a,[0,365]) -f=cdms2.open(os.path.join(sys.prefix,'sample_data','tas_mo.nc')) +f=cdms2.open(os.path.join(cdat_info.get_prefix(),'sample_data','tas_mo.nc')) s=f('tas') cdutil.setTimeBoundsMonthly(s) diff --git a/testing/cdutil/test_times_3.py b/testing/cdutil/test_times_3.py index 5e8d6682bb..24c898159f 100644 --- a/testing/cdutil/test_times_3.py +++ b/testing/cdutil/test_times_3.py @@ -1,9 +1,9 @@ #!/usr/bin/env python # Adapted for numpy/ma/cdms2 by convertcdms.py -import cdms2,cdutil,os,sys +import cdms2,cdutil,os,sys,cdat_info -f=cdms2.open(os.path.join(sys.prefix,'sample_data','tas_mo.nc')) +f=cdms2.open(os.path.join(cdat_info.get_prefix(),'sample_data','tas_mo.nc')) s=f('tas') tc=s.getTime().asComponentTime() diff --git a/testing/cdutil/test_vert.py b/testing/cdutil/test_vert.py index b1fc8bc643..319783c91d 100644 --- a/testing/cdutil/test_vert.py +++ b/testing/cdutil/test_vert.py @@ -2,12 +2,12 @@ # Adapted for numpy/ma/cdms2 by convertcdms.py -import cdutil +import cdutil,cdat_info import cdms2 as cdms,vcs,sys,os bg = 0 -f = cdms.open(os.path.join(sys.prefix,'sample_data','vertical.nc')) +f = cdms.open(os.path.join(cdat_info.get_prefix(),'sample_data','vertical.nc')) Ps=f('PS') U=f('U') B=f('hybm') diff --git a/testing/cdutil/test_years.py b/testing/cdutil/test_years.py index 56a6ed37d9..0b89461969 100755 --- a/testing/cdutil/test_years.py +++ b/testing/cdutil/test_years.py @@ -1,10 +1,10 @@ #!/usr/bin/env python # Adapted for numpy/ma/cdms2 by convertcdms.py -import cdms2,cdutil,sys,os,numpy +import cdms2,cdutil,sys,os,numpy,cdat_info cdms2.setAutoBounds('on') -f = cdms2.open(os.path.join(sys.prefix,'sample_data','th_yr.nc')) +f = cdms2.open(os.path.join(cdat_info.get_prefix(),'sample_data','th_yr.nc')) th=f('th',time=slice(-3,None,1)) t=th.getTime() diff --git a/testing/dv3d/CMakeLists.txt b/testing/dv3d/CMakeLists.txt index 23b07b13bb..e8caf01561 100644 --- a/testing/dv3d/CMakeLists.txt +++ b/testing/dv3d/CMakeLists.txt @@ -1,7 +1,7 @@ set(BASELINE_DIR "${UVCDAT_GIT_TESTDATA_DIR}/baselines/dv3d") add_test(dv3d_slider_test - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/dv3d/dv3d_execute_test.py 'dv3d_slider_test' '${BASELINE_DIR}' @@ -9,7 +9,7 @@ add_test(dv3d_slider_test add_test(dv3d_volume_test - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/dv3d/dv3d_execute_test.py 'dv3d_volume_test' '${BASELINE_DIR}' @@ -17,7 +17,7 @@ add_test(dv3d_volume_test add_test(dv3d_surface_test - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/dv3d/dv3d_execute_test.py 'dv3d_surface_test' '${BASELINE_DIR}' @@ -25,7 +25,7 @@ add_test(dv3d_surface_test add_test(dv3d_constituents_test - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/dv3d/dv3d_execute_test.py 'dv3d_constituents_test' '${BASELINE_DIR}' @@ -33,7 +33,7 @@ add_test(dv3d_constituents_test add_test(dv3d_hovmoller_test - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/dv3d/dv3d_execute_test.py 'dv3d_hovmoller_test' '${BASELINE_DIR}' diff --git a/testing/dv3d/TestManager.py b/testing/dv3d/TestManager.py index fd670e2ae1..fa6fa7ca4d 100644 --- a/testing/dv3d/TestManager.py +++ b/testing/dv3d/TestManager.py @@ -73,7 +73,7 @@ def __init__( self, name, **args ): self.image_name = os.path.join( self.test_dir, 'images', '.'.join( [ self.name, 'png' ] ) ) filename = args.get( 'file', DefaultSampleFile ) self.varnames = args.get( 'vars', [ DefaultSampleVar ] ) - self.file_path = os.path.join( sys.prefix, "sample_data", filename ) + self.file_path = os.path.join( vcs.prefix, "sample_data", filename ) self.file = cdms2.open( self.file_path ) self.roi = args.get( 'roi', None ) self.ptype = args.get( 'type', 'scalar' ) @@ -141,7 +141,7 @@ def update_image(self): def writeCMakeDef( self, f ): f.write( "add_test(%s\n" % self.name ) - f.write( " ${CMAKE_INSTALL_PREFIX}/bin/python\n" ) + f.write( " \"${PYTHON_EXECUTABLE}\"\n" ) f.write( " ${cdat_SOURCE_DIR}/testing/dv3d/dv3d_execute_test.py\n" ) f.write( " '%s'\n" % self.name ) f.write( " '${BASELINE_DIR}'\n" ) diff --git a/testing/metrics/CMakeLists.txt b/testing/metrics/CMakeLists.txt index ec5962433e..c5580fcc14 100644 --- a/testing/metrics/CMakeLists.txt +++ b/testing/metrics/CMakeLists.txt @@ -1,14 +1,14 @@ # test from VCS, example of a graphics test #add_test(vcs_verify_hurricane_marker -# ${CMAKE_INSTALL_PREFIX}/bin/python +# "${PYTHON_EXECUTABLE}" # ${cdat_SOURCE_DIR}/testing/vcs/test_vcs_hurricane_marker.py # ${cdat_SOURCE_DIR}/testing/vcs/test_vcs_hurricane_marker.png #) # test from CDMS2, example of a test script #add_test("CDMS_Test_01" -# ${CMAKE_INSTALL_PREFIX}/bin/python +# "${PYTHON_EXECUTABLE}" # ${cdat_SOURCE_DIR}/testing/cdms2/cdtest01.py) add_test("diags_test_01" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/metrics/diagtest01.py ${UVCMETRICS_TEST_DATA_DIRECTORY} ) diff --git a/testing/regrid/CMakeLists.txt b/testing/regrid/CMakeLists.txt index fadfa75656..a5b0b94ca6 100644 --- a/testing/regrid/CMakeLists.txt +++ b/testing/regrid/CMakeLists.txt @@ -2,213 +2,213 @@ # regridding tests added by Alex Pletzer, Tech-X, pletzer@txcorp.com add_test("test177_regrid_mask" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/test177_regrid_mask.py) if (EXISTS "${CMAKE_INSTALL_PREFIX}/bin/mpiexec") add_test("testMPIGrid" "${CMAKE_INSTALL_PREFIX}/bin/mpiexec" "-n" "1" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testMPIGrid.py) add_test("testAccuracy" "${CMAKE_INSTALL_PREFIX}/bin/mpiexec" "-n" "1" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testAccuracy.py) add_test("testMarvel" "${CMAKE_INSTALL_PREFIX}/bin/mpiexec" "-n" "1" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testMarvel.py) add_test("testUnits" "${CMAKE_INSTALL_PREFIX}/bin/mpiexec" "-n" "1" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testUnits.py) add_test("testRaynaud" "${CMAKE_INSTALL_PREFIX}/bin/mpiexec" "-n" "1" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testRaynaud.py) add_test("testDateline" "${CMAKE_INSTALL_PREFIX}/bin/mpiexec" "-n" "1" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testDateline.py) add_test("testEsmfInit4Pes" "${CMAKE_INSTALL_PREFIX}/bin/mpiexec" "-n" "4" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testEsmfInit.py) add_test("testImports" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testImports.py) add_test("testDiag" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testDiag.py) add_test("testSo2TasACCESSFails" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testSo2TasACCESSFails.py) add_test("testSo2Tas" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testSo2Tas.py) if(CDAT_DOWNLOAD_SAMPLE_DATA) add_test("testWrite" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testWrite.py ${CMAKE_INSTALL_DIR}/sample_data) endif() add_test("testMvCdmsRegrid" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testMvCdmsRegrid.py) add_test("testLibCFLevelAndTime" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testLibCFLevelAndTime.py) add_test("testMpi10Pes" "${CMAKE_INSTALL_PREFIX}/bin/mpiexec" "-n" "10" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testMpi.py) add_test("testRemoteGet8Pes" "${CMAKE_INSTALL_PREFIX}/bin/mpiexec" "-n" "8" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testRemoteGet.py) add_test("testUnstructGrid" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testUnstructGrid.py) add_test("testConserv" "${CMAKE_INSTALL_PREFIX}/bin/mpiexec" "-n" "1" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testConserv.py) add_test("testEsmfVsLibcf" "${CMAKE_INSTALL_PREFIX}/bin/mpiexec" "-n" "1" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testEsmfVsLibcf.py) add_test("testEsmfInterface1" "${CMAKE_INSTALL_PREFIX}/bin/mpiexec" "-n" "1" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testEsmfInterface.py) add_test("testEsmfInterface2Pes" "${CMAKE_INSTALL_PREFIX}/bin/mpiexec" "-n" "2" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testEsmfInterface.py) add_test("testDistArray6Pes" "${CMAKE_INSTALL_PREFIX}/bin/mpiexec" "-n" "6" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testDistArray.py) add_test("testGhostedDistArray6Pes" "${CMAKE_INSTALL_PREFIX}/bin/mpiexec" "-n" "6" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testGhostedDistArray.py) add_test("testDistTransientVar6Pes" "${CMAKE_INSTALL_PREFIX}/bin/mpiexec" "-n" "6" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testDistTransientVar.py) add_test("testEsmfGridToMeshRegridCsrv" "${CMAKE_INSTALL_PREFIX}/bin/mpiexec" "-n" "2" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testEsmfGridToMeshRegridCsrv.py) if (CDAT_BUILD_PARALLEL) add_test("testEsmf3DSmallNative" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testEsmf3DSmallNative.py) add_test("testEsmf3DSmallNative2Pes" "${CMAKE_INSTALL_PREFIX}/bin/mpiexec" "-n" "2" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testEsmf3DSmallNative.py) endif (CDAT_BUILD_PARALLEL) add_test("testEsmf3DSmallesmf" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testEsmf3DSmallesmf.py) add_test("testEsmf3DSmallesmf2Pes" "${CMAKE_INSTALL_PREFIX}/bin/mpiexec" "-n" "2" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testEsmf3DSmallesmf.py) add_test("testGridTypes" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testGridTypes.py) add_test("testEsmfSmall" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testEsmfSmall.py) add_test("testEsmfSmall2Pes" "${CMAKE_INSTALL_PREFIX}/bin/mpiexec" "-n" "2" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testEsmfSmall.py) add_test("testEsmfSmall4Pes" "${CMAKE_INSTALL_PREFIX}/bin/mpiexec" "-n" "4" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testEsmfSmall.py) add_test("testEsmfSmall8Pes" "${CMAKE_INSTALL_PREFIX}/bin/mpiexec" "-n" "8" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testEsmfSmall.py) add_test("testTasRegrid" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testTasRegrid.py) add_test("testTasRegrid2Pes" "${CMAKE_INSTALL_PREFIX}/bin/mpiexec" "-n" "2" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testTasRegrid.py) add_test("testCltRegrid" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testCltRegrid.py) #temporarily disabled #add_test("testCltRegrid2Pes" # "${CMAKE_INSTALL_PREFIX}/bin/mpiexec" "-n" "2" -# ${CMAKE_INSTALL_PREFIX}/bin/python +# "${PYTHON_EXECUTABLE}" # ${cdat_SOURCE_DIR}/testing/regrid/testCltRegrid.py) add_test("testRegrid2" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testRegrid2.py) add_test("testRegrid2Tool" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testRegrid2Tool.py) add_test("testEsmf_3x4_6x8_Conserve" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testEsmf_3x4_6x8_Conserve.py) add_test("testEsmf_3x4_6x8_Bilinear" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testEsmf_3x4_6x8_Bilinear.py) add_test("testEsmf_3x4_6x8_Conserve_Masked" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testEsmf_3x4_6x8_Conserve_Masked.py) add_test("testEsmf_3x4_6x8_Bilinear_Masked" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testEsmf_3x4_6x8_Bilinear_Masked.py) add_test("testMvGenericRegrid" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testMvGenericRegrid.py) add_test("testSalinity" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testSalinity.py) add_test("testEsmfSalinity" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testEsmfSalinity.py) add_test("testEsmfSalinity2Pes" "${CMAKE_INSTALL_PREFIX}/bin/mpiexec" "-n" "2" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testEsmfSalinity.py) add_test("testEsmfSalinity4Pes" "${CMAKE_INSTALL_PREFIX}/bin/mpiexec" "-n" "4" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testEsmfSalinity.py) add_test("testEsmfSalinity8Pes" "${CMAKE_INSTALL_PREFIX}/bin/mpiexec" "-n" "8" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testEsmfSalinity.py) #add_test("testRegridEsmfMpi8Pes" # "${CMAKE_INSTALL_PREFIX}/bin/mpiexec" "-n" "8" -# ${CMAKE_INSTALL_PREFIX}/bin/python +# "${PYTHON_EXECUTABLE}" # ${cdat_SOURCE_DIR}/testing/regrid/testRegridEsmfMpi.py) add_test("testEsmf" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testEsmf.py) add_test("testBergman" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testBergman.py) add_test("testDistSrc" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testDistSrc.py) add_test("testDistSrc4Pes" "${CMAKE_INSTALL_PREFIX}/bin/mpiexec" "-n" "4" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testDistSrc.py) add_test("testReverseOrderInterp" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testReverseOrderInterp.py) else() @@ -216,116 +216,116 @@ else() # if mpiexec is not found, run only the serial tests add_test("testMPIGrid" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testMPIGrid.py) add_test("testAccuracy" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testAccuracy.py) add_test("testMarvel" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testMarvel.py) add_test("testUnits" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testUnits.py) add_test("testRaynaud" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testRaynaud.py) add_test("testDateline" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testDateline.py) add_test("testImports" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testImports.py) add_test("testDiag" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testDiag.py) add_test("testSo2TasACCESSFails" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testSo2TasACCESSFails.py) add_test("testSo2Tas" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testSo2Tas.py) add_test("testWrite" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testWrite.py ${CMAKE_INSTALL_DIR}/sample_data) add_test("testMvCdmsRegrid" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testMvCdmsRegrid.py) add_test("testLibCFLevelAndTime" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testLibCFLevelAndTime.py) add_test("testUnstructGrid" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testUnstructGrid.py) add_test("testConserv" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testConserv.py) add_test("testEsmfVsLibcf" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testEsmfVsLibcf.py) add_test("testEsmfInterface1" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testEsmfInterface.py) add_test("testEsmfGridToMeshRegridCsrv" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testEsmfGridToMeshRegridCsrv.py) add_test("testEsmf3DSmallesmf" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testEsmf3DSmallesmf.py) add_test("testEsmf3DSmallesmf" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testEsmf3DSmallesmf.py) add_test("testGridTypes" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testGridTypes.py) add_test("testEsmfSmall" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testEsmfSmall.py) add_test("testTasRegrid" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testTasRegrid.py) add_test("testCltRegrid" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testCltRegrid.py) add_test("testRegrid2" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testRegrid2.py) add_test("testRegrid2Tool" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testRegrid2Tool.py) add_test("testEsmf_3x4_6x8_Conserve" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testEsmf_3x4_6x8_Conserve.py) add_test("testEsmf_3x4_6x8_Bilinear" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testEsmf_3x4_6x8_Bilinear.py) add_test("testEsmf_3x4_6x8_Conserve_Masked" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testEsmf_3x4_6x8_Conserve_Masked.py) add_test("testEsmf_3x4_6x8_Bilinear_Masked" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testEsmf_3x4_6x8_Bilinear_Masked.py) add_test("testMvGenericRegrid" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testMvGenericRegrid.py) add_test("testSalinity" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testSalinity.py) add_test("testEsmfSalinity" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testEsmfSalinity.py) add_test("testEsmf" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testEsmf.py) add_test("testBergman" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testBergman.py) add_test("testDistSrc" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testDistSrc.py) add_test("testReverseOrderInterp" - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/regrid/testReverseOrderInterp.py) endif() diff --git a/testing/regrid/openCreateData.py b/testing/regrid/openCreateData.py index cc5aefc489..292d3e2384 100644 --- a/testing/regrid/openCreateData.py +++ b/testing/regrid/openCreateData.py @@ -9,15 +9,15 @@ import sys sys.path.append('../cdat_tests') -import cdms2 +import cdms2,cdat_info import regrid2 import os import numpy as np import ESMP home = os.getenv("HOME") + "/" -install_prefix = sys.prefix + '/' -sample_data_dir = sys.prefix + '/sample_data/' +install_prefix = cdat_info.get_prefix() + '/' +sample_data_dir = cdat_info.get_prefix() + '/sample_data/' class dataNoPeri: def __init__(self, nx, ny, xCrdLimits, yCrdLimits): diff --git a/testing/regrid/test177_regrid_mask.py b/testing/regrid/test177_regrid_mask.py index bb5765c1ac..4d6a332139 100644 --- a/testing/regrid/test177_regrid_mask.py +++ b/testing/regrid/test177_regrid_mask.py @@ -1,7 +1,7 @@ -import cdms2 +import cdms2,cdat_info import MV2 import sys -f = cdms2.open(sys.prefix + "/sample_data/clt.nc") +f = cdms2.open(cdat_info.get_prefix() + "/sample_data/clt.nc") s = f('clt') S2 = MV2.masked_greater(s, 87) G = cdms2.createGaussianGrid(22) diff --git a/testing/regrid/testAccuracy.py b/testing/regrid/testAccuracy.py index c3aabd5b34..9387009855 100644 --- a/testing/regrid/testAccuracy.py +++ b/testing/regrid/testAccuracy.py @@ -6,6 +6,7 @@ import cdms2 import numpy import sys +import vcs PLOT = False if PLOT: @@ -20,7 +21,7 @@ def test0(self): """ One way interpolation """ - fnm = sys.prefix + '/sample_data/clt.nc' + fnm = vcs.prefix + '/sample_data/clt.nc' f = cdms2.open(fnm) s=f("clt") @@ -65,7 +66,7 @@ def Xtest1(self): Forward/backward interpolation """ - fnm=sys.prefix+'/sample_data/clt.nc' + fnm=vcs.prefix+'/sample_data/clt.nc' f=cdms2.open(fnm) s=f("clt") diff --git a/testing/regrid/testBergman.py b/testing/regrid/testBergman.py index 03dbbdc685..dc4c336494 100644 --- a/testing/regrid/testBergman.py +++ b/testing/regrid/testBergman.py @@ -1,6 +1,6 @@ import unittest import cdms2 as cdms -import cdutil, string, os +import cdutil, string, os, cdat_info from genutil import statistics import numpy import ESMP @@ -32,7 +32,7 @@ def getRef(var): obs_pathi = string.replace(obs_path,'VAR',var) print obs_pathi ref = getRef(var) - obs_path_full = sys.prefix + '/sample_data/' + \ + obs_path_full = cdat_info.get_prefix() + '/sample_data/' + \ var + '_' + ref + '_000001-000012_ac.nc' print obs_path_full fobs = cdms.open(obs_path_full) @@ -46,7 +46,7 @@ def getRef(var): mods = ('mpi_echam5',) for mod in mods: - mod_path = sys.prefix + '/sample_data/' + \ + mod_path = cdat_info.get_prefix() + '/sample_data/' + \ var + '_' + mod + '_1980-1999_ac.nc' fmod = cdms.open(mod_path) dmod = fmod(var) diff --git a/testing/regrid/testCNRMGrid.py b/testing/regrid/testCNRMGrid.py index 5a7429ddf8..cafc6df26e 100644 --- a/testing/regrid/testCNRMGrid.py +++ b/testing/regrid/testCNRMGrid.py @@ -4,6 +4,7 @@ $Id: testCNRMGrid.py 2472 2012-10-12 13:10:52Z pletzer $ """ +import cdat_info import cdms2 import numpy import ESMP @@ -49,7 +50,7 @@ def _getCorners(coordBounds): class TestGrid(unittest.TestCase): def setUp(self): - filename = sys.prefix + \ + filename = cdat_info.get_prefix() + \ "/sample_data/so_Omon_CNRM-CM5_decadal2004_r9i1p1_200501-201412_2timesteps.nc" g = cdms2.open(filename) self.so = g('so')[0,0,...] @@ -73,7 +74,7 @@ def Xtest2(self): Using the native ESMP interface """ import scipy.io.netcdf - filename = (sys.prefix + \ + filename = (cdat_info.get_prefix() + \ "/sample_data/so_Omon_CNRM-CM5_decadal2004_r9i1p1_200501-201412_2timesteps.nc") srcF = scipy.io.netcdf.netcdf_file(filename) so = srcF.variables['so'][0, 0,...] diff --git a/testing/regrid/testCltRegrid.py b/testing/regrid/testCltRegrid.py index 17489c6a09..8ecc1113a0 100644 --- a/testing/regrid/testCltRegrid.py +++ b/testing/regrid/testCltRegrid.py @@ -1,3 +1,4 @@ +import cdat_info import cdms2 import numpy import unittest @@ -19,7 +20,7 @@ def Xtest1(self): """ 2D """ - u = cdms2.open(sys.prefix + '/sample_data/clt.nc')('u')[0, 0,...] + u = cdms2.open(cdat_info.get_prefix() + '/sample_data/clt.nc')('u')[0, 0,...] uInterp = u.regrid( u.getGrid() ) n = reduce(lambda x,y: x*y, uInterp.shape) diff = abs(numpy.sum(u - uInterp))/float(n) @@ -33,7 +34,7 @@ def Xtest2(self): """ 2D + time """ - u = cdms2.open(sys.prefix + '/sample_data/clt.nc')('u')[:, 0,...] + u = cdms2.open(cdat_info.get_prefix() + '/sample_data/clt.nc')('u')[:, 0,...] uInterp = u.regrid( u.getGrid() ) self.assertEqual(numpy.isnan(u).sum(), 0) self.assertEqual(numpy.isnan(uInterp).sum(), 0) @@ -47,7 +48,7 @@ def test3(self): 2D + level """ print 'This is a known failure for now. ESMF are looking into the error' - u = cdms2.open(sys.prefix + '/sample_data/clt.nc')('u')[0, :,...] + u = cdms2.open(cdat_info.get_prefix() + '/sample_data/clt.nc')('u')[0, :,...] uCart = u.regrid( u.getGrid(), regridTool='esmf', regridMethod='linear', coordSys = 'cart', @@ -104,7 +105,7 @@ def Xtest4(self): """ 2D + level + time """ - u = cdms2.open(sys.prefix + 'sample_data/clt.nc')('u')[:, :,...] + u = cdms2.open(cdat_info.get_prefix() + '/sample_data/clt.nc')('u')[:, :,...] uInterp = u.regrid( u.getGrid(), regridTool='esmf', regridMethod='linear', coordSys = 'cart', diff --git a/testing/regrid/testConserv.py b/testing/regrid/testConserv.py index fd183869c2..03021464b9 100644 --- a/testing/regrid/testConserv.py +++ b/testing/regrid/testConserv.py @@ -7,6 +7,7 @@ import operator import numpy +import cdat_info import cdms2 import regrid2.esmf import regrid2 @@ -26,11 +27,11 @@ def setUp(self): def test_2d_esmf_native(self): print 'running test_2d_esmf_native...' - f = cdms2.open(sys.prefix + \ + f = cdms2.open(cdat_info.get_prefix() + \ '/sample_data/so_Omon_ACCESS1-0_historical_r1i1p1_185001-185412_2timesteps.nc') so = f('so')[0, 0, :, :] - clt = cdms2.open(sys.prefix + '/sample_data/clt.nc')('clt')[0, :, :] + clt = cdms2.open(cdat_info.get_prefix() + '/sample_data/clt.nc')('clt')[0, :, :] cltBounds = clt.getGrid().getBounds() tic = time.time() @@ -245,10 +246,10 @@ def test_2d_esmf_native(self): def test_2d_esmf_conserv(self): print 'running test_2d_esmf_conserv...' - f = cdms2.open(sys.prefix + \ + f = cdms2.open(cdat_info.get_prefix() + \ '/sample_data/so_Omon_ACCESS1-0_historical_r1i1p1_185001-185412_2timesteps.nc') so = f('so')[0, 0, :, :] - clt = cdms2.open(sys.prefix + '/sample_data/clt.nc')('clt')[0, :, :] + clt = cdms2.open(cdat_info.get_prefix() + '/sample_data/clt.nc')('clt')[0, :, :] tic = time.time() soInterp = so.regrid(clt.getGrid(), regridTool='ESMF', regridMethod='Conservative') soInterpInterp = soInterp.regrid(so.getGrid(), regridTool='ESMF', diff --git a/testing/regrid/testDateline.py b/testing/regrid/testDateline.py index 6ff07aa4dc..e9c0432ee1 100644 --- a/testing/regrid/testDateline.py +++ b/testing/regrid/testDateline.py @@ -1,3 +1,4 @@ +import cdat_info import cdms2 import numpy import unittest @@ -17,8 +18,8 @@ def setUp(self): pass def test1_regrid(self): - clt = cdms2.open(sys.prefix + '/sample_data/clt.nc')('clt')[0,...] - ta = cdms2.open(sys.prefix + '/sample_data/ta_ncep_87-6-88-4.nc')('ta')[0, 0,...] + clt = cdms2.open(cdat_info.get_prefix() + '/sample_data/clt.nc')('clt')[0,...] + ta = cdms2.open(cdat_info.get_prefix() + '/sample_data/ta_ncep_87-6-88-4.nc')('ta')[0, 0,...] diag = {} cltInterp = clt.regrid( ta.getGrid(), regridTool = 'libcf', diff --git a/testing/regrid/testDiag.py b/testing/regrid/testDiag.py index f26c322c7d..513db53d48 100644 --- a/testing/regrid/testDiag.py +++ b/testing/regrid/testDiag.py @@ -7,6 +7,7 @@ import re import numpy +import cdat_info import cdms2 import regrid2 import unittest @@ -26,10 +27,10 @@ def setUp(self): pass def Xtest1_libcf(self): - srcF = cdms2.open(sys.prefix + \ + srcF = cdms2.open(cdat_info.get_prefix() + \ '/sample_data/so_Omon_ACCESS1-0_historical_r1i1p1_185001-185412_2timesteps.nc') so = srcF('so')[0, 0, ...] - clt = cdms2.open(sys.prefix + '/sample_data/clt.nc')('clt') + clt = cdms2.open(cdat_info.get_prefix() + '/sample_data/clt.nc')('clt') diag = {'numValid': None, 'numDstPoints': None} soInterp = so.regrid(clt.getGrid(), regridTool = 'libcf', @@ -52,10 +53,10 @@ def Xtest1_libcf(self): def test2_varRegrid(self): print print 'test2_varRegrid' - srcF = cdms2.open(sys.prefix + \ + srcF = cdms2.open(cdat_info.get_prefix() + \ '/sample_data/so_Omon_ACCESS1-0_historical_r1i1p1_185001-185412_2timesteps.nc') so = srcF('so')[0, 0, ...] - clt = cdms2.open(sys.prefix + '/sample_data/clt.nc')('clt') + clt = cdms2.open(cdat_info.get_prefix() + '/sample_data/clt.nc')('clt') diag = {'srcAreas': None, 'dstAreas': None, 'srcAreaFractions': None, 'dstAreaFractions': None} soInterp = so.regrid(clt.getGrid(), @@ -87,10 +88,10 @@ def test2_varRegrid(self): def Xtest3_esmf(self): print print 'test3_esmf' - srcF = cdms2.open(sys.prefix + \ + srcF = cdms2.open(cdat_info.get_prefix() + \ '/sample_data/so_Omon_ACCESS1-0_historical_r1i1p1_185001-185412_2timesteps.nc') so = srcF('so')[0, 0, ...] - clt = cdms2.open(sys.prefix + '/sample_data/clt.nc')('clt')[0, ...] + clt = cdms2.open(cdat_info.get_prefix() + '/sample_data/clt.nc')('clt')[0, ...] diag = {'srcAreas': None, 'dstAreas': None, 'srcAreaFractions': None, 'dstAreaFractions': None} diff --git a/testing/regrid/testDistSrc.py b/testing/regrid/testDistSrc.py index 8d37f0343a..ec5e710a1c 100644 --- a/testing/regrid/testDistSrc.py +++ b/testing/regrid/testDistSrc.py @@ -8,6 +8,7 @@ import time import re import numpy +import cdat_info import cdms2 import regrid2 import unittest @@ -82,7 +83,7 @@ def Xtest0_ESMP(self): coordSys = ESMP.ESMP_COORDSYS_SPH_DEG # ESMP.ESMP_COORDSYS_CART fails - inFile = sys.prefix + \ + inFile = cdat_info.get_prefix() + \ '/sample_data/so_Omon_ACCESS1-0_historical_r1i1p1_185001-185412_2timesteps.nc' srcF = scipy.io.netcdf.netcdf_file(inFile) #so = srcF.variables['so'][0, 0,...] @@ -291,7 +292,7 @@ def test1_ESMFRegrid(self): coordSys = ESMP.ESMP_COORDSYS_SPH_DEG # ESMP.ESMP_COORDSYS_CART fails - inFile = sys.prefix + \ + inFile = cdat_info.get_prefix() + \ '/sample_data/so_Omon_ACCESS1-0_historical_r1i1p1_185001-185412_2timesteps.nc' # dtype of a numpy 'float64' in scipy is '>f4' ... # switching to cdms2 diff --git a/testing/regrid/testDistTransientVar.py b/testing/regrid/testDistTransientVar.py index ab58479099..e8b1a71337 100644 --- a/testing/regrid/testDistTransientVar.py +++ b/testing/regrid/testDistTransientVar.py @@ -1,3 +1,4 @@ +import cdat_info import cdms2 from distarray.mvCubeDecomp import CubeDecomp import numpy @@ -19,7 +20,7 @@ def Xtest_test0(self): """ Test size, rank etc. """ - da = cdms2.open(sys.prefix + '/sample_data/clt.nc', 'r')('clt') + da = cdms2.open(cdat_info.get_prefix() + '/sample_data/clt.nc', 'r')('clt') rk = da.getMPIRank() sz = da.getMPISize() # make the data rank dependent @@ -47,7 +48,7 @@ def Xtest_test1(self): """ Test case with domain decomposition """ - f = cdms2.open(sys.prefix + '/sample_data/clt.nc', 'r') + f = cdms2.open(cdat_info.get_prefix() + '/sample_data/clt.nc', 'r') cltVar = f['clt'] # global sizes @@ -146,7 +147,7 @@ def test_test2(self): """ Apply the laplacian finite difference operator to clt """ - f = cdms2.open(sys.prefix + '/sample_data/clt.nc', 'r') + f = cdms2.open(cdat_info.get_prefix() + '/sample_data/clt.nc', 'r') cltVar = f['clt'] # global sizes diff --git a/testing/regrid/testEsmf.py b/testing/regrid/testEsmf.py index 375d4cd7c0..d27732e719 100644 --- a/testing/regrid/testEsmf.py +++ b/testing/regrid/testEsmf.py @@ -4,6 +4,7 @@ Unit tests for regrid2.ESMP using file data """ +import cdat_info import cdms2 import regrid2 from regrid2.mvGenericRegrid import GenericRegrid @@ -17,7 +18,7 @@ class TestESMPRegridding(unittest.TestCase): def setUp(self): - filename = sys.prefix + \ + filename = cdat_info.get_prefix() + \ "/sample_data/so_Omon_ACCESS1-0_historical_r1i1p1_185001-185412_2timesteps.nc" h=cdms2.open(filename) self.hso = h('so')[0, 0, ...] @@ -25,14 +26,14 @@ def setUp(self): h2D = self.hso.getGrid() self.hGrid2D = [h2D.getLatitude(), h2D.getLongitude()] - filename = sys.prefix + "/sample_data/clt.nc" + filename = cdat_info.get_prefix() + "/sample_data/clt.nc" f=cdms2.open(filename) self.fclt = f('clt') self.fGrid = [self.fclt.getLatitude(), self.fclt.getLongitude()] g2D = self.fclt.getGrid().toCurveGrid() self.fGrid2D = [g2D.getLatitude()[:], g2D.getLongitude()[:]] - filename = sys.prefix + "/sample_data/era40_tas_sample.nc" + filename = cdat_info.get_prefix() + "/sample_data/era40_tas_sample.nc" g=cdms2.open(filename) self.gtas = g('tas') self.gGrid = [self.gtas.getLatitude(), self.gtas.getLongitude()] diff --git a/testing/regrid/testEsmf3D.py b/testing/regrid/testEsmf3D.py index 5679619d95..bea36970c7 100644 --- a/testing/regrid/testEsmf3D.py +++ b/testing/regrid/testEsmf3D.py @@ -5,6 +5,7 @@ """ import operator +import cdat_info import cdms2 import regrid2 import unittest @@ -68,7 +69,7 @@ def setUp(self): pass def test_3D_Native(self): print 'running test_3d_esmf_native...' - f = cdms2.open(sys.prefix + \ + f = cdms2.open(cdat_info.get_prefix() + \ '/sample_data/so_Omon_ACCESS1-0_historical_r1i1p1_185001-185412_2timesteps.nc') so = f('so')[0, ...] @@ -114,7 +115,7 @@ def test_3D_Native(self): print 'Source Corner' srcXYZCorner = convertToXYZ(soLtBd1, soLnBd1, soLvBd1) - clt = cdms2.open(sys.prefix + 'sample_data/clt.nc')('clt')[0, :, :] + clt = cdms2.open(cdat_info.get_prefix() + '/sample_data/clt.nc')('clt')[0, :, :] cltBounds = clt.getGrid().getBounds() # Destination grid dimensions diff --git a/testing/regrid/testEsmfFractions.py b/testing/regrid/testEsmfFractions.py index fe674a45d5..f4396e418a 100644 --- a/testing/regrid/testEsmfFractions.py +++ b/testing/regrid/testEsmfFractions.py @@ -7,6 +7,7 @@ import operator import numpy +import cdat_info import cdms2 import regrid2.esmf import regrid2 @@ -28,11 +29,11 @@ def test1_2d_esmf_native_tripolar_fraction(self): mype = MPI.COMM_WORLD.Get_rank() - f = cdms2.open(sys.prefix + \ + f = cdms2.open(cdat_info.get_prefix() + \ '/sample_data/so_Omon_ACCESS1-0_historical_r1i1p1_185001-185412_2timesteps.nc') so = f('so')[0, 0, :, :] - h = cdms2.open(sys.prefix + \ + h = cdms2.open(cdat_info.get_prefix() + \ '/sample_data/so_Omon_HadGEM2-CC_historical_r1i1p1_185912-186911_2timesteps.nc') hadGEM2Model = h('so')[0,0,...] @@ -54,7 +55,7 @@ def test1_2d_esmf_native_tripolar_fraction(self): srcCells = [so.getLatitude(), so.getLongitude()] srcNodes = [srcLatCorner, srcLonCorner] - clt = cdms2.open(sys.prefix + 'sample_data/clt.nc')('clt')[0, :, :] + clt = cdms2.open(cdat_info.get_prefix() + '/sample_data/clt.nc')('clt')[0, :, :] cltBounds = clt.getGrid().getBounds() ny, nx = clt.shape diff --git a/testing/regrid/testEsmfInterface.py b/testing/regrid/testEsmfInterface.py index 800fb76146..260bf51ed4 100644 --- a/testing/regrid/testEsmfInterface.py +++ b/testing/regrid/testEsmfInterface.py @@ -7,6 +7,7 @@ import operator import numpy +import cdat_info import cdms2 import regrid2.esmf import regrid2 @@ -38,10 +39,10 @@ def test_2d(self): if HAS_MPI: mype = MPI.COMM_WORLD.Get_rank() - f = cdms2.open(sys.prefix + \ + f = cdms2.open(cdat_info.get_prefix() + \ '/sample_data/so_Omon_ACCESS1-0_historical_r1i1p1_185001-185412_2timesteps.nc') so = f['so'] #[0, 0, :, :] - clt = cdms2.open(sys.prefix + '/sample_data/clt.nc')('clt')[0, :, :] + clt = cdms2.open(cdat_info.get_prefix() + '/sample_data/clt.nc')('clt')[0, :, :] # ESMF interface, assume so and clt are cell centered srcGrid = regrid2.esmf.EsmfStructGrid(so[0, 0, ...].shape, diff --git a/testing/regrid/testEsmfLevelAndTime.py b/testing/regrid/testEsmfLevelAndTime.py index 421a4e893a..4cc0bbb197 100644 --- a/testing/regrid/testEsmfLevelAndTime.py +++ b/testing/regrid/testEsmfLevelAndTime.py @@ -1,4 +1,5 @@ import unittest +import cdat_info import cdms2 import ESMP import regrid2 @@ -7,13 +8,13 @@ class TestLevelRegridLibCfAndESMP(unittest.TestCase): def setUp(self): - fso = cdms2.open(sys.prefix + \ + fso = cdms2.open(cdat_info.get_prefix() + \ '/sample_data/so_Omon_ACCESS1-0_historical_r1i1p1_185001-185412_2timesteps.nc') self.soLevel = fso('so')[0,0:5,...] self.soTime = fso('so')[:,0,...] self.so = fso('so')[:,0:5,...] - fclt = cdms2.open(sys.prefix + 'sample_data/clt.nc') + fclt = cdms2.open(cdat_info.get_prefix() + '/sample_data/clt.nc') self.clt = fclt('clt') def test_ESMPTimeLevel2D(self): diff --git a/testing/regrid/testEsmfRegridMpi.py b/testing/regrid/testEsmfRegridMpi.py index be8bb9b725..7b55e4ba71 100644 --- a/testing/regrid/testEsmfRegridMpi.py +++ b/testing/regrid/testEsmfRegridMpi.py @@ -7,6 +7,7 @@ import operator import numpy +import cdat_info import cdms2 import regrid2.esmf import regrid2 @@ -27,10 +28,10 @@ def setUp(self): def test_2d_esmf(self): #print 'running test_2d_esmf...' - f = cdms2.open(sys.prefix + \ + f = cdms2.open(cdat_info.get_prefix() + \ '/sample_data/so_Omon_ACCESS1-0_historical_r1i1p1_185001-185412_2timesteps.nc') so = f('so')[0, 0, :, :] - clt = cdms2.open(sys.prefix + 'sample_data/clt.nc')('clt')[0, :, :] + clt = cdms2.open(cdat_info.get_prefix() + '/sample_data/clt.nc')('clt')[0, :, :] tic = time.time() soInterp = so.regrid(clt.getGrid(), regridTool='ESMF') #, periodicity=1) soInterpInterp = soInterp.regrid(so.getGrid(), regridTool='ESMF') @@ -53,10 +54,10 @@ def test_2d_esmf(self): def test_2d_esmf_interface(self): #print 'running test_2d_esmf_interface...' - f = cdms2.open(sys.prefix + \ + f = cdms2.open(cdat_info.get_prefix() + \ '/sample_data/so_Omon_ACCESS1-0_historical_r1i1p1_185001-185412_2timesteps.nc') so = f('so')[0, 0, :, :] - clt = cdms2.open(sys.prefix + 'sample_data/clt.nc')('clt')[0, :, :] + clt = cdms2.open(cdat_info.get_prefix() + '/sample_data/clt.nc')('clt')[0, :, :] tic = time.time() # assume so and clt are cell centered srcGrid = regrid2.esmf.EsmfStructGrid(so.shape, diff --git a/testing/regrid/testEsmfSalinity.py b/testing/regrid/testEsmfSalinity.py index 7bb6d0c8c4..d39df47af3 100644 --- a/testing/regrid/testEsmfSalinity.py +++ b/testing/regrid/testEsmfSalinity.py @@ -8,6 +8,7 @@ import time import re import numpy +import cdat_info import cdms2 import regrid2 import unittest @@ -274,11 +275,11 @@ def XXtest0_ESMP(self): def XXtest1_esmf(self): - srcF = cdms2.open(sys.prefix + \ + srcF = cdms2.open(cdat_info.get_prefix() + \ '/sample_data/so_Omon_ACCESS1-0_historical_r1i1p1_185001-185412_2timesteps.nc') so = srcF('so')[0, 0, ...] srcGridMask = numpy.array((so == so.missing_value), numpy.int32) - clt = cdms2.open(sys.prefix + '/sample_data/clt.nc')('clt')[0,...] + clt = cdms2.open(cdat_info.get_prefix() + '/sample_data/clt.nc')('clt')[0,...] srcGrd = [so.getGrid().getLatitude(), so.getGrid().getLongitude()] dG = clt.getGrid().toCurveGrid() dstGrd = [dG.getLatitude()[:], dG.getLongitude()[:]] @@ -356,11 +357,11 @@ def XXtest1_esmf(self): self.assertLess(dstDataMMax, so.max()) def XXtest2_ESMFRegrid(self): - srcF = cdms2.open(sys.prefix + \ + srcF = cdms2.open(cdat_info.get_prefix() + \ '/sample_data/so_Omon_ACCESS1-0_historical_r1i1p1_185001-185412_2timesteps.nc') so = srcF['so'] srcGridMask = numpy.array((so[0, 0,...] == so.missing_value) , numpy.int32) - clt = cdms2.open(sys.prefix + '/sample_data/clt.nc')('clt')[0, ...] + clt = cdms2.open(cdat_info.get_prefix() + '/sample_data/clt.nc')('clt')[0, ...] srcGrd = [so.getGrid().getLatitude(), so.getGrid().getLongitude()] srcBounds = cdms2.mvCdmsRegrid.getBoundList(srcGrd) dG = clt.getGrid().toCurveGrid() @@ -425,11 +426,11 @@ def XXtest2_ESMFRegrid(self): self.assertLess(dstDataMax, so[0,0,...].max()) def XXtest3_genericRegrid(self): - srcF = cdms2.open(sys.prefix + \ + srcF = cdms2.open(cdat_info.get_prefix() + \ '/sample_data/so_Omon_ACCESS1-0_historical_r1i1p1_185001-185412_2timesteps.nc') so = srcF('so')[0, 0, ...] srcGridMask = numpy.array((so == so.missing_value) , numpy.int32) - clt = cdms2.open(sys.prefix + '/sample_data/clt.nc')('clt') + clt = cdms2.open(cdat_info.get_prefix() + '/sample_data/clt.nc')('clt') srcGrd = [so.getGrid().getLatitude(), so.getGrid().getLongitude()] srcBounds = cdms2.mvCdmsRegrid.getBoundList(srcGrd) dG = clt.getGrid().toCurveGrid() @@ -470,11 +471,11 @@ def XXtest3_genericRegrid(self): self.assertLess(dstDataMax, so.max()) def test4_cdmsRegrid(self): - srcF = cdms2.open(sys.prefix + \ + srcF = cdms2.open(cdat_info.get_prefix() + \ '/sample_data/so_Omon_ACCESS1-0_historical_r1i1p1_185001-185412_2timesteps.nc') so = srcF('so')[0, 0, ...] srcGridMask = numpy.array((so == so.missing_value) , numpy.int32) - clt = cdms2.open(sys.prefix + '/sample_data/clt.nc')('clt') + clt = cdms2.open(cdat_info.get_prefix() + '/sample_data/clt.nc')('clt') # create regrid object r = cdms2.CdmsRegrid(so.getGrid(), clt.getGrid(), dtype=so.dtype, @@ -501,10 +502,10 @@ def test4_cdmsRegrid(self): def XXtest5_regrid(self): - srcF = cdms2.open(sys.prefix + \ + srcF = cdms2.open(cdat_info.get_prefix() + \ '/sample_data/so_Omon_ACCESS1-0_historical_r1i1p1_185001-185412_2timesteps.nc') so = srcF('so')[0, 0, ...] - clt = cdms2.open(sys.prefix + '/sample_data/clt.nc')('clt') + clt = cdms2.open(cdat_info.get_prefix() + '/sample_data/clt.nc')('clt') dstData = so.regrid(clt.getGrid(), regridTool = 'esmf', regridMethod='conserve') diff --git a/testing/regrid/testEsmfVsLibcf.py b/testing/regrid/testEsmfVsLibcf.py index 1a51df7edc..ee4331b08f 100644 --- a/testing/regrid/testEsmfVsLibcf.py +++ b/testing/regrid/testEsmfVsLibcf.py @@ -7,6 +7,7 @@ import operator import numpy +import cdat_info import cdms2 import regrid2.esmf import regrid2 @@ -26,10 +27,10 @@ def setUp(self): def test_2d_libcf(self): #print 'running test_2d_libcf...' - f = cdms2.open(sys.prefix + \ + f = cdms2.open(cdat_info.get_prefix() + \ '/sample_data/so_Omon_ACCESS1-0_historical_r1i1p1_185001-185412_2timesteps.nc') so = f('so')[0, 0, :, :] - clt = cdms2.open(sys.prefix + '/sample_data/clt.nc')('clt')[0, :, :] + clt = cdms2.open(cdat_info.get_prefix() + '/sample_data/clt.nc')('clt')[0, :, :] tic = time.time() soInterp = so.regrid(clt.getGrid(), regridTool='libcf') soInterpInterp = soInterp.regrid(so.getGrid(), regridTool='libcf') @@ -48,10 +49,10 @@ def test_2d_libcf(self): def test_2d_esmf(self): #print 'running test_2d_esmf...' - f = cdms2.open(sys.prefix + \ + f = cdms2.open(cdat_info.get_prefix() + \ '/sample_data/so_Omon_ACCESS1-0_historical_r1i1p1_185001-185412_2timesteps.nc') so = f('so')[0, 0, :, :] - clt = cdms2.open(sys.prefix + '/sample_data/clt.nc')('clt')[0, :, :] + clt = cdms2.open(cdat_info.get_prefix() + '/sample_data/clt.nc')('clt')[0, :, :] tic = time.time() soInterp = so.regrid(clt.getGrid(), regridTool='ESMF') #, periodicity=1) soInterpInterp = soInterp.regrid(so.getGrid(), regridTool='ESMF') @@ -71,10 +72,10 @@ def test_2d_esmf(self): def test_2d_esmf_interface(self): #print 'running test_2d_esmf_interface...' - f = cdms2.open(sys.prefix + \ + f = cdms2.open(cdat_info.get_prefix() + \ '/sample_data/so_Omon_ACCESS1-0_historical_r1i1p1_185001-185412_2timesteps.nc') so = f('so')[0, 0, :, :] - clt = cdms2.open(sys.prefix + '/sample_data/clt.nc')('clt')[0, :, :] + clt = cdms2.open(cdat_info.get_prefix() + '/sample_data/clt.nc')('clt')[0, :, :] tic = time.time() # assume so and clt are cell centered srcGrid = regrid2.esmf.EsmfStructGrid(so.shape, @@ -160,10 +161,10 @@ def test_2d_esmf_interface(self): def test_2d_esmf_native(self): #print 'running test_2d_esmf_native...' - f = cdms2.open(sys.prefix + \ + f = cdms2.open(cdat_info.get_prefix() + \ '/sample_data/so_Omon_ACCESS1-0_historical_r1i1p1_185001-185412_2timesteps.nc') so = f('so')[0, 0, :, :] - clt = cdms2.open(sys.prefix + '/sample_data/clt.nc')('clt')[0, :, :] + clt = cdms2.open(cdat_info.get_prefix() + '/sample_data/clt.nc')('clt')[0, :, :] tic = time.time() # create grid diff --git a/testing/regrid/testGridTypes.py b/testing/regrid/testGridTypes.py index c6c9f4664c..be6f12eb77 100644 --- a/testing/regrid/testGridTypes.py +++ b/testing/regrid/testGridTypes.py @@ -1,3 +1,4 @@ +import cdat_info import cdms2 import ESMP import numpy @@ -16,8 +17,8 @@ def test_test1(self): """ 2D gsRegrid """ - u = cdms2.open(sys.prefix + '/sample_data/clt.nc')('u')[0, 0,...] - clt = cdms2.open(sys.prefix + '/sample_data/clt.nc')('clt')[0, ...] + u = cdms2.open(cdat_info.get_prefix() + '/sample_data/clt.nc')('u')[0, 0,...] + clt = cdms2.open(cdat_info.get_prefix() + '/sample_data/clt.nc')('clt')[0, ...] ctlOnUGrid = clt.regrid( u.getGrid() ) #print 'ctlOnUGrid.getGrid() = ', type(ctlOnUGrid.getGrid()) self.assertRegexpMatches(str(type(ctlOnUGrid.getGrid())), @@ -27,8 +28,8 @@ def test_test2(self): """ 2D ESMP """ - u = cdms2.open(sys.prefix + '/sample_data/clt.nc')('u')[0, 0,...] - clt = cdms2.open(sys.prefix + '/sample_data/clt.nc')('clt')[0, ...] + u = cdms2.open(cdat_info.get_prefix() + '/sample_data/clt.nc')('u')[0, 0,...] + clt = cdms2.open(cdat_info.get_prefix() + '/sample_data/clt.nc')('clt')[0, ...] ctlOnUGrid = clt.regrid( u.getGrid(), regridTool = "ESMP" ) #print 'ctlOnUGrid.getGrid() = ', type(ctlOnUGrid.getGrid()) self.assertRegexpMatches(str(type(ctlOnUGrid.getGrid())), diff --git a/testing/regrid/testLibCFLevelAndTime.py b/testing/regrid/testLibCFLevelAndTime.py index ca7c127115..d8bd2cbdf6 100644 --- a/testing/regrid/testLibCFLevelAndTime.py +++ b/testing/regrid/testLibCFLevelAndTime.py @@ -1,4 +1,5 @@ import unittest +import cdat_info import cdms2 import regrid2 import numpy @@ -6,13 +7,13 @@ class TestLevelRegridLibCfAndESMP(unittest.TestCase): def setUp(self): - fso = cdms2.open(sys.prefix + \ + fso = cdms2.open(cdat_info.get_prefix() + \ '/sample_data/so_Omon_ACCESS1-0_historical_r1i1p1_185001-185412_2timesteps.nc') self.soLevel = fso('so')[0,0:5,...] self.soTime = fso('so')[:,0,...] self.so = fso('so')[:,0:5,...] - fclt = cdms2.open(sys.prefix + "/sample_data/clt.nc") + fclt = cdms2.open(cdat_info.get_prefix() + "/sample_data/clt.nc") self.clt = fclt('clt') def test_gsRegridTimeLevel2D(self): diff --git a/testing/regrid/testMPIGrid.py b/testing/regrid/testMPIGrid.py index e1f76ca9cb..ba88734eef 100644 --- a/testing/regrid/testMPIGrid.py +++ b/testing/regrid/testMPIGrid.py @@ -14,6 +14,7 @@ $Id: testMPIGrid.py 2472 2012-10-12 13:10:52Z pletzer $ """ +import cdat_info import cdms2 import numpy as P import ESMP @@ -27,7 +28,7 @@ class TestGrid(unittest.TestCase): def setUp(self): - dir = sys.prefix + "/sample_data/" + dir = cdat_info.get_prefix() + "/sample_data/" filename = dir + "so_Omon_MPI-ESM-LR_1pctCO2_r1i1p1_185001-185912_2timesteps.nc" g = cdms2.open(filename) self.so = g('so')[0,0,:,:254] diff --git a/testing/regrid/testMarvel.py b/testing/regrid/testMarvel.py index 5b4ea839cf..344b31f25e 100644 --- a/testing/regrid/testMarvel.py +++ b/testing/regrid/testMarvel.py @@ -2,6 +2,7 @@ Testing CDAT regridding from curvilinear grid to rectangular grid """ import unittest +import cdat_info import cdms2 import ESMP from cdms2.mvCdmsRegrid import CdmsRegrid @@ -35,7 +36,7 @@ def test0FixedByKindig(self): import cdms2 as cdms import numpy as np - filename = sys.prefix + '/sample_data/clt.nc' + filename = cdat_info.get_prefix() + '/sample_data/clt.nc' a=cdms.open(filename) data=a('clt')[0,...] @@ -99,7 +100,7 @@ def Xtest1(self): import cdms2 as cdms import numpy as np - filename = sys.prefix + '/sample_data/clt.nc' + filename = cdat_info.get_prefix() + '/sample_data/clt.nc' a=cdms.open(filename) data=a('clt')[0,...] @@ -153,7 +154,7 @@ def Xtest2(self): import cdms2 as cdms import numpy as np - filename = sys.prefix + '/sample_data/clt.nc' + filename = cdat_info.get_prefix() + '/sample_data/clt.nc' a=cdms.open(filename) data=a('clt')[0,...] @@ -190,7 +191,7 @@ def Xtest3(self): import cdms2 as cdms import numpy as np - filename = sys.prefix + '/sample_data/clt.nc' + filename = cdat_info.get_prefix() + '/sample_data/clt.nc' a=cdms.open(filename) data=a('clt')[0,...] @@ -219,7 +220,7 @@ def test4DefaultRegridder(self): import cdms2 as cdms import numpy as np - filename = sys.prefix + '/sample_data/clt.nc' + filename = cdat_info.get_prefix() + '/sample_data/clt.nc' a=cdms.open(filename) data=a('clt')[0,...] diff --git a/testing/regrid/testMvCdmsRegrid.py b/testing/regrid/testMvCdmsRegrid.py index 74f509c4b0..668fed7ef0 100644 --- a/testing/regrid/testMvCdmsRegrid.py +++ b/testing/regrid/testMvCdmsRegrid.py @@ -3,6 +3,7 @@ $Id: testMvCdmsRegrid.py 2354 2012-07-11 15:28:14Z pletzer $ """ +import cdat_info import cdms2 import numpy import unittest @@ -22,11 +23,11 @@ def setUp(self): """ Set up the grids to pass to mvGenericRegrid """ - f = cdms2.open(sys.prefix + \ + f = cdms2.open(cdat_info.get_prefix() + \ '/sample_data/so_Omon_ACCESS1-0_historical_r1i1p1_185001-185412_2timesteps.nc') self.so = f('so') - g = cdms2.open(sys.prefix + '/sample_data/clt.nc') + g = cdms2.open(cdat_info.get_prefix() + '/sample_data/clt.nc') self.clt = g('clt') def testSingleTimeSingleElev(self): @@ -34,7 +35,7 @@ def testSingleTimeSingleElev(self): Interpolate over one level/time """ - f = cdms2.open(sys.prefix + '/sample_data/clt.nc') + f = cdms2.open(cdat_info.get_prefix() + '/sample_data/clt.nc') clt = f('clt') v = f('v')[0,0,...] @@ -60,7 +61,7 @@ def testMultipleTimesAndElevations(self): Interpolate over time and elevation axes """ - f = cdms2.open(sys.prefix + '/sample_data/clt.nc') + f = cdms2.open(cdat_info.get_prefix() + '/sample_data/clt.nc') clt = f('clt') v = f('v') diff --git a/testing/regrid/testMvGenericRegrid.py b/testing/regrid/testMvGenericRegrid.py index faa2b0ac60..c7966a016b 100644 --- a/testing/regrid/testMvGenericRegrid.py +++ b/testing/regrid/testMvGenericRegrid.py @@ -3,6 +3,7 @@ $Id: testMvGenericRegrid.py 2354 2012-07-11 15:28:14Z pletzer $ """ +import cdat_info import cdms2 import numpy import unittest @@ -30,7 +31,7 @@ def setUp(self): Set up the grids to pass to mvGenericRegrid """ self.doPlots = False - self.clt = cdms2.open(sys.prefix + '/sample_data/clt.nc')('clt')[0, ...] + self.clt = cdms2.open(cdat_info.get_prefix() + '/sample_data/clt.nc')('clt')[0, ...] # Convert to curvilinear cds, cds_forBounds = [], [] cds.append(self.clt.getLatitude()) @@ -42,7 +43,7 @@ def setUp(self): self.cltInterpInterp = numpy.array(self.clt) * 0.0 + self.clt.missing_value # Salinity check - f = cdms2.open(sys.prefix + \ + f = cdms2.open(cdat_info.get_prefix() + \ '/sample_data/so_Omon_ACCESS1-0_historical_r1i1p1_185001-185412_2timesteps.nc') self.so = f('so') soGrid = [] @@ -297,7 +298,7 @@ def test5_LibCF_LevelTime(self): """ Interpolate over one level/time """ - f = cdms2.open(sys.prefix + '/sample_data/clt.nc') + f = cdms2.open(cdat_info.get_prefix() + '/sample_data/clt.nc') clt = f('clt') v = f('v') @@ -341,7 +342,7 @@ def Xtest6_ESMF_Conserve_LevelTime_clt(self): """ Interpolate over level/time in addition to lat-lon """ - f = cdms2.open(sys.prefix + '/sample_data/clt.nc') + f = cdms2.open(cdat_info.get_prefix() + '/sample_data/clt.nc') clt = f('clt') v = f('v') diff --git a/testing/regrid/testRaynaud.py b/testing/regrid/testRaynaud.py index c69d2e99fe..94f584df80 100644 --- a/testing/regrid/testRaynaud.py +++ b/testing/regrid/testRaynaud.py @@ -2,6 +2,7 @@ Testing CDAT regridding from curvilinear grid to rectangular grid """ import unittest +import cdat_info import cdms2 import ESMP from cdms2.mvCdmsRegrid import CdmsRegrid @@ -131,7 +132,7 @@ def test0(self): 'esmf': ['linear', 'patch', 'conserve'], } - f = cdms2.open(sys.prefix + '/sample_data/swan.four.nc') + f = cdms2.open(cdat_info.get_prefix() + '/sample_data/swan.four.nc') vari = f('HS') f.close() gridi = vari.getGrid() @@ -204,7 +205,7 @@ def test2_dstGridHasNoBounds(self): 'esmf': ['conserve', 'patch', 'linear'], } - f = cdms2.open(sys.prefix + '/sample_data/swan.four.nc') + f = cdms2.open(cdat_info.get_prefix() + '/sample_data/swan.four.nc') vari = f('HS') gridi = vari.getGrid() lati = vari.getLatitude() @@ -242,7 +243,7 @@ def test3_srcGridHasNoBounds(self): 'esmf': ['conserve', 'patch', 'linear'], } - f = cdms2.open(sys.prefix + '/sample_data/swan.four.nc') + f = cdms2.open(cdat_info.get_prefix() + '/sample_data/swan.four.nc') vari = f('HS') gridi = vari.getGrid() lati = vari.getLatitude() diff --git a/testing/regrid/testRegrid2Tool.py b/testing/regrid/testRegrid2Tool.py index 63520c5dd1..e94f8e7764 100644 --- a/testing/regrid/testRegrid2Tool.py +++ b/testing/regrid/testRegrid2Tool.py @@ -6,6 +6,7 @@ """ import operator import numpy +import cdat_info import cdms2 import unittest import time @@ -20,19 +21,19 @@ def setUp(self): pass def test_1(self): - f = cdms2.open(sys.prefix + '/sample_data/clt.nc') + f = cdms2.open(cdat_info.get_prefix() + '/sample_data/clt.nc') clt = f('clt')[0, :, :] cltInterp = clt.regrid(clt.getGrid(), regridTool='regrid2') self.assertLess(numpy.sum(clt - cltInterp), 1.e-3) def test_2(self): - f = cdms2.open(sys.prefix + '/sample_data/clt.nc') + f = cdms2.open(cdat_info.get_prefix() + '/sample_data/clt.nc') clt = f('clt')[:, :, :] cltInterp = clt.regrid(clt.getGrid(), regridTool='regrid2') self.assertLess(numpy.sum(clt - cltInterp), 5.e-3) def test_3(self): - f = cdms2.open(sys.prefix + '/sample_data/clt.nc') + f = cdms2.open(cdat_info.get_prefix() + '/sample_data/clt.nc') clt = f('clt')[:, :, :] u = f('u')[:, :, :] cltInterp = clt.regrid(u.getGrid(), regridTool='regrid2') diff --git a/testing/regrid/testRemoteGet.py b/testing/regrid/testRemoteGet.py index ef0b39e5d4..6863ae0459 100644 --- a/testing/regrid/testRemoteGet.py +++ b/testing/regrid/testRemoteGet.py @@ -7,6 +7,7 @@ import operator import numpy +import cdat_info import cdms2 import regrid2.esmf import regrid2 @@ -23,7 +24,7 @@ def setUp(self): def test_2d_esmf_native(self): print 'running test_2d_esmf_native...' - f = cdms2.open(sys.prefix + \ + f = cdms2.open(cdat_info.get_prefix() + \ '/sample_data/so_Omon_ACCESS1-0_historical_r1i1p1_185001-185412_2timesteps.nc') so = f('so')[0, 0, :, :] diff --git a/testing/regrid/testSalinity.py b/testing/regrid/testSalinity.py index ad7fb4f7d0..11b56a85a0 100644 --- a/testing/regrid/testSalinity.py +++ b/testing/regrid/testSalinity.py @@ -7,6 +7,7 @@ import operator import numpy +import cdat_info import cdms2 import regrid2 import unittest @@ -24,10 +25,10 @@ def setUp(self): pass def Xtest1_gsRegrid(self): - srcF = cdms2.open(sys.prefix + \ + srcF = cdms2.open(cdat_info.get_prefix() + \ '/sample_data/so_Omon_ACCESS1-0_historical_r1i1p1_185001-185412_2timesteps.nc') so = srcF('so')[0, 0, ...] - clt = cdms2.open(sys.prefix + '/sample_data/clt.nc')('clt') + clt = cdms2.open(cdat_info.get_prefix() + '/sample_data/clt.nc')('clt') srcGrd = [so.getGrid().getLatitude(), so.getGrid().getLongitude()] dstGrd = [clt.getGrid().getLatitude(), clt.getGrid().getLongitude()] # create regrid object @@ -60,10 +61,10 @@ def Xtest1_gsRegrid(self): self.assertLess(dstDataMax, so.max()) def Xtest2_libCFRegrid(self): - srcF = cdms2.open(sys.prefix + \ + srcF = cdms2.open(cdat_info.get_prefix() + \ '/sample_data/so_Omon_ACCESS1-0_historical_r1i1p1_185001-185412_2timesteps.nc') so = srcF('so')[0, 0, ...] - clt = cdms2.open(sys.prefix + '/sample_data/clt.nc')('clt') + clt = cdms2.open(cdat_info.get_prefix() + '/sample_data/clt.nc')('clt') srcGrd = [so.getGrid().getLatitude(), so.getGrid().getLongitude()] dstGrd = [clt.getGrid().getLatitude(), clt.getGrid().getLongitude()] # create regrid object @@ -93,10 +94,10 @@ def Xtest2_libCFRegrid(self): def Xtest3_genericRegrid(self): - srcF = cdms2.open(sys.prefix + \ + srcF = cdms2.open(cdat_info.get_prefix() + \ '/sample_data/so_Omon_ACCESS1-0_historical_r1i1p1_185001-185412_2timesteps.nc') so = srcF('so')[0, 0, ...] - clt = cdms2.open(sys.prefix + '/sample_data/clt.nc')('clt') + clt = cdms2.open(cdat_info.get_prefix() + '/sample_data/clt.nc')('clt') srcGrd = [so.getGrid().getLatitude(), so.getGrid().getLongitude()] dstGrd = [clt.getGrid().getLatitude(), clt.getGrid().getLongitude()] # create regrid object @@ -126,10 +127,10 @@ def Xtest3_genericRegrid(self): self.assertLess(dstDataMax, so.max()) def test4_cdmsRegrid(self): - srcF = cdms2.open(sys.prefix + \ + srcF = cdms2.open(cdat_info.get_prefix() + \ '/sample_data/so_Omon_ACCESS1-0_historical_r1i1p1_185001-185412_2timesteps.nc') so = srcF('so')[0, 0, ...] - clt = cdms2.open(sys.prefix + '/sample_data/clt.nc')('clt') + clt = cdms2.open(cdat_info.get_prefix() + '/sample_data/clt.nc')('clt') # create regrid object r = cdms2.CdmsRegrid(so.getGrid(), clt.getGrid(), so.dtype, regridMethod='linear', regridTool='libcf', @@ -153,10 +154,10 @@ def test4_cdmsRegrid(self): def test5_regrid(self): - srcF = cdms2.open(sys.prefix + \ + srcF = cdms2.open(cdat_info.get_prefix() + \ '/sample_data/so_Omon_ACCESS1-0_historical_r1i1p1_185001-185412_2timesteps.nc') so = srcF('so')[0, 0, ...] - clt = cdms2.open(sys.prefix + '/sample_data/clt.nc')('clt') + clt = cdms2.open(cdat_info.get_prefix() + '/sample_data/clt.nc')('clt') dstData = so.regrid(clt.getGrid()) dstDataMask = (dstData == so.missing_value) dstDataFltd = dstData * (1 - dstDataMask) diff --git a/testing/regrid/testSo2Tas.py b/testing/regrid/testSo2Tas.py index efff61ccd2..023feda344 100644 --- a/testing/regrid/testSo2Tas.py +++ b/testing/regrid/testSo2Tas.py @@ -5,6 +5,7 @@ import re import numpy +import cdat_info import cdms2 import regrid2 import unittest @@ -21,12 +22,12 @@ class Test(unittest.TestCase): def setUp(self): - access = cdms2.open(sys.prefix + \ + access = cdms2.open(cdat_info.get_prefix() + \ '/sample_data/so_Omon_ACCESS1-0_historical_r1i1p1_185001-185412_2timesteps.nc') self.access = access('so')[0, 0, ...] - self.tasGood = cdms2.open(sys.prefix + \ + self.tasGood = cdms2.open(cdat_info.get_prefix() + \ '/sample_data/tas_Amon_HadGEM2-A_amip_r1i2p1_197809-200811_2timesteps.nc')('tas') - giss = cdms2.open(sys.prefix + \ + giss = cdms2.open(cdat_info.get_prefix() + \ '/sample_data/so_Omon_GISS-E2-R_historicalNat_r5i1p1_185001-187512_2timesteps.nc') self.giss = giss('so')[0,0,...] diff --git a/testing/regrid/testSo2TasACCESSFails.py b/testing/regrid/testSo2TasACCESSFails.py index b2d80054fb..441229b428 100644 --- a/testing/regrid/testSo2TasACCESSFails.py +++ b/testing/regrid/testSo2TasACCESSFails.py @@ -7,6 +7,7 @@ import re import numpy +import cdat_info import cdms2 import regrid2 import unittest @@ -20,11 +21,11 @@ class Test(unittest.TestCase): def setUp(self): - self.so = cdms2.open(sys.prefix + \ + self.so = cdms2.open(cdat_info.get_prefix() + \ '/sample_data/so_Omon_ACCESS1-0_historical_r1i1p1_185001-185412_2timesteps.nc')('so') - self.tasGood = cdms2.open(sys.prefix + \ + self.tasGood = cdms2.open(cdat_info.get_prefix() + \ '/sample_data/tas_Amon_HadGEM2-A_amip_r1i2p1_197809-200811_2timesteps.nc')('tas') - self.tasBad = cdms2.open(sys.prefix + \ + self.tasBad = cdms2.open(cdat_info.get_prefix() + \ '/sample_data/tas_Amon_ACCESS1-0_historical_r1i1p1_185001-189912_2timesteps.nc')('tas') def test1_esmf_conserve_bad(self): diff --git a/testing/regrid/testTasRegrid.py b/testing/regrid/testTasRegrid.py index 327739dc29..574b451807 100644 --- a/testing/regrid/testTasRegrid.py +++ b/testing/regrid/testTasRegrid.py @@ -1,3 +1,4 @@ +import cdat_info import cdms2 import numpy import unittest @@ -15,8 +16,8 @@ class TestTasRegrid(unittest.TestCase): def setUp(self): - self.clt = cdms2.open(sys.prefix + '/sample_data/clt.nc')('clt')[0, ...] - self.tas = cdms2.open(sys.prefix + \ + self.clt = cdms2.open(cdat_info.get_prefix() + '/sample_data/clt.nc')('clt')[0, ...] + self.tas = cdms2.open(cdat_info.get_prefix() + \ '/sample_data/tas_ecm_1979.nc')('tas')[0, ...] if PLOT: @@ -42,7 +43,7 @@ def test_test1(self): """ 2D """ - tas = cdms2.open(sys.prefix + \ + tas = cdms2.open(cdat_info.get_prefix() + \ '/sample_data/tas_ccsr-95a_1979.01-1979.12.nc')('tas')[0, 0,...] tasInterp = tas.regrid( tas.getGrid() ) print numpy.all(tasInterp.mask) @@ -55,7 +56,7 @@ def test_test2(self): """ 2D + time """ - tas = cdms2.open(sys.prefix + \ + tas = cdms2.open(cdat_info.get_prefix() + \ '/sample_data/tas_ccsr-95a_1979.01-1979.12.nc')('tas')[:, 0,...] tasInterp = tas.regrid( tas.getGrid() ) if not numpy.all(tasInterp.mask): @@ -67,7 +68,7 @@ def test_test3(self): """ 2D + level """ - tas = cdms2.open(sys.prefix + \ + tas = cdms2.open(cdat_info.get_prefix() + \ '/sample_data/tas_ccsr-95a_1979.01-1979.12.nc')('tas')[0, :,...] tasInterp = tas.regrid( tas.getGrid() ) if not numpy.all(tasInterp.mask): @@ -79,7 +80,7 @@ def test_test4(self): """ 2D + level + time """ - tas = cdms2.open(sys.prefix + \ + tas = cdms2.open(cdat_info.get_prefix() + \ '/sample_data/tas_ccsr-95a_1979.01-1979.12.nc')('tas')[:, :,...] tasInterp = tas.regrid( tas.getGrid() ) if not numpy.all(tasInterp.mask): diff --git a/testing/regrid/testUnits.py b/testing/regrid/testUnits.py index f1e40ed706..56c7f2d81f 100644 --- a/testing/regrid/testUnits.py +++ b/testing/regrid/testUnits.py @@ -2,6 +2,7 @@ Testing units creation """ import unittest +import cdat_info import cdms2 import cdutil import ESMP @@ -17,7 +18,7 @@ def Xtest0(self): """ Test cdutil.generateLandSeaMask """ - f = cdms2.open(sys.prefix + \ + f = cdms2.open(cdat_info.get_prefix() + \ "/sample_data/so_Omon_GISS-E2-R_historicalNat_r5i1p1_185001-187512_2timesteps.nc") s = f("so") print s.shape @@ -29,7 +30,7 @@ def test1(self): """ Test cdutil.generateLandSeaMask, using a smaller dataset """ - f = cdms2.open(sys.prefix + "/sample_data/clt.nc") + f = cdms2.open(cdat_info.get_prefix() + "/sample_data/clt.nc") s = f("clt") print s.shape print dir(cdutil.create_landsea_mask) diff --git a/testing/regrid/testWrite.py b/testing/regrid/testWrite.py index bdf35f7ddb..c91b0e81ee 100644 --- a/testing/regrid/testWrite.py +++ b/testing/regrid/testWrite.py @@ -1,10 +1,11 @@ +import cdat_info import cdms2 import os import sys -h = cdms2.open(sys.prefix + \ +h = cdms2.open(cdat_info.get_prefix() + \ '/sample_data/so_Omon_ACCESS1-0_historical_r1i1p1_185001-185412_2timesteps.nc') -f = cdms2.open(sys.prefix + '/sample_data/clt.nc') +f = cdms2.open(cdat_info.get_prefix() + '/sample_data/clt.nc') so = h('so') clt = f('clt') diff --git a/testing/vcs/CMakeLists.txt b/testing/vcs/CMakeLists.txt index a73286f56d..c2c6761291 100644 --- a/testing/vcs/CMakeLists.txt +++ b/testing/vcs/CMakeLists.txt @@ -1,82 +1,82 @@ set(BASELINE_DIR "${UVCDAT_GIT_TESTDATA_DIR}/baselines/vcs") add_test(vcs_verify_import - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcs/test_vcs_import.py ) add_test(vcs_mkscale_zero_range - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcs/test_vcs_mkscale_zero_range.py ) add_test(vcs_verify_create_get - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcs/test_create_get.py ) add_test(vcs_test_antialiasing - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcs/test_vcs_antialiasing.py ) add_test(vcs_verify_init - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcs/test_vcs_init.py ) add_test(vcs_mkscale_great_range - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcs/test_vcs_mkscale_great_range.py ) add_test(vcs_verify_boxfill_basics - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcs/test_vcs_boxfill_basics_no_plot.py ) add_test(vcs_verify_proj_basics - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcs/test_vcs_projection_basics_no_plot.py ) add_test(vcs_verify_fillarea_basics - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcs/test_vcs_fillarea_basics_no_plot.py ) add_test(vcs_test_clear_empy_canvas - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcs/test_clear_empty_canvas.py ) add_test(vcs_test_interact_no_open - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcs/test_vcs_interact_no_open.py ) add_test(vcs_test_interact_no_plot - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcs/test_vcs_interact_no_plot.py ) add_test(vcs_test_colorcells - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcs/test_colorcells.py ) add_test(vcs_test_template_associated - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcs/test_vcs_template_saves_associated_to_tt.py ${cdat_SOURCE_DIR}/testing/vcs/template_test_associated_dump.json ) add_test(vcs_test_load_json - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcs/test_load_json.py ${cdat_SOURCE_DIR}/testing/vcs/test_json.json ) add_test(vcs_test_read_yx_scr - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcs/test_readyx_scr.py ${cdat_SOURCE_DIR}/testing/vcs/read_yxvsx.scr ) add_test(vcs_test_queries - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcs/test_queries.py ) add_test(vcs_test_dump_json - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcs/test_dump_json.py ${cdat_SOURCE_DIR}/testing/vcs/test_vcs_dump_json.json ) @@ -84,7 +84,7 @@ add_test(vcs_test_dump_json # Some vector plot testing FOREACH(angle -180 -135 -90 -45 0 45 135 90 135 ) add_test(vcs_test_vectors_angle_${angle} - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcs/test_vcs_basic_vectors.py --angle=${angle} "--source=${BASELINE_DIR}/test_vcs_basic_vectors_${angle}.png" @@ -92,7 +92,7 @@ FOREACH(angle -180 -135 -90 -45 0 45 135 90 135 ) ENDFOREACH(angle) FOREACH(scale 0.5 2) add_test(vcs_test_vectors_scaling_${scale} - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcs/test_vcs_basic_vectors.py --scale=${scale} --angle=45 @@ -100,7 +100,7 @@ FOREACH(scale 0.5 2) ) ENDFOREACH(scale) add_test(vcs_test_vectors_amplitude - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcs/test_vcs_basic_vectors.py --scale=2 --angle=45 @@ -108,114 +108,114 @@ add_test(vcs_test_vectors_amplitude "--source=${BASELINE_DIR}/test_vcs_basic_vectors_45_2_amplitude.png" ) add_test(vcs_test_vectors_missing - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcs/test_vcs_vectors_missing.py "--source=${BASELINE_DIR}/test_vcs_vectors_missing.png" ) add_test(vcs_test_draw_logo_on - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcs/test_draw_logo_on.py ${BASELINE_DIR}/test_vcs_draw_logo_on.png ) add_test(vcs_test_monotonic_decreasing_yxvsx_default - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcs/test_vcs_monotonic_decreasing_yxvsx_default.py ${BASELINE_DIR}/test_vcs_monotonic_decreasing_yxvsx_default.png ) add_test(vcs_test_taylor_template_ctl - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcs/test_vcs_taylor_template_ctl.py ${BASELINE_DIR}/test_vcs_taylor_template_ctl.png ) add_test(vcs_test_taylor_2_quads - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcs/test_vcs_taylor_2quads.py ${BASELINE_DIR}/test_vcs_taylor_2quads.png ) #These test actually plot things need sample data add_test(vcs_test_gen_meshfill - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcs/test_gen_meshfill.py "${BASELINE_DIR}/test_vcs_gen_meshfill.png" ) add_test(vcs_setcolormap - "${CMAKE_INSTALL_PREFIX}/bin/python" + "${PYTHON_EXECUTABLE}" "${cdat_SOURCE_DIR}/testing/vcs/test_vcs_setcolormap.py" "${BASELINE_DIR}/test_vcs_setcolormap.png" ) add_test(vcs_test_1d_in_boxfill - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcs/test_1d_in_boxfill.py "${BASELINE_DIR}/test_1d_in_boxfill.png" ) add_test(vcs_test_1d_missing - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcs/test_1D_missing.py "${BASELINE_DIR}/test_vcs_1d_missing.png" ) add_test(vcs_test_infinity - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcs/test_infinity.py "${BASELINE_DIR}/infinity.png" ) add_test(test_vcs_1D_datawc - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcs/test_vcs_1D_datawc.py "${BASELINE_DIR}/test_vcs_1D_datawc.png" ) add_test(test_vcs_1D_datawc_missing - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcs/test_vcs_1D_datawc_missing.py "${BASELINE_DIR}/test_vcs_1D_datawc_missing.png" ) add_test(vcs_test_wmo_marker - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcs/test_wmo_w07_marker.py "${BASELINE_DIR}/wmo_marker.png" ) add_test(vcs_test_wmo_markers - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcs/test_wmo_markers.py "${BASELINE_DIR}/wmo_markers.png" ) add_test(vcs_test_iso_celine_part1 - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcs/test_celine_iso_bug.py "${BASELINE_DIR}/test_celine_iso.png" ) add_test(vcs_test_iso_celine_part2 - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcs/test_celine_iso_bug_part2.py "${BASELINE_DIR}/test_celine_iso_2.png" ) add_test(vcs_test_markers - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcs/test_markers.py "${BASELINE_DIR}/test_markers.png" ) add_test(vcs_test_star_triangle_markers - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcs/test_star_triangle_markers.py "${BASELINE_DIR}/test_star_triangle_markers.png" ) add_test(vcs_test_boxfill_10x10_numpy - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcs/test_boxfill_10x10_numpy.py "${BASELINE_DIR}/test_vcs_boxfill_10x10_numpy.png" ) add_test(vcs_test_boxfill_10x10_masked_numpy - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcs/test_boxfill_10x10_masked_numpy.py "${BASELINE_DIR}/test_vcs_boxfill_10x10_masked_numpy.png" ) add_test(vcs_test_1D_with_manyDs - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcs/test_1D_with_manyDs.py "${BASELINE_DIR}/test_1D_with_manyDs.png" ) add_test(vcs_test_1d_marker_not_shown_if_xaxis_flipped - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcs/test_1d_marker_not_shown_if_xaxis_flipped.py ${BASELINE_DIR}/test_1d_marker_not_shown_if_xaxis_flipped.png ) @@ -224,25 +224,25 @@ add_test(vcs_test_taylor_2_quads # These test actually plot things need sample data if (CDAT_DOWNLOAD_SAMPLE_DATA) add_test(vcs_test_plot_file_varible - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcs/test_vcs_plot_file_var.py ) FOREACH(gm boxfill isofill isoline vector meshfill yxvsx xvsy xyvsy 1d scatter) add_test(vcs_test_basic_${gm}_zero - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcs/test_vcs_basic_gms.py --gm_type=${gm} --zero "--source=${BASELINE_DIR}/test_vcs_basic_${gm}_zero.png" ) add_test(vcs_test_basic_${gm} - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcs/test_vcs_basic_gms.py --gm_type=${gm} "--source=${BASELINE_DIR}/test_vcs_basic_${gm}.png" ) add_test(vcs_test_basic_${gm}_masked - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcs/test_vcs_basic_gms.py --gm_type=${gm} --mask @@ -253,7 +253,7 @@ add_test(vcs_test_taylor_2_quads FOREACH(gm boxfill isofill isoline vector meshfill ) FOREACH(ptype 0 -3 aeqd) add_test(vcs_test_basic_${gm}_masked_${ptype}_proj - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcs/test_vcs_basic_gms.py --gm_type=${gm} --mask @@ -261,7 +261,7 @@ add_test(vcs_test_taylor_2_quads "--source=${BASELINE_DIR}/test_vcs_basic_${gm}_masked_${ptype}_proj.png" ) add_test(vcs_test_basic_${gm}_${ptype}_proj_SH - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcs/test_vcs_basic_gms.py --gm_type=${gm} --projection=${ptype} @@ -270,7 +270,7 @@ add_test(vcs_test_taylor_2_quads "--source=${BASELINE_DIR}/test_vcs_basic_${gm}_${ptype}_proj_SH.png" ) add_test(vcs_test_basic_${gm}_${ptype}_proj_SH_-180_180 - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcs/test_vcs_basic_gms.py --gm_type=${gm} --projection=${ptype} @@ -281,7 +281,7 @@ add_test(vcs_test_taylor_2_quads "--source=${BASELINE_DIR}/test_vcs_basic_${gm}_${ptype}_proj_SH_-180_180.png" ) add_test(vcs_test_basic_${gm}_${ptype}_proj_SH_0_360 - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcs/test_vcs_basic_gms.py --gm_type=${gm} --projection=${ptype} @@ -292,7 +292,7 @@ add_test(vcs_test_taylor_2_quads "--source=${BASELINE_DIR}/test_vcs_basic_${gm}_${ptype}_proj_SH_0_360.png" ) add_test(vcs_test_basic_${gm}_${ptype}_proj_NH - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcs/test_vcs_basic_gms.py --gm_type=${gm} --projection=${ptype} @@ -301,7 +301,7 @@ add_test(vcs_test_taylor_2_quads "--source=${BASELINE_DIR}/test_vcs_basic_${gm}_${ptype}_proj_NH.png" ) add_test(vcs_test_basic_${gm}_${ptype}_proj_SH_gm - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcs/test_vcs_basic_gms.py --gm_type=${gm} --projection=${ptype} @@ -311,7 +311,7 @@ add_test(vcs_test_taylor_2_quads "--source=${BASELINE_DIR}/test_vcs_basic_${gm}_${ptype}_proj_SH_via_gm.png" ) add_test(vcs_test_basic_${gm}_${ptype}_proj_SH_-180_180_gm - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcs/test_vcs_basic_gms.py --gm_type=${gm} --projection=${ptype} @@ -323,7 +323,7 @@ add_test(vcs_test_taylor_2_quads "--source=${BASELINE_DIR}/test_vcs_basic_${gm}_${ptype}_proj_SH_-180_180_via_gm.png" ) add_test(vcs_test_basic_${gm}_${ptype}_proj_SH_0_360_gm - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcs/test_vcs_basic_gms.py --gm_type=${gm} --projection=${ptype} @@ -335,7 +335,7 @@ add_test(vcs_test_taylor_2_quads "--source=${BASELINE_DIR}/test_vcs_basic_${gm}_${ptype}_proj_SH_0_360_via_gm.png" ) add_test(vcs_test_basic_${gm}_${ptype}_proj_NH_gm - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcs/test_vcs_basic_gms.py --gm_type=${gm} --projection=${ptype} @@ -345,7 +345,7 @@ add_test(vcs_test_taylor_2_quads "--source=${BASELINE_DIR}/test_vcs_basic_${gm}_${ptype}_proj_NH_via_gm.png" ) add_test(vcs_test_basic_${gm}_${ptype}_proj_NH_gm_flip - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcs/test_vcs_basic_gms.py --gm_type=${gm} --projection=${ptype} @@ -358,77 +358,77 @@ add_test(vcs_test_taylor_2_quads ENDFOREACH(ptype) ENDFOREACH(gm) add_test(vcs_test_isoline_numpy - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcs/test_vcs_isoline_numpy.py ${BASELINE_DIR}/test_vcs_isoline_numpy.png ) add_test(vcs_test_meshfill_draw_mesh - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcs/test_meshfill_draw_mesh.py ${BASELINE_DIR}/test_meshfill_draw_mesh.png ) add_test(vcs_test_oned_level_axis - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcs/test_oned_level_axis.py "${BASELINE_DIR}/test_oned_level_axis.png" ) add_test(vcs_test_${gm}_patterns - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcs/test_vcs_patterns.py "${BASELINE_DIR}/test_vcs_patterns.png" ) add_test(vcs_test_first_png_blank - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcs/test_first_png_blank.py "${BASELINE_DIR}/first_png_blank.png" ) # add_test(vcs_test_aspect_ratio - # ${CMAKE_INSTALL_PREFIX}/bin/python + # "${PYTHON_EXECUTABLE}" # ${cdat_SOURCE_DIR}/testing/vcs/test_aspect_ratio.py # ${cdat_SOURCE_DIR}/testing/vcs/test_aspect_ratio.py # ) add_test(vcs_test_polar_set_opt_param_polar - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcs/test_polar_set_opt_param_polar.py "${BASELINE_DIR}/test_polar_set_opt_param_polar.png" ) add_test(vcs_test_boxfill_lev1_lev2 - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcs/test_boxfill_lev1_lev2.py "${BASELINE_DIR}/test_boxfill_lev1_lev2.png" ) add_test(vcs_test_boxfill_lev1_lev2_ext1 - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcs/test_boxfill_lev1_lev2_ext1.py "${BASELINE_DIR}/test_boxfill_lev1_lev2_ext1.png" ) add_test(vcs_test_boxfill_lev1_lev2_ext2 - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcs/test_boxfill_lev1_lev2_ext2.py "${BASELINE_DIR}/test_boxfill_lev1_lev2_ext2.png" ) add_test(vcs_test_boxfill_lev1_lev2_ext1_ext2 - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcs/test_boxfill_lev1_lev2_ext1_ext2.py "${BASELINE_DIR}/test_boxfill_lev1_lev2_ext1_ext2.png" ) FOREACH(flip None X XY Y) add_test(vcs_test_flip${flip} - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcs/test_vcs_flip${flip}.py "${BASELINE_DIR}/test_vcs_flip${flip}.png" ) ENDFOREACH(flip) add_test(vcs_test_boxfill_lev1_lev2_ta_missing - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcs/test_boxfill_lev1_lev2_ta_missing.py "${BASELINE_DIR}/test_boxfill_lev1_lev2_ta_missing.png" ) add_test(vcs_test_close - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcs/test_vcs_close.py "${BASELINE_DIR}/test_vcs_close.png" ) @@ -441,7 +441,7 @@ add_test(vcs_test_taylor_2_quads "--source=${BASELINE_DIR}/test_vcs_basic_isofill_bigvalues.png" ) add_test(vcs_test_issue_960_labels - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcs/test_vcs_issue_960_labels.py ${BASELINE_DIR}/test_vcs_issue_960_labels_1.png ${BASELINE_DIR}/test_vcs_issue_960_labels_2.png diff --git a/testing/vcs/test_aspect_ratio.py b/testing/vcs/test_aspect_ratio.py index d05d0aac7f..dc2f4680c4 100644 --- a/testing/vcs/test_aspect_ratio.py +++ b/testing/vcs/test_aspect_ratio.py @@ -11,7 +11,7 @@ sys.path.append(pth) import checkimage -f=cdms2.open(os.path.join(sys.prefix,"sample_data","clt.nc")) +f=cdms2.open(os.path.join(vcs.prefix,"sample_data","clt.nc")) s=f("clt",time=slice(0,1),squeeze=1) gm=vcs.createisofill() diff --git a/testing/vcs/test_boxfill_lev1_lev2.py b/testing/vcs/test_boxfill_lev1_lev2.py index f449ebd305..b45fe3cd8a 100644 --- a/testing/vcs/test_boxfill_lev1_lev2.py +++ b/testing/vcs/test_boxfill_lev1_lev2.py @@ -6,7 +6,7 @@ import checkimage x=vcs.init() x.drawlogooff() -f=cdms2.open(sys.prefix+"/sample_data/clt.nc") +f=cdms2.open(vcs.prefix+"/sample_data/clt.nc") s=f("clt",slice(0,1),squeeze=1) b=x.createboxfill() b.level_1=.5 diff --git a/testing/vcs/test_boxfill_lev1_lev2_ext1.py b/testing/vcs/test_boxfill_lev1_lev2_ext1.py index f74cbe8f47..2511bf654f 100644 --- a/testing/vcs/test_boxfill_lev1_lev2_ext1.py +++ b/testing/vcs/test_boxfill_lev1_lev2_ext1.py @@ -6,7 +6,7 @@ import checkimage x=vcs.init() x.drawlogooff() -f=cdms2.open(sys.prefix+"/sample_data/clt.nc") +f=cdms2.open(vcs.prefix+"/sample_data/clt.nc") s=f("clt",slice(0,1),squeeze=1) b=x.createboxfill() b.level_1=20 diff --git a/testing/vcs/test_boxfill_lev1_lev2_ext1_ext2.py b/testing/vcs/test_boxfill_lev1_lev2_ext1_ext2.py index 8367ca0d14..f3f4fc2a14 100644 --- a/testing/vcs/test_boxfill_lev1_lev2_ext1_ext2.py +++ b/testing/vcs/test_boxfill_lev1_lev2_ext1_ext2.py @@ -6,7 +6,7 @@ import checkimage x=vcs.init() x.drawlogooff() -f=cdms2.open(sys.prefix+"/sample_data/clt.nc") +f=cdms2.open(vcs.prefix+"/sample_data/clt.nc") s=f("clt",slice(0,1),squeeze=1) b=x.createboxfill() b.level_1=20 diff --git a/testing/vcs/test_boxfill_lev1_lev2_ext2.py b/testing/vcs/test_boxfill_lev1_lev2_ext2.py index 8ccafb35ae..7cd6ad1d7e 100644 --- a/testing/vcs/test_boxfill_lev1_lev2_ext2.py +++ b/testing/vcs/test_boxfill_lev1_lev2_ext2.py @@ -6,7 +6,7 @@ import checkimage x=vcs.init() x.drawlogooff() -f=cdms2.open(sys.prefix+"/sample_data/clt.nc") +f=cdms2.open(vcs.prefix+"/sample_data/clt.nc") s=f("clt",slice(0,1),squeeze=1) b=x.createboxfill() b.level_1=20 diff --git a/testing/vcs/test_boxfill_lev1_lev2_ta_missing.py b/testing/vcs/test_boxfill_lev1_lev2_ta_missing.py index b076d595a2..b72c113ac9 100644 --- a/testing/vcs/test_boxfill_lev1_lev2_ta_missing.py +++ b/testing/vcs/test_boxfill_lev1_lev2_ta_missing.py @@ -7,7 +7,7 @@ x=vcs.init() x.drawlogooff() x.setbgoutputdimensions(1200,1091,units="pixels") -f=cdms2.open(sys.prefix+"/sample_data/ta_ncep_87-6-88-4.nc") +f=cdms2.open(vcs.prefix+"/sample_data/ta_ncep_87-6-88-4.nc") s=f("ta",slice(0,1),longitude=slice(34,35),squeeze=1)-273.15 s=cdms2.MV2.masked_less(s,-45.) b=x.createboxfill() diff --git a/testing/vcs/test_first_png_blank.py b/testing/vcs/test_first_png_blank.py index e3d4c62407..e9708a4b08 100644 --- a/testing/vcs/test_first_png_blank.py +++ b/testing/vcs/test_first_png_blank.py @@ -4,7 +4,7 @@ pth = os.path.join(os.path.dirname(__file__),"..") sys.path.append(pth) import checkimage -f=cdms2.open(os.path.join(sys.prefix,"sample_data","clt.nc")) +f=cdms2.open(os.path.join(vcs.prefix,"sample_data","clt.nc")) T=f('clt') v = vcs.init() v.setbgoutputdimensions(1200,1091,units="pixels") diff --git a/testing/vcs/test_meshfill_draw_mesh.py b/testing/vcs/test_meshfill_draw_mesh.py index d440af6435..3953699d6f 100644 --- a/testing/vcs/test_meshfill_draw_mesh.py +++ b/testing/vcs/test_meshfill_draw_mesh.py @@ -6,7 +6,7 @@ x=vcs.init() x.setbgoutputdimensions(1200,1091,units="pixels") x.drawlogooff() -fnmcurv = os.path.join(sys.prefix,"sample_data",'sampleCurveGrid4.nc') +fnmcurv = os.path.join(vcs.prefix,"sample_data",'sampleCurveGrid4.nc') f=cdms2.open(fnmcurv) s=f("sample") diff --git a/testing/vcs/test_oned_level_axis.py b/testing/vcs/test_oned_level_axis.py index 3bd782acca..80250d8e9d 100644 --- a/testing/vcs/test_oned_level_axis.py +++ b/testing/vcs/test_oned_level_axis.py @@ -8,7 +8,7 @@ sys.path.append(pth) import checkimage -f=cdms2.open(os.path.join(sys.prefix,"sample_data","ta_ncep_87-6-88-4.nc")) +f=cdms2.open(os.path.join(vcs.prefix,"sample_data","ta_ncep_87-6-88-4.nc")) ta=f("ta",time=slice(0,1),squeeze=1) ta=cdutil.averager(ta,axis="yx") x=vcs.init() diff --git a/testing/vcs/test_polar_set_opt_param_polar.py b/testing/vcs/test_polar_set_opt_param_polar.py index 6094660f74..0c70e5afab 100644 --- a/testing/vcs/test_polar_set_opt_param_polar.py +++ b/testing/vcs/test_polar_set_opt_param_polar.py @@ -9,7 +9,7 @@ sys.path.append(pth) import checkimage -f=cdms2.open(os.path.join(sys.prefix,'sample_data','clt.nc')) +f=cdms2.open(os.path.join(vcs.prefix,'sample_data','clt.nc')) s=f("clt",slice(0,1),squeeze=1) x=vcs.init() x.drawlogooff() diff --git a/testing/vcs/test_vcs_basic_gms.py b/testing/vcs/test_vcs_basic_gms.py index 1b11a5ad7f..1e9b1d0150 100644 --- a/testing/vcs/test_vcs_basic_gms.py +++ b/testing/vcs/test_vcs_basic_gms.py @@ -76,9 +76,9 @@ if args.rg: nm_xtra+="_via_gm" if gm_type=="meshfill": - f=cdms2.open(os.path.join(sys.prefix,'sample_data','sampleCurveGrid4.nc')) + f=cdms2.open(os.path.join(vcs.prefix,'sample_data','sampleCurveGrid4.nc')) else: - f=cdms2.open(os.path.join(sys.prefix,'sample_data','clt.nc')) + f=cdms2.open(os.path.join(vcs.prefix,'sample_data','clt.nc')) if gm_type=="vector": u=f("u",**xtra) v=f("v",**xtra) diff --git a/testing/vcs/test_vcs_close.py b/testing/vcs/test_vcs_close.py index d7c7b9235f..9876b77841 100644 --- a/testing/vcs/test_vcs_close.py +++ b/testing/vcs/test_vcs_close.py @@ -4,7 +4,7 @@ #src=sys.argv[1] pth = os.path.join(os.path.dirname(__file__),"..") sys.path.append(pth) -cdmsfile = cdms2.open(sys.prefix+"/sample_data/clt.nc") +cdmsfile = cdms2.open(vcs.prefix+"/sample_data/clt.nc") data = cdmsfile('clt') x = vcs.init() x.plot(data, bg=1) diff --git a/testing/vcs/test_vcs_flipNone.py b/testing/vcs/test_vcs_flipNone.py index 55c91ee66d..287aa5fcf5 100644 --- a/testing/vcs/test_vcs_flipNone.py +++ b/testing/vcs/test_vcs_flipNone.py @@ -9,7 +9,7 @@ x.setbgoutputdimensions(1200,1091,units="pixels") -f=cdms2.open(os.path.join(sys.prefix,"sample_data","ta_ncep_87-6-88-4.nc")) +f=cdms2.open(os.path.join(vcs.prefix,"sample_data","ta_ncep_87-6-88-4.nc")) vr = "ta" diff --git a/testing/vcs/test_vcs_flipX.py b/testing/vcs/test_vcs_flipX.py index 443c3cfbeb..2f18c19166 100644 --- a/testing/vcs/test_vcs_flipX.py +++ b/testing/vcs/test_vcs_flipX.py @@ -9,7 +9,7 @@ x.setbgoutputdimensions(1200,1091,units="pixels") -f=cdms2.open(os.path.join(sys.prefix,"sample_data","ta_ncep_87-6-88-4.nc")) +f=cdms2.open(os.path.join(vcs.prefix,"sample_data","ta_ncep_87-6-88-4.nc")) vr = "ta" diff --git a/testing/vcs/test_vcs_flipXY.py b/testing/vcs/test_vcs_flipXY.py index ae0be999fe..d3553237a0 100644 --- a/testing/vcs/test_vcs_flipXY.py +++ b/testing/vcs/test_vcs_flipXY.py @@ -9,7 +9,7 @@ x.setbgoutputdimensions(1200,1091,units="pixels") -f=cdms2.open(os.path.join(sys.prefix,"sample_data","ta_ncep_87-6-88-4.nc")) +f=cdms2.open(os.path.join(vcs.prefix,"sample_data","ta_ncep_87-6-88-4.nc")) vr = "ta" diff --git a/testing/vcs/test_vcs_flipY.py b/testing/vcs/test_vcs_flipY.py index 48d85159c7..f9e73cfd2d 100644 --- a/testing/vcs/test_vcs_flipY.py +++ b/testing/vcs/test_vcs_flipY.py @@ -9,7 +9,7 @@ x.setbgoutputdimensions(1200,1091,units="pixels") -f=cdms2.open(os.path.join(sys.prefix,"sample_data","ta_ncep_87-6-88-4.nc")) +f=cdms2.open(os.path.join(vcs.prefix,"sample_data","ta_ncep_87-6-88-4.nc")) vr = "ta" diff --git a/testing/vcs/test_vcs_isoline_numpy.py b/testing/vcs/test_vcs_isoline_numpy.py index 0bac748145..70f2335db4 100644 --- a/testing/vcs/test_vcs_isoline_numpy.py +++ b/testing/vcs/test_vcs_isoline_numpy.py @@ -6,7 +6,7 @@ x=vcs.init() x.setbgoutputdimensions(1200,1091,units="pixels") x.drawlogooff() -fnm = os.path.join(sys.prefix,"sample_data",'clt.nc') +fnm = os.path.join(vcs.prefix,"sample_data",'clt.nc') f=cdms2.open(fnm) s=f("clt") diff --git a/testing/vcs/test_vcs_issue_960_labels.py b/testing/vcs/test_vcs_issue_960_labels.py index 085a66f5bb..59eb9c3511 100644 --- a/testing/vcs/test_vcs_issue_960_labels.py +++ b/testing/vcs/test_vcs_issue_960_labels.py @@ -8,7 +8,7 @@ x=vcs.init() x.drawlogooff() x.setbgoutputdimensions(1200,1091,units="pixels") -f=cdms2.open(os.path.join(sys.prefix,"sample_data","clt.nc")) +f=cdms2.open(os.path.join(vcs.prefix,"sample_data","clt.nc")) s=f("clt",time=slice(0,1),latitude=(-7,5),squeeze=1) x.plot(s,bg=1) fnm = "test_vcs_issue_960_labels_1.png" diff --git a/testing/vcs/test_vcs_patterns.py b/testing/vcs/test_vcs_patterns.py index 9317cf8086..be8ae42949 100644 --- a/testing/vcs/test_vcs_patterns.py +++ b/testing/vcs/test_vcs_patterns.py @@ -4,7 +4,7 @@ pth = os.path.join(os.path.dirname(__file__),"..") sys.path.append(pth) import checkimage -f=cdms2.open(sys.prefix+"/sample_data/clt.nc") +f=cdms2.open(vcs.prefix+"/sample_data/clt.nc") s=f("clt",time=slice(0,1),squeeze=1) x=vcs.init() x.drawlogooff() diff --git a/testing/vcs/test_vcs_plot_file_var.py b/testing/vcs/test_vcs_plot_file_var.py index 101ea57b13..988dd06ef1 100644 --- a/testing/vcs/test_vcs_plot_file_var.py +++ b/testing/vcs/test_vcs_plot_file_var.py @@ -2,7 +2,7 @@ import os import sys import cdms2 -f=cdms2.open(os.path.join(sys.prefix,"sample_data","clt.nc")) +f=cdms2.open(os.path.join(vcs.prefix,"sample_data","clt.nc")) V=f("clt") x=vcs.init() x.plot(V,bg=1) diff --git a/testing/vcs/test_vcs_setcolormap.py b/testing/vcs/test_vcs_setcolormap.py index f532a816cd..6fe94df9af 100644 --- a/testing/vcs/test_vcs_setcolormap.py +++ b/testing/vcs/test_vcs_setcolormap.py @@ -9,7 +9,7 @@ sys.path.append(checkImagePath) import checkimage -cdmsfile = cdms2.open(os.path.join(sys.prefix,"sample_data","clt.nc")) +cdmsfile = cdms2.open(os.path.join(vcs.prefix,"sample_data","clt.nc")) data = cdmsfile('clt') x=vcs.init() diff --git a/testing/vcs/test_vcs_vectors_missing.py b/testing/vcs/test_vcs_vectors_missing.py index 89407671eb..ce95654181 100644 --- a/testing/vcs/test_vcs_vectors_missing.py +++ b/testing/vcs/test_vcs_vectors_missing.py @@ -38,7 +38,7 @@ xtra = {} import cdms2 import os -f=cdms2.open(os.path.join(sys.prefix,"sample_data","clt.nc")) +f=cdms2.open(os.path.join(vcs.prefix,"sample_data","clt.nc")) u=f("u") v=f("v") u=MV2.masked_greater(u,35.) diff --git a/testing/vcs_legacy/CMakeLists.txt b/testing/vcs_legacy/CMakeLists.txt index 201b2ed97c..5cffa4b10c 100644 --- a/testing/vcs_legacy/CMakeLists.txt +++ b/testing/vcs_legacy/CMakeLists.txt @@ -1,6 +1,6 @@ #This test verifiy we can plot hurricane markers add_test(vcs_verify_hurricane_marker - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcs/test_vcs_hurricane_marker.py "${UVCDAT_GIT_TESTDATA_DIR}/baselines/vcs_legacy/test_vcs_hurricane_marker.png" ) diff --git a/testing/vcsaddons/CMakeLists.txt b/testing/vcsaddons/CMakeLists.txt index e26e2eea10..066e920164 100644 --- a/testing/vcsaddons/CMakeLists.txt +++ b/testing/vcsaddons/CMakeLists.txt @@ -1,44 +1,44 @@ set(BASELINE_DIR "${UVCDAT_GIT_TESTDATA_DIR}/baselines/vcsaddons") add_test(vcs_addons_preview_2x2 - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcsaddons/test_vcsaddons_preview_2x2.py ${BASELINE_DIR}/test_vcsaddons_preview_2x2.png ) add_test(vcs_addons_test_12_plot_one_leg_per_row - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcsaddons/test_12_plot_one_leg_per_row.py ${BASELINE_DIR}/test_12_plot_one_leg_per_row.png ) add_test(vcs_addons_test_12_plot_one_leg_per_row_right - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcsaddons/test_12_plot_one_leg_per_row_right.py ${BASELINE_DIR}/test_12_plot_one_leg_per_row_right.png ) add_test(vcs_addons_test_EzTemplate_12_plots_margins_thickness - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcsaddons/test_EzTemplate_12_plots_margins_thickness.py ${BASELINE_DIR}/test_EzTemplate_12_plots_margins_thickness.png ) add_test(vcs_addons_test_EzTemplate_12_plots_legd_direction - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcsaddons/test_EzTemplate_12_plots_legd_direction.py ${BASELINE_DIR}/test_EzTemplate_12_plots_legd_direction.png ) add_test(vcs_addons_test_EzTemplate_12_plots_mix_glb_local - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcsaddons/test_EzTemplate_12_plots_mix_glb_local.py ${BASELINE_DIR}/test_EzTemplate_12_plots_mix_glb_local.png ) add_test(vcs_addons_test_EzTemplate_12_plots_spacing - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcsaddons/test_EzTemplate_12_plots_spacing.py ${BASELINE_DIR}/test_EzTemplate_12_plots_spacing.png ) if (CDAT_DOWNLOAD_SAMPLE_DATA) add_test(vcs_addons_EzTemplate_2x2 - ${CMAKE_INSTALL_PREFIX}/bin/python + "${PYTHON_EXECUTABLE}" ${cdat_SOURCE_DIR}/testing/vcsaddons/test_vcs_addons_EzTemplate_2x2.py ${BASELINE_DIR}/test_vcs_addons_EzTemplate_2x2.png ) diff --git a/testing/vcsaddons/test_vcs_addons_EzTemplate_2x2.py b/testing/vcsaddons/test_vcs_addons_EzTemplate_2x2.py index 199758d87f..d7fb5d58a9 100644 --- a/testing/vcsaddons/test_vcs_addons_EzTemplate_2x2.py +++ b/testing/vcsaddons/test_vcs_addons_EzTemplate_2x2.py @@ -9,7 +9,7 @@ import vcsaddons import cdms2 -f=cdms2.open(os.path.join(sys.prefix,'sample_data','clt.nc')) +f=cdms2.open(os.path.join(vcs.prefix,'sample_data','clt.nc')) s=f("clt",time=slice(0,1),squeeze=1) bg = True diff --git a/tests/cdat/test_cdat.py b/tests/cdat/test_cdat.py index 4dcd177423..3c87d0c0bf 100644 --- a/tests/cdat/test_cdat.py +++ b/tests/cdat/test_cdat.py @@ -233,7 +233,7 @@ def run_dir(test_dir,lst): def run_test(test): wd, test = os.path.split(test) - cmd = 'cd %s ; %s %s' % (wd , os.path.join(sys.prefix,'bin','python'),test) + cmd = 'cd %s ; %s %s' % (wd, sys.executable, test) if o.full_testing: cmd+=' --full --extended' if o.extended_testing: