Skip to content

ensemble⚓︎

Descriptive description.

Ensemble ⚓︎

Bases: Ensemble

Class for organizing/initializing misc. variables and simulator for an ensemble-based inversion run. Inherits the PET ensemble structure

__init__(keys_da, keys_en, sim) ⚓︎

Parameters:

Name Type Description Default
keys_da dict

Options for the data assimilation class

  • daalg: spesification of the method, first the main type (e.g., "enrml"), then the solver (e.g., "gnenrml")
  • analysis: update flavour ("approx", "full" or "subspace")
  • energy: percent of singular values kept after SVD
  • obsvarsave: save the observations as a file (default false)
  • restart: restart optimization from a restart file (default false)
  • restartsave: save a restart file after each successful iteration (defalut false)
  • analysisdebug: specify which class variables to save to the result files
  • truedataindex: order of the simulated data (for timeseries this is points in time)
  • obsname: unit for truedataindex (for timeseries this is days or hours or seconds, etc.)
  • truedata: the data, e.g., provided as a .csv file
  • assimindex: index for the data that will be used for assimilation
  • datatype: list with the name of the datatypes
  • staticvar: name of the static variables
  • datavar: data variance, e.g., provided as a .csv file
required
keys_en dict

Options for the ensemble class

  • ne: number of perturbations used to compute the gradient
  • state: name of state variables passed to the .mako file
  • prior_: the prior information the state variables, including mean, variance and variable limits
required
sim callable

The forward simulator (e.g. flow)

required

check_assimindex_sequential() ⚓︎

Check if assim. indices is given as a 2D list as is needed in sequential updating. If not, make it a 2D list

check_assimindex_simultaneous() ⚓︎

Check if assim. indices is given as a 1D list as is needed in simultaneous updating. If not, make it a 2D list with one row.

compress(data=None, vintage=0, aug_coeff=None) ⚓︎

Compress the input data using wavelets.

Parameters:

Name Type Description Default
data

data to be compressed If data is None, all data (true and simulated) is re-compressed (used if leading indices are updated)

None
vintage int

the time index for the data

0
aug_coeff bool
  • False: in this case the leading indices for wavelet coefficients are computed
  • True: in this case the leading indices are augmented using information from the ensemble
  • None: in this case simulated data is compressed
None

local_analysis_update() ⚓︎

Function for updates that can be used by all algorithms. Do this once to avoid duplicate code for local analysis.

save_temp_state_assim(ind_save) ⚓︎

Method to save the state variable during the assimilation. It is stored in a list with length = tot. no. assim. steps + 1 (for the init. ensemble). The list of temporary states are also stored as a .npz file.

Parameters:

Name Type Description Default
ind_save int

Assim. step to save (0 = prior)

required

save_temp_state_iter(ind_save, max_iter) ⚓︎

Save a snapshot of state at current iteration. It is stored in a list with length equal to max. iteration length + 1 (due to prior state being 0). The list of temporary states are also stored as a .npz file.

Warning

Max. iterations must be defined before invoking this method.

Parameters:

Name Type Description Default
ind_save int

Iteration step to save (0 = prior)

required

save_temp_state_mda(ind_save) ⚓︎

Save a snapshot of the state during a MDA loop. The temporary state will be stored as a list with length equal to the tot. no. of assimilations + 1 (init. ensemble saved in 0 entry). The list of temporary states are also stored as a .npz file.

Warning

Tot. no. of assimilations must be defined before invoking this method.

Parameter

ind_save : int Assim. step to save (0 = prior)

save_temp_state_ml(ind_save) ⚓︎

Save a snapshot of the state during a ML loop. The temporary state will be stored as a list with length equal to the tot. no. of assimilations + 1 (init. ensemble saved in 0 entry). The list of temporary states are also stored as a .npz file.

Warning

Tot. no. of assimilations must be defined before invoking this method.

Parameters:

Name Type Description Default
ind_save int

Assim. step to save (0 = prior)

required