openghg_inversions.rhime.params#
RHIME parameter loading, normalisation, and validation helpers.
This internal package module keeps raw config/API parameter handling out of the public RHIME runner. It is intentionally limited to INI compatibility, legacy alias handling, simple scalar coercion, and validation of raw dictionaries. Future YAML/schema frontends should target the same normalized parameter model before constructing RHIME specs.
- class openghg_inversions.rhime.params.RhimeRunnerSetup(run_spec: RhimeRunSpec, sampler: RhimeSampler, data_args: dict[str, Any])#
Bases:
objectNormalized RHIME setup derived from config or direct API parameters.
- run_spec: RhimeRunSpec#
- sampler: RhimeSampler#
- openghg_inversions.rhime.params.as_list(value: str | Sequence[str] | None) list[str] | None#
Convert a scalar/list-like value to a list of strings.
- openghg_inversions.rhime.params.coerce_simple_param_types(params: dict[str, Any]) None#
Coerce simple scalar options in-place before spec construction.
- openghg_inversions.rhime.params.is_missing_required_value(value: Any) bool#
Return true when a required RHIME parameter has no usable value.
- openghg_inversions.rhime.params.make_rhime_runner_setup(*, params: Mapping[str, Any], multisector: bool, data_param_names: set[str]) RhimeRunnerSetup#
Normalize raw RHIME parameters into specs and preparation arguments.
- openghg_inversions.rhime.params.normalise_optional_mapping(value: Mapping[str, Any] | None) dict[str, Any] | None#
Copy an optional mapping so specs do not retain caller-owned dicts.
- openghg_inversions.rhime.params.normalise_output_format_alias(params: dict[str, Any]) None#
Normalize deprecated HBMCMC output format names in-place.
- openghg_inversions.rhime.params.normalise_param_aliases(params: Mapping[str, Any]) dict[str, Any]#
Normalize legacy config spellings to modern snake-case names.
- openghg_inversions.rhime.params.normalise_rhime_params(params: Mapping[str, Any]) dict[str, Any]#
Normalize aliases, coerce simple scalars, and validate structured values.
- openghg_inversions.rhime.params.normalise_sector_priors(sector_priors: Mapping[str, Mapping[str, Any]] | None) dict[str, dict[str, Any]] | None#
Copy optional sector-prior mappings with string sector keys.
- openghg_inversions.rhime.params.normalise_sector_sources(sector_sources: Mapping[str, Any] | None) dict[str, str] | None#
Copy optional sector-to-source mappings with string names.
- openghg_inversions.rhime.params.params_from_config(config_file: str | Path, *, start_date: str | None = None, end_date: str | None = None, output_path: str | None = None, extra_kwargs: Mapping[str, Any] | None = None) dict[str, Any]#
Load RHIME run parameters from an INI config file.
- Parameters:
config_file – Path to an INI configuration file.
start_date – Optional command-line start-date override.
end_date – Optional command-line end-date override.
output_path – Optional command-line output-path override.
extra_kwargs – Optional keyword overrides, normally parsed from CLI JSON.
- Returns:
Normalized RHIME run parameters using snake-case public names.
- Raises:
ValueError – If deprecated unsupported parameters are present or a structured RHIME option has an invalid type.
- openghg_inversions.rhime.params.required_run_params() set[str]#
Return RHIME parameters required before data preparation.
- openghg_inversions.rhime.params.resolve_flux_sources(*, flux_sources: str | Sequence[str] | None = None, emissions_name: str | Sequence[str] | None = None) list[str]#
Resolve new
flux_sourcesand legacyemissions_namearguments.- Parameters:
flux_sources – Preferred RHIME field containing OpenGHG flux
sourcemetadata values.emissions_name – Legacy compatibility spelling accepted only when
flux_sourcesis absent.
- Returns:
Resolved flux source names.
- Raises:
ValueError – If no usable flux source is supplied.
- openghg_inversions.rhime.params.validate_multisector_x_prior(x_prior: Mapping[str, Any] | None) None#
Raise if multi-sector
x_prioris not a shared prior spec.
- openghg_inversions.rhime.params.validate_required_params(params: Mapping[str, Any]) None#
Raise if normalized run parameters are missing required values.