openghg_inversions.rhime.specs#

RHIME runner specification dataclasses.

This module contains lightweight immutable dataclasses used by the RHIME runner. Model-construction specs live with the RHIME model builders; these runner specs keep sampling and output implementation details out of the run metadata boundary.

class openghg_inversions.rhime.specs.RhimeOutputSpec(output_format: Literal['none', 'inv_out', 'basic', 'paris', 'legacy'] = 'inv_out', output_path: str | None = None, output_name: str = 'rhime', save_trace: str | Path | bool = False, save_inversion_output: str | Path | bool = True, country_file: str | None = None, paris_postprocessing_kwargs: dict[str, Any] | None = None, output_filename_convention: Literal['rhime', 'legacy'] = 'rhime')#

Bases: object

Output settings for a RHIME run.

Parameters:
  • output_format – Output mode. "inv_out" saves/returns the modern inversion output, "basic" and "paris" additionally create derived outputs, "legacy" creates the old HBMCMC-compatible NetCDF product from modern RHIME output, and "none" skips output products.

  • output_path – Directory for saved outputs.

  • output_name – Base output name.

  • save_trace – Trace save setting. If true, save to output_path using the default trace file name; if a path, save there.

  • save_inversion_output – Inversion-output save setting. Runner parameter normalization defaults this to true for output_format="inv_out" and false for derived product formats.

  • country_file – Optional country mask file used by derived outputs.

  • paris_postprocessing_kwargs – Extra keyword arguments for PARIS output creation.

  • output_filename_convention – Filename convention for derived products. Direct RHIME runs use "rhime". The run_hbmcmc.py compatibility shim uses "legacy" for old SLURM/config workflows.

country_file: str | None = None#
output_filename_convention: Literal['rhime', 'legacy'] = 'rhime'#
output_format: Literal['none', 'inv_out', 'basic', 'paris', 'legacy'] = 'inv_out'#
output_name: str = 'rhime'#
output_path: str | None = None#
paris_postprocessing_kwargs: dict[str, Any] | None = None#
save_inversion_output: str | Path | bool = True#
save_trace: str | Path | bool = False#
class openghg_inversions.rhime.specs.RhimeRunSpec(start_date: str, end_date: str, sites: tuple[str, ...], averaging_period: tuple[str | None, ...], model: RhimeModelSpec, output: RhimeOutputSpec, split_by_sectors: bool = False)#

Bases: object

Top-level run metadata for a RHIME run.

Parameters:
  • start_date – Inclusive inversion start date.

  • end_date – Exclusive inversion end date.

  • sites – Sites included after data preparation and filtering.

  • averaging_period – Observation averaging period per retained site.

  • model – Mathematical model specification.

  • output – Output settings.

  • split_by_sectors – Whether flux data were prepared in sector-resolved mode. Single-sector and multi-sector RHIME are runner/model modes; this flag records the prepared data layout.

averaging_period: tuple[str | None, ...]#
end_date: str#
model: RhimeModelSpec#
output: RhimeOutputSpec#
sites: tuple[str, ...]#
split_by_sectors: bool = False#
start_date: str#
openghg_inversions.rhime.specs.make_output_spec(*, output_format: str, output_path: str | None, output_name: str, save_trace: str | Path | bool, save_inversion_output: str | Path | bool, country_file: str | None, paris_postprocessing_kwargs: dict[str, Any] | None, output_filename_convention: str, multisector: bool) RhimeOutputSpec#

Create validated output settings from normalized RHIME parameters.

openghg_inversions.rhime.specs.validate_output_filename_convention(output_filename_convention: str) None#

Raise if an output filename convention is not supported.

openghg_inversions.rhime.specs.validate_output_format(output_format: str) None#

Raise if a RHIME output format is not supported by the modern runners.

openghg_inversions.rhime.specs.validate_output_path_settings(*, output_format: str, output_path: str | None, save_trace: str | Path | bool, save_inversion_output: str | Path | bool, multisector: bool) None#

Raise if output settings imply a default save path but none is supplied.