metobs_toolkit.station.Station.fill_gaps_with_debiased_modeldata#

Station.fill_gaps_with_debiased_modeldata(target_obstype: str, leading_period_duration: Timedelta | str = Timedelta('1 days 00:00:00'), min_leading_records_total: int = 60, trailing_period_duration: Timedelta | str = Timedelta('1 days 00:00:00'), min_trailing_records_total: int = 60, overwrite_fill: bool = False) None[source]#

Fill the gaps using model data corrected for the bias.

This method fills the gaps using model data corrected for bias. The bias is estimated using a leading (before the gap) and trailing (after the gap) period. The bias is computed by combining the leading and trailing period, and comparing the model with the observations (not labeled as outliers). The model data is then interpolated to the missing records, and corrected with the estimated bias.

Parameters:
  • target_obstype (str) – The target obstype to fill the gaps for.

  • leading_period_duration (str or pd.Timedelta, optional) – The duration of the leading period. The default is “24h”.

  • min_leading_records_total (int, optional) – The minimum number of records required in the leading period. The default is 60.

  • trailing_period_duration (str or pd.Timedelta, optional) – The duration of the trailing period. The default is “24h”.

  • min_trailing_records_total (int, optional) – The minimum number of records required in the trailing period. The default is 60.

  • overwrite_fill (bool, optional) – If True, the status of a gap and present gapfill info will be ignored and overwritten. If False, only gaps without gapfill data are filled. The default is False.

Return type:

None

Notes

A schematic description of the debiased model data gap fill:

  1. Check if the target_obstype is known, and if the corresponding model data is present.

  2. Iterate over the gaps of the target_obstype.

  3. Check the compatibility of the ModelTimeSeries with the gap.

  4. Construct a leading and trailing sample, and test if they meet the required conditions.

  5. Compute the bias of the model data (combine leading and trailing samples).

  6. Fill the gap records by using raw (interpolated) model data that is corrected by subtracting the bias.

  7. Update the gap attributes with the interpolated values, labels, and details.