swot_simulator.plugins.data_handler.DatasetLoader._shift_date#

static DatasetLoader._shift_date(date: datetime64, shift: int, time_delta: timedelta64) datetime64[source]#

Shift the input date using the time_delta of original data. This is useful to generate a time interval for which we need an original value.

Parameters
  • date (np.datetime64) – interpolation date

  • shift (int) – 1 for a later date, -1 for an earlier one

  • time_delta (np.timedelta64) – delta specifying the time resolution of the model data.

Returns

The input date if it is the input date is a multiple of time_delta (meaning it is on the model time axis). Else, the output is shifted.

Example

If we have data on [t0, t1, dt], and we want an interpolation over [T0, T1], then we must make sure that t0 <= T0 - dt and t1 >= T1 + dt. If this condition is satisfied, interpolation at T0 and T1 will be possible. If this condition is not satisfied, interpolation becomes extrapolation.