pycif.plugins.modes.analytic — API reference

pycif.plugins.modes.analytic — API reference#

Configuration reference: analytic plugin

pycif.plugins.modes.analytic.basefunctions.check_base_functions(base_dir, statedim)[source]#

Return the list of base-function indices that have not yet been computed.

Parameters:
  • base_dir (str) – directory where base function obs-vectors are stored (obsvect_NNNN sub-directories).

  • statedim (int) – total number of control-vector dimensions.

Returns:

indices i in range(statedim) for which obsvect_NNNN is absent from base_dir.

Return type:

list[int]

pycif.plugins.modes.analytic.basefunctions.compute_base_functions(self, controlvect, list_base_functions, dryrun, sequential)[source]#

Submit one forward pyCIF run per missing base-function dimension.

For each index in list_base_functions, sets the prior control vector to a Dirac vector (all zeros except dimension i = 1), dumps a tailored YAML configuration, and submits the run via the platform plugin. Waits for all jobs to finish, then moves the resulting obs-vector directories into the H-matrix sub-directory.

Parameters:
  • self (Plugin) – mode plugin providing workdir, platform, and dump_nc_base_control attributes.

  • controlvect – control vector plugin (modified in-place; restored to its original xb on return).

  • list_base_functions (list[int]) – indices of the control-vector dimensions for which base functions must be (re-)computed.

  • dryrun (bool) – if True, submit only the first dimension to estimate the forward run cost, then return.

  • sequential (bool) – if True, wait for each job to finish before submitting the next one.

pycif.plugins.modes.analytic.build_H.build_H(controlvect, obsvect, base_dir)[source]#

Assemble the full observation operator matrix H from pre-computed base functions.

Reads each base-function obs-vector from base_dir and fills the corresponding column of the H matrix. Dumps the result as a pickle file (H.pickle) in base_dir.

Parameters:
  • controlvect – control vector plugin providing dim and component metadata.

  • obsvect – observation vector plugin providing dim and per-tracer pointer / dimension attributes.

  • base_dir (str) – directory containing obsvect_NNNN sub-directories (one per control-vector dimension) and where H.pickle will be written.

Returns:

H matrix of shape (obs_dim, control_dim).

Return type:

np.ndarray

Raises:

Exception – if the datavect has no components attribute (no observations configured).

pycif.plugins.modes.analytic.execute.execute(self, **kwargs)[source]#

Performs an analytical inversions, including computation of base functions