diff --git a/mlair/helpers/filter.py b/mlair/helpers/filter.py index 30e8132089615bd7d08b9c25c03201d7439723c2..5d2c440d32eed16528e8210c1b044b7d29c19d73 100644 --- a/mlair/helpers/filter.py +++ b/mlair/helpers/filter.py @@ -274,11 +274,15 @@ class ClimateFIRFilter: # plot if self.plot_path is not None: - pos = 720 - filter_example = filter_input_data.isel({time_dim: pos}) - t0 = filter_example.coords[time_dim].values - t_slice = filter_input_data.isel({time_dim: slice(pos - length, pos + length + 1)}).coords[time_dim].values - self.plot(data, filter_example, var_dim, time_dim, t_slice, t0, plot_index) + try: + pos = 720 + filter_example = filter_input_data.isel({time_dim: pos}) + t0 = filter_example.coords[time_dim].values + t_slice = filter_input_data.isel({time_dim: slice(pos - length, pos + length + 1)}).coords[ + time_dim].values + self.plot(data, filter_example, var_dim, time_dim, t_slice, t0, plot_index) + except IndexError: + pass # select only values at tmp dimension 0 at each point in time return filt.sel({new_dim: 0}, drop=True), h, apriori