diff --git a/mlair/helpers/filter.py b/mlair/helpers/filter.py index 2231fcd25afdc70669b473d4d7be6fef4e66b4f1..b25d6ee10f89bfa49c2147d1758a2d24b8e7687e 100644 --- a/mlair/helpers/filter.py +++ b/mlair/helpers/filter.py @@ -188,10 +188,6 @@ class ClimateFIRFilter(FIRFilter): values (default None). Must either be a dictionary with keys available in var_dim or a single value that is applied to all data. """ - #todo add extend_length_opts - # adjust all parts of code marked as todos - # think about different behaviour when using different extend_length_opts (is this part of dh?) - self._apriori = apriori self.apriori_type = apriori_type self.apriori_diurnal = apriori_diurnal @@ -260,7 +256,7 @@ class ClimateFIRFilter(FIRFilter): input_data = self._shift_data(input_data, coord_range, self.time_dim, new_dim) - fi # create new apriori information for next iteration if no further apriori is provided - if len(apriori_list) < len(self.order): #TODO: is this true? or should it be < i+1 resp. <= i + if len(apriori_list) < len(self.order): logging.info(f"{self.station_name}: create diurnal_anomalies") if self.apriori_diurnal is True and sampling == "1H": diurnal_anomalies = self.create_seasonal_hourly_mean(input_data.sel({new_dim: 0}, drop=True), @@ -631,16 +627,17 @@ class ClimateFIRFilter(FIRFilter): def _trim_data_to_minimum_length(data: xr.DataArray, extend_length_history: int, dim: str, minimum_length: int = None, extend_length_opts: int = 0) -> xr.DataArray: """ - Trim data along given axis between either -minimum_length (if given) or -extend_length_history and 0. + Trim data along given axis between either -minimum_length (if given) or -extend_length_history and + extend_length_opts (which is default set to 0). :param data: data to trim :param extend_length_history: start number for trim range (transformed to negative), only used if parameter minimum_length is not provided :param dim: dim to apply trim on :param minimum_length: start number for trim range (transformed to negative), preferably used (default None) + :param extend_length_opts: number to use in "future" :returns: trimmed data """ - #todo update doc strings if minimum_length is None: return data.sel({dim: slice(-extend_length_history, extend_length_opts)}, drop=True) else: @@ -750,7 +747,7 @@ class ClimateFIRFilter(FIRFilter): # concat all variables logging.debug(f"{station_name}: concat all variables") - res = xr.concat(coll, var_dim) #todo does this works with different extend_length_opts (is data trimmed or filled with nans, 2nd is target) + res = xr.concat(coll, var_dim) # create result array with same shape like input data, gaps are filled by nans res_full = self._create_full_filter_result_array(data, res, new_dim, station_name)