Commit cd47dfa7 authored by lukas leufen's avatar lukas leufen 👻
Browse files

apply proposed changes

parent 37d08255
Pipeline #105075 passed with stages
in 12 minutes and 26 seconds
......@@ -214,6 +214,7 @@ class ClimateFIRFilter(FIRFilter):
h = []
if self.sel_opts is not None:
self.sel_opts = self.sel_opts if isinstance(self.sel_opts, dict) else {self.time_dim: self.sel_opts}
self._check_sel_opts()
sampling = {1: "1d", 24: "1H"}.get(int(self.fs))
logging.debug(f"{self.display_name}: create diurnal_anomalies")
if self.apriori_diurnal is True and sampling == "1H":
......@@ -303,6 +304,10 @@ class ClimateFIRFilter(FIRFilter):
except Exception as e:
logging.info(f"Could not plot climate fir filter due to following reason:\n{e}")
def _check_sel_opts(self):
if len(self.data.sel(**self.sel_opts).coords[self.time_dim]) == 0:
raise ValueError(f"Abort {self.__class__.__name__} as no data is available after applying sel_opts to data")
@staticmethod
def _next_order(order: list, minimum_length: Union[int, None], pos: int, window: Union[str, tuple]) -> int:
next_order = 0
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment