diff --git a/wetb/prepost/simchunks.py b/wetb/prepost/simchunks.py index 8f8c93ddaa045c0799e39af5687d6cf5aa750382..71c65fc61099f2269eea5b3957b004cb286bd471 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 4107cc45b694b64fc51d8a44b9389c6573474147..f194b50cc949095d98b179a6d2f7666de26e35c9 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)