Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #238 for @lee1043 based on @durack1 recommendation to not load it… #244

Merged
merged 8 commits into from
Sep 2, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ script:
- git clone git://github.com/uv-cdat/uvcdat-testdata
- cd uvcdat-testdata ; git checkout $TRAVIS_BRANCH ; cd ..
- df -h
- python run_tests.py -n 2 -v2 -g --no-vtk-ui
- python run_tests.py -n 1 -v2 -g --no-vtk-ui
after_success:
- if [ "$TRAVIS_BRANCH" == "master" -a "$TRAVIS_PULL_REQUEST" == "false" ]; then conda install conda-build && conda install anaconda-client && bash scripts/conda_upload.sh ; fi
- if [ "$TRAVIS_BRANCH" == "master" -a "$TRAVIS_PULL_REQUEST" == "false" ]; then conda install conda-build && conda install anaconda-client && bash ci-support/conda_upload.sh ; fi
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions scripts/circleci_mac.sh → ci-support/circleci_mac.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ export UVCDAT_ANONYMOUS_LOG=False
export PATH=${HOME}/miniconda/bin:${PATH}
#export VCS_BACKGROUND=0 # circleci seg faults on bg=1
#python run_tests.py -v2 -g -H -p # -H and -p for collection by artifacts
python run_tests.py -n 2 -v2 -g --no-vtk-ui
python run_tests.py -n 1 -v2 -g --no-vtk-ui
RESULT=$?
echo "test command exit result:",$RESULT
if [ $RESULT -eq 0 -a $CIRCLE_BRANCH == "master" ]; then conda install conda-build anaconda-client ; fi
if [ $RESULT -eq 0 -a $CIRCLE_BRANCH == "master" ]; then bash ./scripts/conda_upload.sh ; fi
if [ $RESULT -eq 0 -a $CIRCLE_BRANCH == "master" ]; then bash ./ci-support/conda_upload.sh ; fi
exit $RESULT

7 changes: 7 additions & 0 deletions ci-support/circleci_mac_dep.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash
ls
pwd
export PATH=${HOME}/miniconda/bin:${PATH}
conda install -c uvcdat/label/nightly -c conda-forge -c uvcdat vtk-cdat cdutil genutil dv3d mesalib nose image-compare flake8 matplotlib
export UVCDAT_ANONYMOUS_LOG=False
python setup.py install --old-and-unmanageable
File renamed without changes.
10 changes: 5 additions & 5 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ general:

checkout:
post:
- ./scripts/checkout_merge_commit.sh
- ./ci-support/checkout_merge_commit.sh

#machine:
machine:
Expand All @@ -20,17 +20,17 @@ machine:
- sudo -H pip install --upgrade virtualenv
- ls
- pwd
- bash vcs/scripts/circleci_mac_machine_pre.sh
- bash vcs/ci-support/circleci_mac_machine_pre.sh
#services:
# - docker

dependencies:
override:
- bash ./scripts/circleci_mac_dep.sh
- bash ./ci-support/circleci_mac_dep.sh
# - docker pull cdat/conda:conda-forge-cdms2


test:
override:
- bash ./scripts/circleci_mac.sh
# - docker run -it -v `pwd`:/git_repo -a STDOUT -a STDERR -P cdat/conda:conda-forge-cdms2 /git_repo/scripts/circle.sh
- bash ./ci-support/circleci_mac.sh
# - docker run -it -v `pwd`:/git_repo -a STDOUT -a STDERR -P cdat/conda:conda-forge-cdms2 /git_repo/ci-support/circle.sh
7 changes: 0 additions & 7 deletions scripts/circleci_mac_dep.sh

This file was deleted.

9 changes: 9 additions & 0 deletions tests/test_vcs_load_mpl_cmaps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import unittest
import vcs
class VCSMPLCmaps(unittest.TestCase):
def testLoadMPLCmaps(self):
import vcs
original = vcs.listelements("colormap")
vcs.utils.loadmatplotlibcolormaps()
mpl = vcs.listelements("colormap")
self.assertGreater(len(mpl),len(original))
2 changes: 1 addition & 1 deletion tests/test_vcs_queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

class TestVCSQueries(unittest.TestCase):
def testVCSQueries(self):
gms = ["boxfill","isofill","isoline","meshfill","scatter","yxvsx","xvsy","xyvsy","vector"]
gms = ["boxfill","isofill","isoline","meshfill","scatter","yxvsx","xvsy","xyvsy","vector","streamline"]
for gm in gms:
print "testing query work for:",gm
exec("g=vcs.create%s()" % gm)
Expand Down
6 changes: 3 additions & 3 deletions vcs/VCS_validation_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -1256,7 +1256,7 @@ def checkTimeUnits(self, name, value):
checkedRaise(self, value, ValueError, value + ' is invalid time units')
sp = value.split('since')[1]
b = cdtime.s2c(sp)
if b == cdtime.comptime(0, 1):
if b.cmp(cdtime.comptime(0, 1)) == 0:
checkedRaise(self, value, ValueError, sp + ' is invalid date')
return value

Expand All @@ -1267,10 +1267,10 @@ def checkDatawc(self, name, value):
value = float(value), 0
elif isinstance(value, str):
t = cdtime.s2c(value)
if t != cdtime.comptime(0, 1):
if t.cmp(cdtime.comptime(0, 1)) != 0:
t = t.torel(self.datawc_timeunits, self.datawc_calendar)
value = float(t.value), 1
else:
else: # Bad string led to 0-1-1
checkedRaise(
self,
value,
Expand Down
10 changes: 10 additions & 0 deletions vcs/colors.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,13 @@ def matplotlib2vcs(cmap, vcs_name=None):
vcs_cmap.setcolorcell(i, *([int(x * 100) for x in cmap_rgbs[i][:4]]))

return vcs_cmap


def loadmatplotlibcolormaps():
"""
Convert all matplotlib colormaps to vcs colormaps
"""
import matplotlib.pyplot as plt
mpl_cmaps = sorted(m for m in plt.cm.datad if not m.endswith("_r"))
for cmap in mpl_cmaps:
matplotlib2vcs(cmap)
4 changes: 3 additions & 1 deletion vcs/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
hasVCSAddons = False


from colors import rgb2str, str2rgb, matplotlib2vcs # noqa
from colors import rgb2str, str2rgb, matplotlib2vcs, loadmatplotlibcolormaps # noqa

indent = 1
sort_keys = True
Expand Down Expand Up @@ -1148,6 +1148,8 @@ def myfunction(d, mx, mn):
if d is None:
return mx, mn
from numpy.ma import maximum, minimum, count
if isinstance(d, (int, float)):
return maximum(d, mx), minimum(d, mn)
try:
if count(d) == 0:
return mx, mn
Expand Down