pycif.plugins.obsoperators.random — API reference#
Configuration reference: random plugin
- pycif.plugins.obsoperators.random.obsoper.obsoper(self, controlvect, obsvect, mode, run_id=0, datei=datetime.datetime(1979, 1, 1, 0, 0), datef=datetime.datetime(2100, 1, 1, 0, 0), workdir='./', reload_results=False, check_transforms=False, ignore_exceptions=False, force_fetch_results=False, **kwargs)[source]#
Apply the random observation operator in forward, tangent-linear or adjoint mode.
Implements a simple matrix–vector product using the random matrix
self.H_matrixbuilt byini_data(). Because no physical model is involved, the operator is instantaneous and exact in all three modes.Forward (
mode='fwd'):\[\mathbf{y}_\text{sim} = \mathbf{H}\,\mathbf{x}\]Sets
obsvect.ysimand returns obsvect.Tangent-linear (
mode='tl'):\[\mathbf{y}_\text{sim} = \mathbf{H}\,\mathbf{x}, \qquad \delta\mathbf{y} = \mathbf{H}\,\delta\mathbf{x}\]Sets both
obsvect.ysimandobsvect.dy; returns obsvect.Adjoint (
mode='adj'):\[\delta\mathbf{x} = \mathbf{H}^\top\,\delta\mathbf{y}\]Sets
controlvect.dx; returns controlvect.- Args:
- self (ObsOperator): plugin instance; must have
H_matrixset by a prior call to
ini_data().- controlvect (ControlVect): control-vector object.
controlvect.x is read in
fwd/tlmodes;controlvect.dxis read intlmode and written inadjmode.- obsvect (ObsVect): observation-vector object.
obsvect.ysimis written in
fwd/tlmodes;obsvect.dyis read inadjmode and written intlmode.
mode (str): execution mode — one of
'fwd','tl', or'adj'. run_id (int, optional): run identifier (unused; present for interfacecompatibility). Defaults to
0.- datei (datetime.datetime, optional): simulation start date (unused;
present for interface compatibility). Defaults to
datetime.datetime(1979, 1, 1).- datef (datetime.datetime, optional): simulation end date (unused;
present for interface compatibility). Defaults to
datetime.datetime(2100, 1, 1).- workdir (str, optional): working directory (unused; present for
interface compatibility). Defaults to
"./"- reload_results (bool, optional): reload pre-computed results (unused).
Defaults to
False.- check_transforms (bool, optional): validate transform consistency
(unused). Defaults to
False.- ignore_exceptions (bool, optional): swallow non-fatal errors (unused).
Defaults to
False.- force_fetch_results (bool, optional): if
True, raise IOErrorimmediately to signal that results must be fetched from a previous run rather than recomputed. Defaults toFalse.
- self (ObsOperator): plugin instance; must have
- from ….utils.check.errclass import CifIOError
**kwargs: additional keyword arguments (ignored).
- Returns:
ObsVect: in
'fwd'and'tl'modes — the updated obsvect.ControlVect: in
'adj'mode — the updated controlvect.- Raises:
IOError: if
force_fetch_resultsisTrue.