diff --git a/mlair/data_handler/data_handler_mixed_sampling.py b/mlair/data_handler/data_handler_mixed_sampling.py index 71f9fe732e306b76f24f1f1455fc8830cf1492e1..718a8f3ecf6a799cfab3c273a525f05d07132627 100644 --- a/mlair/data_handler/data_handler_mixed_sampling.py +++ b/mlair/data_handler/data_handler_mixed_sampling.py @@ -194,13 +194,32 @@ class DataHandlerMixedSamplingWithFirFilterSingleStation(DataHandlerMixedSamplin _requirements = list(set(_requirements1 + _requirements2)) def estimate_filter_width(self): - """ """ - return 5 # Todo: adjust this method + """Filter width is determined by the filter with the highest order.""" + return max(self.filter_order) def _extract_lazy(self, lazy_data): _data, _meta, _input_data, _target_data, self.fir_coeff = lazy_data super(__class__, self)._extract_lazy((_data, _meta, _input_data, _target_data)) + @staticmethod + def _get_fs(**kwargs): + """Return frequency in 1/day (not Hz)""" + sampling = kwargs.get("sampling")[0] + if sampling == "daily": + return 1 + elif sampling == "hourly": + return 24 + else: + raise ValueError(f"Unknown sampling rate {sampling}. Only daily and hourly resolution is supported.") + + +class DataHandlerMixedSamplingWithFirFilter(DefaultDataHandler): + """Data handler using mixed sampling for input and target. Inputs are temporal filtered.""" + + data_handler = DataHandlerMixedSamplingWithFirFilterSingleStation + data_handler_transformation = DataHandlerMixedSamplingWithFirFilterSingleStation + _requirements = data_handler.requirements() + class DataHandlerSeparationOfScalesSingleStation(DataHandlerMixedSamplingWithKzFilterSingleStation): """