From a7b67af92f7f9ce1fad91db3ba6a2a6ca9c91ac5 Mon Sep 17 00:00:00 2001 From: David Robert Verelst <dave@dtu.dk> Date: Sun, 12 Aug 2018 18:22:13 +0200 Subject: [PATCH] more debugging on why 2 tests on runner are not passing --- wetb/prepost/simchunks.py | 6 +++++- wetb/prepost/tests/test_hawcstab2.py | 10 +++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/wetb/prepost/simchunks.py b/wetb/prepost/simchunks.py index 8f8c93d..71c65fc 100644 --- a/wetb/prepost/simchunks.py +++ b/wetb/prepost/simchunks.py @@ -396,7 +396,11 @@ def create_chunks_htc_pbs(cases, sort_by_values=['[Windspeed]'], ppn=20, i0=0, cc = Cases(cases) df = cc.cases2df() # sort on the specified values in the given columns - df.sort_values(by=sort_by_values, inplace=True) + # sort_valures was only added in Pandas 0.17 + try: + df.sort_values(by=sort_by_values, inplace=True) + except AttributeError: + df.sort(columns=sort_by_values, inplace=True) # create the directory to store all zipped chunks try: diff --git a/wetb/prepost/tests/test_hawcstab2.py b/wetb/prepost/tests/test_hawcstab2.py index 4107cc4..f194b50 100644 --- a/wetb/prepost/tests/test_hawcstab2.py +++ b/wetb/prepost/tests/test_hawcstab2.py @@ -122,9 +122,13 @@ class Tests(unittest.TestCase): data = np.loadtxt(fname) self.assertEqual(data.shape, df_data.shape) print(data.dtype) - print(data.values.dtype) - print(data) - print(data.values) + print(df_data.values.dtype) + for i in range(data.shape[0]): + a = data[i,:] + b = df_data.values[i,:] + if not np.allclose(a,b): + print(a-b) + np.testing.assert_almost_equal(a, b) np.testing.assert_almost_equal(data, df_data.values, decimal=6) -- GitLab