filter dh: differentiate between history offset and information offset
differentiate between history offset and information offset
After closing this issue there are the following parameters:
-
window_history_offset: used to include future values into history / inputs. Example: setwindow_history_size=48andwindow_history_offset=12to use 2 days as history / input but not on intervalt0 + [-48h, 0h]butt0 + [-36h, 12h]. This parameter is especially used together with a 1d target variable (mixed sampling) that measurement interval is not from 0000 to 0000 but 1700 (day before) to 1700 (day of t0) or similar (e.g. dma8eu ozone). Then it is possible to usewindow_history_size=48+16andwindow_history_offset=16to use 3 days of input without all timesteps starting at 1700 the day before (as they are included in the target). -
extend_length_opts: use this parameter to use future data in the filter calculation. Example: setextend_length_opts=7*24to use the observation of the next 7 days to calculate the filtered components. This parameter does not effect the interval of the sample (which is handled by thewindow_history_offsetparameter)
current status and todos
- The
extend_length_optsparameter is somehow used in a wrong way as it also has an impact on the interval length of the history / inputs.-
change the following lines: expand climate_filter_dataaccording towindow_history_offsetparameter and not withextend_length_opts
-
class DataHandlerClimateFirFilterSingleStation(...):
...
def apply_filter(self):
...
if isinstance(self.extend_length_opts, int):
climate_filter_data = [c.sel({self.window_dim: slice(-self.window_history_size, self.extend_length_opts)})
for c in climate_filter.filtered_data]
else:
climate_filter_data = []
for c in climate_filter.filtered_data:
coll_tmp = []
for v in c.coords[self.target_dim].values:
upper_lim = self.extend_length_opts.get(v, 0)
coll_tmp.append(c.sel({self.target_dim: v,
self.window_dim: slice(-self.window_history_size, upper_lim)}))
climate_filter_data.append(xr.concat(coll_tmp, self.target_dim))
- The
ClimateFIRFilterclass has no information about the offset parameter as it usesextend_length_optsfor information extension and interval extend.-
add an offset parameter to the ClimateFIRFilterclass (is currently only used inFIRFilterclass for plotting) -
include offset parameter for minimum length calculation -
trimm data by considering extend_length_optsandoffsetinsideself.clim_filter -
also trimm data with respect to offsetparameter inself.run
-
testing
to ensure proper working check:
-
extend_length_opts<offset -
extend_length_opts>offset -
what about equality? -
extend_length_optsis None -
offsetis None