diff --git a/mlair/helpers/filter.py b/mlair/helpers/filter.py index bc115988352b599df80908016ae4e7c8a1fcc7e7..f92f3b21a98ecb220163392bbe4c0206237cc6b7 100644 --- a/mlair/helpers/filter.py +++ b/mlair/helpers/filter.py @@ -852,7 +852,6 @@ class ClimateFIRFilter(FIRFilter): filt_input_coll.append(trimmed) # visualization - plot_dates = [filt.coords[time_dim][49].values] plot_data.extend(self.create_visualization(filt, d, filter_input_data, plot_dates, time_dim, new_dim, sampling, extend_length_history, extend_length_future, minimum_length, h, var, extend_opts, extend_end, offset, f)) diff --git a/test/test_helpers/test_filter.py b/test/test_helpers/test_filter.py index dac4100074c4c4570ea4d654bcddc8ece407bd94..5df3b9e48c4d530961d69ebad44331acd487cc9c 100644 --- a/test/test_helpers/test_filter.py +++ b/test/test_helpers/test_filter.py @@ -294,13 +294,13 @@ class TestClimateFIRFilter: def test_trim_data_to_minimum_length(self, xr_array, time_dim): obj = object.__new__(ClimateFIRFilter) xr_array = obj._shift_data(xr_array, range(-20, 1), time_dim, new_dim="window") - res = obj._trim_data_to_minimum_length(xr_array, 5, "window") + res = obj._trim_data_to_minimum_length(xr_array, -5, "window") assert xr_array.shape == (21, 100, 1) assert res.shape == (6, 100, 1) - res = obj._trim_data_to_minimum_length(xr_array, 30, "window") + res = obj._trim_data_to_minimum_length(xr_array, -30, "window") assert res.shape == (21, 100, 1) xr_array = obj._shift_data(xr_array.sel(window=0), range(-20, 5), time_dim, new_dim="window") - res = obj._trim_data_to_minimum_length(xr_array, 5, "window", extend_length_future=2) + res = obj._trim_data_to_minimum_length(xr_array, -5, "window", extend_length_future=2) assert res.shape == (8, 100, 1) def test_create_full_filter_result_array(self, xr_array, time_dim): @@ -321,7 +321,7 @@ class TestClimateFIRFilter: assert len(res) == 5 # check filter data properties - assert res[0].shape == (*xr_array_long_with_var.shape, int(filter_order+1)/2 + 24 + 2) + assert res[0].shape == (*xr_array_long_with_var.shape, 24 + 2) assert res[0].dims == (*xr_array_long_with_var.dims, "window") # check filter properties @@ -351,7 +351,7 @@ class TestClimateFIRFilter: var_dim=var_dim, new_dim="total_new_dim", window=("kaiser", 5), minimum_length=1000, apriori=apriori, plot_dates=plot_dates) - assert res[0].shape == (*xr_array_long_with_var.shape, int(10 * 24 + 1 + 1) / 2 + 1000 + 2) + assert res[0].shape == (*xr_array_long_with_var.shape, 1000 + 2) assert res[0].dims == (*xr_array_long_with_var.dims, "total_new_dim") assert np.testing.assert_almost_equal( res[2], obj._calculate_filter_coefficients(("kaiser", 5), filter_order, 0.05, 24)) is None