From 202d9baa0ec517385994ccae792208608789682b Mon Sep 17 00:00:00 2001
From: leufen1 <l.leufen@fz-juelich.de>
Date: Thu, 6 May 2021 11:20:37 +0200
Subject: [PATCH] add log statement to track progress

---
 mlair/helpers/filter.py | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/mlair/helpers/filter.py b/mlair/helpers/filter.py
index df5522da..1e864ee8 100644
--- a/mlair/helpers/filter.py
+++ b/mlair/helpers/filter.py
@@ -260,9 +260,10 @@ class ClimateFIRFilter:
         future = self._shift_data(apriori, range(1, length + 1), time_dim, var_dim, new_dim)
         filter_input_data = history.combine_first(future)
 
+        time_axis = filter_input_data.coords["datetime"]
         # apply vectorized fir filter along the tmp dimension
-        filt = xr.apply_ufunc(fir_filter_vectorized, filter_input_data,
-                              input_core_dims=[[new_dim]], output_core_dims=[[new_dim]], vectorize=True,
+        filt = xr.apply_ufunc(fir_filter_vectorized, filter_input_data, time_axis,
+                              input_core_dims=[[new_dim], []], output_core_dims=[[new_dim]], vectorize=True,
                               kwargs={"fs": fs, "cutoff_high": cutoff_high, "order": order,
                                       "causal": False, "padlen": int(min(padlen_factor, 1) * length)})
 
@@ -382,9 +383,13 @@ def fir_filter(data, fs, order=5, cutoff_low=None, cutoff_high=None, window="ham
     return filtered, h
 
 
-def fir_filter_vectorized(data, fs, order=5, cutoff_low=None, cutoff_high=None, window="hamming", h=None, causal=True,
+def fir_filter_vectorized(data, time_stamp, fs, order=5, cutoff_low=None, cutoff_high=None, window="hamming", h=None,
+                          causal=True,
                           padlen=None):
     """Expects numpy array."""
+    pd_date = pd.to_datetime(time_stamp)
+    if pd_date.day == 1 and pd_date.month in [1, 7]:
+        logging.info(time_stamp)
     sel = ~np.isnan(data)
     res = np.empty_like(data)
     if h is None:
-- 
GitLab