From 8033878350408bf186ee73c9d2e1656aa5d9b0d4 Mon Sep 17 00:00:00 2001 From: Peter Cable Date: Fri, 4 Dec 2015 08:41:37 -0800 Subject: [PATCH] Fix for test_qc_functions.py:test_dataqc_solarelevation timedelta error --- ion_functions/qc/test/test_qc_functions.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ion_functions/qc/test/test_qc_functions.py b/ion_functions/qc/test/test_qc_functions.py index 5eab561..de077b9 100644 --- a/ion_functions/qc/test/test_qc_functions.py +++ b/ion_functions/qc/test/test_qc_functions.py @@ -100,6 +100,7 @@ def test_dataqc_interptest(self): self.assertTrue(np.allclose(np.nan_to_num(got), np.nan_to_num(out), rtol=1e-8, atol=0)) + def test_dataqc_polyvaltest(self): """ Test Numpy polyval function. @@ -271,7 +272,7 @@ def test_dataqc_spiketest(self): got = qcfunc.dataqc_spiketest(dat, acc, N, L) np.testing.assert_array_equal(got,out) - + def test_dataqc_spiketest_extended(self): dat = [-1 , 3 , 40 , -1 , 1 , -6 , -6 , 1 , 2 , 4 , 3 , 1 , -1 , 40 , 1 , 1 , 4 , 2 , 2 , 2 , 1 , 2 , 100] out = [ 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 0 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 0] @@ -603,10 +604,10 @@ def test_dataqc_solarelevation(self): usec = doy * 24 * 60 * 60 * 1e6 #Edited by Craig Risien on 02/12/2014 to fix issue/error using np.timedelta #Changed dt = np.datetime64('2012-01-01') + np.timedelta64(usec) to the following: - dt1 = np.datetime64('2012-01-01') + dt1 = np.datetime64('2012-01-01T00:00:00.000000-0000') dt2 = np.array(usec, dtype='timedelta64[us]') dt = dt1+dt2 - + dt = dt.astype(np.float) / 1e6 z = np.array([87.8905, 39.8829, -0.0847, 0.0847,