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:
objectOne exact, labelled native-to-retained Gaussian reduction.
- Variables:
retained_mean (xarray.core.dataarray.DataArray) – Dimensionless
Pi mon the retained-state axis.retained_covariance (xarray.core.dataarray.DataArray) – Positive-definite
C_alphaon distinct retained-state row and column axes.effective_observation_operator (xarray.core.dataarray.DataArray) –
H_alphamapping retained-state perturbations to observations.native_observation_mean (xarray.core.dataarray.DataArray) –
H mon the observation axis.observation_intercept (xarray.core.dataarray.DataArray) – Affine intercept
H m - H_alpha Pi m.unresolved_observation_covariance (xarray.core.dataarray.DataArray) –
Aon distinct observation row and column axes. It is a positive-semidefinite covariance up to floating-point roundoff.projection_strategy (str) – Scientific strategy that selected
Pi.
- 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/mset.This is a named eager numerical boundary.
native_mean,native_sensitivity, andbasis_prolongationmay 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:
mand the basis describe dimensionless scaling, whileHis 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
Hin 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.