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

Merge branch 'lukas_issue399_big_climatefir-empty-data-after-sel_opts' into 'develop'

Resolve "climateFIR empty data after sel_opts"

See merge request !441
parents 37d08255 cd47dfa7
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 #105296 passed
...@@ -214,6 +214,7 @@ class ClimateFIRFilter(FIRFilter): ...@@ -214,6 +214,7 @@ class ClimateFIRFilter(FIRFilter):
h = [] h = []
if self.sel_opts is not None: 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.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)) sampling = {1: "1d", 24: "1H"}.get(int(self.fs))
logging.debug(f"{self.display_name}: create diurnal_anomalies") logging.debug(f"{self.display_name}: create diurnal_anomalies")
if self.apriori_diurnal is True and sampling == "1H": if self.apriori_diurnal is True and sampling == "1H":
...@@ -303,6 +304,10 @@ class ClimateFIRFilter(FIRFilter): ...@@ -303,6 +304,10 @@ class ClimateFIRFilter(FIRFilter):
except Exception as e: except Exception as e:
logging.info(f"Could not plot climate fir filter due to following reason:\n{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 @staticmethod
def _next_order(order: list, minimum_length: Union[int, None], pos: int, window: Union[str, tuple]) -> int: def _next_order(order: list, minimum_length: Union[int, None], pos: int, window: Union[str, tuple]) -> int:
next_order = 0 next_order = 0
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment