openghg_inversions.coherent_reduction#

Exact labelled Gaussian reduction from one native model.

For x ~ N(m, B) and alpha = Pi x, the reduced conditional observation model is

y | alpha ~ N(H m + H_alpha (alpha - Pi m), R + A),

where H_alpha = H B Pi.T C_alpha^-1 and A = H B H.T - H_alpha C_alpha H_alpha.T. The public function constructs all linked covariance products from the same B/H/Pi inputs before applying these equations.

class openghg_inversions.coherent_reduction.CoherentGaussianReduction(retained_mean: DataArray, retained_covariance: DataArray, effective_observation_operator: DataArray, native_observation_mean: DataArray, observation_intercept: DataArray, unresolved_observation_covariance: DataArray, projection_strategy: str)#

Bases: object

One exact, labelled native-to-retained Gaussian reduction.

Variables:
effective_observation_operator: DataArray#
native_observation_mean: DataArray#
observation_intercept: DataArray#
projection_strategy: str#
retained_covariance: DataArray#
retained_mean: DataArray#
unresolved_observation_covariance: DataArray#
openghg_inversions.coherent_reduction.reduce_native_gaussian(*, covariance: InvertibleNativeCovarianceAction, basis_prolongation: DataArray, state_dim: str, native_mean: DataArray, native_sensitivity: DataArray, observation_dim: str, observation_batch_size: int = 64, strategy: RetainedProjectionStrategy | None = None) CoherentGaussianReduction#

Prepare the exact centred Gaussian model for one B/H/Pi/m set.

This is a named eager numerical boundary. native_mean, native_sensitivity, and basis_prolongation may be Dask-backed; their payloads are materialized together so a shared graph is executed once. Inputs are borrowed and are not mutated.

The inputs must use the covariance action’s native dimensions and carry exactly matching indexed coordinates on shared dimensions. Unit conversion belongs to the upstream OpenGHG/pint-xarray preparation boundary: m and the basis describe dimensionless scaling, while H is already expressed in the desired observation units.

Parameters:
  • covariance – Invertible labelled native covariance action B.

  • basis_prolongation – Canonical labelled basis prolongation used by the retained projection strategy.

  • state_dim – Retained-state dimension shared by the prolongation and restriction.

  • native_mean – Dimensionless native scaling mean m.

  • native_sensitivity – Native sensitivity H in canonical observation units.

  • observation_dim – Observation dimension in native_sensitivity.

  • observation_batch_size – Covariance right-hand-side batch size.

  • strategy – Optional authoritative retained restriction strategy.

Returns:

The retained prior, centred effective forward model, and unresolved observation covariance.

Raises:

ValueError – If xarray cannot transpose or exactly align the labelled inputs, or if covariance-product construction fails.