openghg_inversions.models.rhime#

RHIME model builders.

These builders are the modern public model-construction names. They reuse the component-based PyMC helpers, while keeping the legacy inferpymc adapter out of the RHIME runtime path.

openghg_inversions.models.rhime.build_rhime_model(inv_inputs: Dataset, *, x_prior: dict | None = None, bc_prior: dict | None = None, sigma_prior: dict | None = None, sigma_per_site: bool = True, offset_prior: dict | None = None, add_offset: bool = False, use_bc: bool = True, pollution_events_from_obs: bool = False, no_model_error: bool = False, offset_args: dict | None = None, power: dict | float = 1.99) Model#

Build the standard single-sector RHIME model.

Parameters:
  • inv_inputs – Canonical inversion-input dataset produced by make_inv_inputs.

  • x_prior – Prior specification for flux scaling factors.

  • bc_prior – Prior specification for boundary-condition scaling factors.

  • sigma_prior – Prior specification for model-error terms.

  • sigma_per_site – Whether model-error terms vary by site.

  • offset_prior – Prior specification for optional offsets.

  • add_offset – Whether to include an offset term.

  • use_bc – Whether to include boundary-condition terms.

  • pollution_events_from_obs – Whether to derive pollution-event scaling from observations rather than modelled concentrations.

  • no_model_error – Whether to suppress the explicit model-error term.

  • offset_args – Extra keyword arguments forwarded to the offset component.

  • power – Exponent or prior specification used in likelihood error scaling.

Returns:

Built PyMC model.

openghg_inversions.models.rhime.build_rhime_multisector_model(inv_inputs: Dataset, *, sectors: Sequence[str] | None = None, sector_priors: Mapping[str, dict] | None = None, x_prior: dict | None = None, bc_prior: dict | None = None, sigma_prior: dict | None = None, sigma_per_site: bool = True, offset_prior: dict | None = None, add_offset: bool = False, use_bc: bool = True, pollution_events_from_obs: bool = False, no_model_error: bool = False, offset_args: dict | None = None, power: dict | float = 1.99) Model#

Build the first shared-basis multi-sector RHIME model.

Each sector receives its own state vector x_<sector> and forward-model contribution mu_<sector>. The total mu is the sum of sector contributions and is passed to the standard RHIME likelihood.

Parameters:
  • inv_inputs – Canonical inversion-input dataset with H(region, nmeasure, source).

  • sectors – Ordered sector/source names to optimise. Defaults to all inv_inputs.H.source values.

  • sector_priors – Optional per-sector flux-scaling priors.

  • x_prior – Shared fallback flux-scaling prior.

  • bc_prior – Prior specification for boundary-condition scaling factors.

  • sigma_prior – Prior specification for model-error terms.

  • sigma_per_site – Whether model-error terms vary by site.

  • offset_prior – Prior specification for optional offsets.

  • add_offset – Whether to include an offset term.

  • use_bc – Whether to include boundary-condition terms.

  • pollution_events_from_obs – Whether to derive pollution-event scaling from observations rather than modelled concentrations.

  • no_model_error – Whether to suppress explicit model-error terms.

  • offset_args – Extra keyword arguments forwarded to the offset component.

  • power – Exponent or prior specification used in likelihood error scaling.

Returns:

Built PyMC model.

openghg_inversions.models.rhime.safe_pymc_name(value: str) str#

Return a stable PyMC-safe suffix for a user-facing sector/source name.

Parameters:

value – User-facing sector or source name.

Returns:

Lowercase snake-case suffix safe to use in PyMC variable names.