metobs_toolkit.gap.Gap.diurnal_debiased_model_gapfill#

Gap.diurnal_debiased_model_gapfill(sensordata: SensorData, modeltimeseries: ModelTimeSeries, leading_period_duration: Timedelta, trailing_period_duration: Timedelta, min_debias_sample_size: int) None[source]#

Fill the gaps using model data corrected for the diurnal bias.

This method fills the gap using model data corrected for its diurnal bias. The diurnal bias is a bias that is estimated for each timestamp in the leading and trailing period. All biases are averaged over hour, minute and second, to obtain a diurnal bias (for each timestamp).

Parameters:
  • sensordata (SensorData) – The corresponding SensorData used in the computation of the bias. Only the observations that are not labeled as outliers are used to compute the bias.

  • modeltimeseries (ModelTimeSeries) – The model time series used to fill the gap records. The model data must be compatible (equivalent obstype and related to the same Station as the gap.)

  • leading_period_duration (pd.Timedelta) – The duration of the leading period. That is the period before the gap, used for bias estimation.

  • trailing_period_duration (pd.Timedelta) – The duration of the trailing period. That is the period after the gap, used for bias estimation.

  • min_debias_sample_size (int) – The minimum number of samples required for bias estimation. If this condition is not met, the gap is not filled.

Return type:

None.

Notes

A schematic description of the diurnal debiased modeldata gap fill:

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

  2. Construct a leading and trailing sample, and test if they meet the required conditions. The required conditions are tested by testing the samplesizes per hour, minute and second for the leading + trailing periods.

  3. A diurnal bias is computed by grouping to hour, minute and second, and averaging the biases.

  4. Fill the gap records by using raw (interpolated) modeldata that is corrected by subtracting the coresponding diurnal bias.

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

Notes

Note that a suitable min_debias_sample_size depends on the sizes of the leading- and trailing periods, and also on the time resolution gap (=time resolution of the corresponding SensorData).

References

Jacobs .A, et. al. (2024) Filling gaps in urban temperature observations by debiasing ERA5 reanalysis data