fre.pp.histval_script module

This script will locate all diag_manifest files in a provided directory containing history files then run the nccheck script to validate the number of timesteps in each file. Ran as part of Stage-History task in fre postprocessing workflow.

fre.pp.histval_script.validate(history: str, date_string: str, warn: bool)

Compares the number of timesteps in each netCDF (.nc) file to the number of expected timesteps as found in the diag_manifest file(s). Ran once over the entire history dir. Uses nccheck for comparison.

Parameters:
  • history (str) – Path to history dir

  • date_string (str) – Date string of history files in YYYYMMDD format

  • warn (bool) – Handle error as an exception and print the error message as a warning

Raises:
  • FileNotFoundError – No diag manifest file was found in history directory

  • ValueError – An unexpected number of timesteps was found

Returns:

Returns 0 unless an exception is raised

Return type:

int