Skip to content
Snippets Groups Projects
Commit cd47dfa7 authored by lukas leufen's avatar lukas leufen
Browse files

apply proposed changes

parent 37d08255
Branches
Tags
5 merge requests!468first implementation of toar-data-v2, can load data (but cannot process these...,!467Resolve "release v2.2.0",!442Develop,!441Resolve "climateFIR empty data after sel_opts",!440Resolve "Load data from ToarDB V2"
Pipeline #105075 passed
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment