fre.app.generate_time_averages.combine module

routines centered around combining monthly climatologies written out as one-month per-file batches see wrapper.py for more information

fre.app.generate_time_averages.combine.combine(root_in_dir: str, root_out_dir: str, component: str, begin: int, end: int, frequency: str, interval: str) None

Combine per-variable climatologies into one file.

Parameters:
  • root_in_dir (str) – Root time average shards directory, up to the “av”

  • root_out_dir (str) – Root output postprocess directory, up to the “pp”

  • component (str) – Component to process

  • begin (int) – Beginning 4-digit year of the climatology

  • end (int) – Ending 4-digit year of the climatology

  • frequency ('mon' or 'yr') – Sampling type of the climatology

  • interval (ISO8601 duration) – Length of the climatology

Raises:

ValueError – Only monthly and annual frequencies allowed

Return type:

None

fre.app.generate_time_averages.combine.form_bronx_directory_name(frequency: str, interval: str) str

Form the legacy Bronx time average directory name given a frequency and interval.

Parameters:
  • frequency ('mon' or 'yr') – Frequency of the climatology

  • interval (ISO8601 duration) – Interval of the climatology

Raises:

ValueError – Only monthly and annual frequencies allowed

Returns:

Corresponding Bronx directory name

Return type:

str

fre.app.generate_time_averages.combine.merge_netcdfs(input_file_glob: str, output_file: str) None

Merge a group of NetCDF files identified by a glob string into one combined NetCDF file.

Parameters:
  • input_file_glob – Glob string used to form input file list

  • output_file – Merged output NetCDF file

Raises:
  • FileNotFoundError – Input files not found

  • FileExistsError – Output file already exists

Return type:

None