dctools.data.datasets.forecast.build_forecast_index_from_catalog

dctools.data.datasets.forecast.build_forecast_index_from_catalog(catalog, init_date, end_date, start_time_col='date_start', end_time_col='date_end', file_col='path', n_days_forecast=10, n_days_interval=7, lead_time_unit='days')

Generate a forecast index mapping (init_time, lead_time) pairs to files.

Covering the corresponding valid_time (= init_time + lead_time).

Parameters:
  • catalog (pd.DataFrame) – Must contain at least the columns: - ‘path’ : path to the file - ‘date_start’ : earliest datetime in the file (forecast_reference_time) - ‘date_end’ : latest datetime in the file

  • init_date (str) – Start of the forecast initialization window

  • end_date (str) – End of the forecast initialization window

  • n_days_forecast (int) – Number of forecast days

  • n_days_interval (int) – Interval (in days) between successive forecast initializations

  • lead_time_unit (str) – Unit of lead time (“days” or “hours”)

Returns:

DataFrame with columns: - ‘forecast_reference_time’ - ‘lead_time’ - ‘valid_time’ (= forecast_reference_time + lead_time) - ‘file’ (path to file covering valid_time)

Return type:

pd.DataFrame