From 9f79f077ba98fa9e33e286e359fab4719a578f96 Mon Sep 17 00:00:00 2001 From: Paige Martin Date: Fri, 27 Aug 2021 11:07:53 +1000 Subject: [PATCH] run code-style checks --- xrft/tests/test_xrft.py | 10 ++++------ xrft/xrft.py | 4 +++- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/xrft/tests/test_xrft.py b/xrft/tests/test_xrft.py index 145eba1d..dc661879 100644 --- a/xrft/tests/test_xrft.py +++ b/xrft/tests/test_xrft.py @@ -351,8 +351,6 @@ def test_window_single_dim(): ps.load() - - class TestSpectrum(object): @pytest.mark.parametrize("dim", ["t", "time"]) @pytest.mark.parametrize("window_correction", [True, False]) @@ -1309,6 +1307,7 @@ def test_reversed_coordinates(): xrft.dft(s, dim="x", true_phase=True), xrft.dft(s2, dim="x", true_phase=True) ) + def test_nondim_coords(): """Error should be raised if there are non-dimensional coordinates attached to the dimension(s) over which the FFT is being taken""" N = 16 @@ -1319,12 +1318,11 @@ def test_nondim_coords(): "time": np.array(["2019-04-18", "2019-04-19"], dtype="datetime64"), "x": range(N), "y": range(N), - "x_nondim":("x",np.arange(N)) + "x_nondim": ("x", np.arange(N)), }, ) - + with pytest.raises(ValueError): xrft.power_spectrum(da) - - xrft.power_spectrum(da,dim=["time","y"]) + xrft.power_spectrum(da, dim=["time", "y"]) diff --git a/xrft/xrft.py b/xrft/xrft.py index e0144903..f7382827 100644 --- a/xrft/xrft.py +++ b/xrft/xrft.py @@ -385,7 +385,9 @@ def fft( # raise error if there are multiple coordinates attached to the dimension(s) over which the FFT is taken for d in dim: - bad_coords = [cname for cname in da.coords if cname != dim and dim in da[cname].dims] + bad_coords = [ + cname for cname in da.coords if cname != dim and dim in da[cname].dims + ] if bad_coords: raise ValueError( f"The input array contains coordinate variable(s) ({bad_coords}) whose dims include the transform dimension(s) `{dim}`. "