From a99da0a3e15c61ce4923852d93cf877fd602f074 Mon Sep 17 00:00:00 2001
From: leufen1 <l.leufen@fz-juelich.de>
Date: Wed, 24 May 2023 13:50:05 +0200
Subject: [PATCH] add dropna calls

---
 mlair/helpers/filter.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mlair/helpers/filter.py b/mlair/helpers/filter.py
index 097eaf97..f834895d 100644
--- a/mlair/helpers/filter.py
+++ b/mlair/helpers/filter.py
@@ -382,7 +382,7 @@ class ClimateFIRFilter(FIRFilter):
                                monthly_mean.sel(month=month, drop=True),
                                monthly)
         # transform monthly information into original sampling rate
-        return monthly.resample({time_dim: sampling}).interpolate()
+        return monthly.dropna(dim=time_dim).resample({time_dim: sampling}).interpolate()
 
     @staticmethod
     def _compute_hourly_mean_per_month(data: xr.DataArray, time_dim: str, as_anomaly: bool) -> Dict[int, xr.DataArray]:
@@ -422,7 +422,7 @@ class ClimateFIRFilter(FIRFilter):
         for month in means.keys():
             hourly_mean_single_month = means[month].sel(hour=hour, drop=True)
             h_coll = xr.where((h_coll[f"{time_dim}.month"] == month), hourly_mean_single_month, h_coll)
-        h_coll = h_coll.resample({time_dim: sampling}).interpolate()
+        h_coll = h_coll.dropna(time_dim).resample({time_dim: sampling}).interpolate()
         h_coll = h_coll.sel({time_dim: (h_coll[f"{time_dim}.hour"] == hour)})
         return h_coll
 
-- 
GitLab