set_leadhrs module

set_leadhrs(date_init, lhr_min, lhr_max, lhr_intvl, base_dir, time_lag, fn_template, num_missing_files_max, skip_check_files=False, verbose=False)

Creates a list of lead hours based on the provided range and interval, checks for the existence of corresponding files, and returns a list of lead hours for which files exist. If too many files are missing, it fails with an exception.

Parameters:
  • date_init (str) – Date string for initial time in YYYYMMDD[mmss] format, where minutes and seconds are optional.

  • lhr_min (int) – Minimum lead hour to check

  • lhr_max (int) – Maximum lead hour to check

  • lhr_intvl (int) – Interval between lead hours

  • base_dir (str) – Base directory for forecast/observation file

  • time_lag (int) – Hours of time lag for a time-lagged ensemble member

  • fn_template (str) – The METplus filename template for finding the files

  • verbose (bool) – By default this script only outputs the list of forecast hours (for easier parsing from bash contexts). Set the verbose flag to True for additional debugging output.

  • num_missing_files_max (int) – If more files than this value are not found, raise exception

  • skip_check_files (bool) – If true, return the list of forecast hours, skipping the file check

Returns:

A list of forecast hours where files were found