pycif.plugins.simulators.gausscost_flexpart — API reference

pycif.plugins.simulators.gausscost_flexpart — API reference#

Configuration reference: gausscost_flexpart plugin

pycif.plugins.simulators.gausscost_flexpart.simul.simul(self, chi, grad=True, run_id=-1, **kwargs)[source]#

Evaluate the Gaussian cost function for FLEXPART Lagrangian inversions.

Computes

\[J(\boldsymbol{\chi}) = \tfrac{1}{2}\boldsymbol{\chi}^\top\boldsymbol{\chi} + \tfrac{1}{2}\sum_i \frac{(H_i\mathbf{x} - y_i)^2} {\sigma_{\varepsilon,i}^2 + \sigma_{b,i}^2}\]

where \(\sigma_\varepsilon\) and \(\sigma_b\) are the observation error and background error stored in the datastore columns obserror and obs_bkgerr respectively. The adjoint sensitivity is read directly from obsvect.dx.

Parameters:
  • self (Plugin) – gausscost FLEXPART simulator plugin instance.

  • chi (np.ndarray) – current iterate \(\boldsymbol{\chi}\), shape (n,).

  • grad (bool) – if True (default), compute and return the gradient.

  • run_id (int) – unique call identifier for sub-directory naming.

  • **kwargs – forwarded to the obs-operator.

Returns:

(zcost, zgrad) when grad=True; zcost when grad=False.

Return type:

tuple or float

pycif.plugins.simulators.gausscost_flexpart.svd.svd_init(datastore)[source]#

Pre-compute the SVD of daily-averaged reference observations per parameter.

Equivalent to gausscost.svd.svd_init() but uses the past compatibility shim (old_div) for Python-2/3 portability.

Parameters:

datastore (pd.DataFrame) – observation datastore with columns parameter, station, and obs, indexed by datetime.

Returns:

mapping {parameter: {"U": U, "Vh": Vh, "s": s}}.

Return type:

dict

pycif.plugins.simulators.gausscost_flexpart.svd.svd_cost(self, datastore, Jref)[source]#

Compute the SVD-based observation cost term (FLEXPART variant).

Equivalent to gausscost.svd.svd_cost() but uses \(s_k^{-1/2}\) instead of \(s_k^{-1/4}\) for the error weighting.

Parameters:
  • self (Plugin) – FLEXPART simulator plugin instance with svd_vectors and optionally crop_svd.

  • datastore (pd.DataFrame) – observation datastore; obs_incr column is updated in-place with the adjoint increment.

  • Jref (float) – reference observation cost (unused).

Returns:

SVD-based observation cost \(J_o\).

Return type:

float

Placeholder module — SVG visualisation utilities for FLEXPART cost function (not yet implemented).