diff --git a/mlair/data_handler/data_handler_single_station.py b/mlair/data_handler/data_handler_single_station.py index 8e95e76365181ee76f91a91319b912f2626a223a..88a57d108e4533968eeb9a65aabf575fae085704 100644 --- a/mlair/data_handler/data_handler_single_station.py +++ b/mlair/data_handler/data_handler_single_station.py @@ -593,6 +593,12 @@ 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.coords[dim].shape[0] == 0: + raise ValueError(f'self.label consist of NaNs only - station {self.station} is therefore dropped') + if non_nan_history.coords[dim].shape[0] == 0: + raise ValueError(f'self.history consist of NaNs only - station {self.station} is therefore dropped') + if non_nan_observation.coords[dim].shape[0] == 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))