Skip to content
Snippets Groups Projects
Commit 4bc1679f authored by Falco Weichselbaum's avatar Falco Weichselbaum
Browse files

ValueErrors raised when timeseries (history, label or observation) only consists of NaN

parent 8bf828f0
No related branches found
No related tags found
7 merge requests!361name of pdf starts now with feature_importance, there is now also another...,!357update with current devs,!355name of pdf starts now with feature_importance, there is now also another...,!353add developments to release v1.5.0,!352Resolve "release v1.5.0",!350Resolve "upgrade code to TensorFlow V2",!325Resolve "raise ValueError in remove_nan(), if data is NaN only"
Pipeline #76309 passed with warnings
......@@ -586,9 +586,16 @@ class DataHandlerSingleStation(AbstractDataHandler):
non_nan_history = self.history.dropna(dim=dim)
non_nan_label = self.label.dropna(dim=dim)
non_nan_observation = self.observation.dropna(dim=dim)
if non_nan_label.shape[2] == 0:
raise ValueError(f'self.label consist of NaNs only - station {self.station} is therefore dropped')
if non_nan_history.shape[2] == 0:
raise ValueError(f'self.history consist of NaNs only - station {self.station} is therefore dropped')
if non_nan_observation.shape[2] == 0:
raise ValueError(f'self.observation consist of NaNs only - station {self.station} is therefore dropped')
intersect = reduce(np.intersect1d, (non_nan_history.coords[dim].values, non_nan_label.coords[dim].values,
non_nan_observation.coords[dim].values))
if len(intersect) < max(self.min_length, 1):
self.history = None
self.label = None
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment