From 7d9f303bc375c4630167ddfbc0a8ccc3fe9d099d Mon Sep 17 00:00:00 2001 From: wcarthur Date: Fri, 7 Sep 2018 15:55:51 +1000 Subject: [PATCH] Fixing nctools.ncGetTimes - remove test skips --- .travis.yml | 2 +- Utilities/nctools.py | 2 +- matplotlibrc | 62 ++++++++++++++++++++++++++++++++----------- tests/test_nctools.py | 2 -- 4 files changed, 48 insertions(+), 20 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1407d263..b21b6dff 100644 --- a/.travis.yml +++ b/.travis.yml @@ -55,7 +55,7 @@ branches: - notebooks script: - python installer/setup.py build_ext -i - - nosetests -v --with-coverage + - nosetests -v --with-coverage --cover-package=. after_success: coveralls notifications: slack: diff --git a/Utilities/nctools.py b/Utilities/nctools.py index 23123583..f5777426 100644 --- a/Utilities/nctools.py +++ b/Utilities/nctools.py @@ -193,7 +193,7 @@ def ncGetTimes(ncobj, name='time'): calendar = times.calendar else: calendar = 'standard' - #import pdb; pdb.set_trace() + dates = num2date(times[:].data, units, calendar) return np.array(dates, dtype=datetime) diff --git a/matplotlibrc b/matplotlibrc index f94f6efc..354cb71c 100644 --- a/matplotlibrc +++ b/matplotlibrc @@ -1,23 +1,53 @@ # TCRM Plotting Configuration backend: TkAgg -lines.linewidth: 0.5 -lines.markersize: 1 -font.size: 12.0 -text.color: black -text.antialiased: True -axes.titlesize: large -axes.labelsize: small -axes.labelcolor: black -axes.color_cycle: k, b, g, r, c, m, y + +#### LINES +lines.linewidth : 0.5 +lines.linestyle : - +lines.markersize : 1 +lines.color : C0 + +#### FONTS +font.family : sans-serif +font.size : 10.0 +font.style : normal + + +#### TEXT +text.color : black +text.antialiased : True + +#### AXES +axes.titlesize : large +axes.labelsize : small +axes.labelcolor : black +axes.prop_cycle : cycler('color', ['1f77b4', 'ff7f0e', '2ca02c', 'd62728', '9467bd', '8c564b', 'e377c2', '7f7f7f', 'bcbd22', '17becf']) + +#### LEGEND legend.fancybox: True legend.frameon: True -xtick.direction: out -ytick.direction: out -xtick.labelsize: x-small -ytick.labelsize: x-small + +#### TICKS +xtick.direction : out +ytick.direction : out +xtick.labelsize : x-small +ytick.labelsize : x-small + +#### CONTOURS contour.negative_linestyle: dashed -figure.dpi: 300 -figure.figsize: 16, 12 + +#### GRIDS +grid.color : 808080 +grid.linestyle : -- +grid.linewidth : 0.5 +grid.alpha : 0.75 + +#### FIGURES +figure.dpi : 300 +figure.figsize : 12, 8 figure.subplot.left: 0.0675 figure.subplot.right: 0.9125 -image.cmap: Blues \ No newline at end of file + +#### IMAGES +image.aspect : equal +image.cmap : viridis \ No newline at end of file diff --git a/tests/test_nctools.py b/tests/test_nctools.py index 2acccf29..b36b7b38 100644 --- a/tests/test_nctools.py +++ b/tests/test_nctools.py @@ -412,7 +412,6 @@ def test_ncReadFile(self): self.numpyAssertEqual(temp_check, temp[nrec]) ncobj.close() - #@unittest.skip("Raises value error in netCDF4 v1.4") def test_ncGetTimes(self): """Test ncGetTimes returns datetime objects""" ncobj = netCDF4.Dataset(self.ncfile) @@ -420,7 +419,6 @@ def test_ncGetTimes(self): ncobj.close() self.assertEqual(type(times[0]), datetime) - #@unittest.skip("Raises value error in netCDF4 v1.4") def test_ncGetTimeValues(self): """Test ncGetTimes returns correct time values""" ncobj = netCDF4.Dataset(self.ncfile)