HyPar_DAFiltering module¶
-
class
HyPar_DAFiltering.
DAFilter
(DA_Filter_Configs)¶ Bases:
_filter_base.DAfilterBase
This creates an object that that will take care of the whole DA process. To initialize an object:
>> Filter_Object = DAFilter(Config_dict)
while
Config_dict
is a configuration dictionary obtained by reading the fileda_solver.inp
. This can be obtained as follows:>> Config_dict=_utility.read_filter_configurations([file_name = <file_name='da_solver.inp'>])
Filter_Object is the data assimilation object with the necessary filter configurations set.
-
DA_Monitor_Add
(monitor)¶
-
DA_filtering_cycle
(Model_Object, Xf, X_k1, ObsVec, nens, update_B=True)¶ -
DA_filtering_cycle
(Model_Object, Xf, X_k1, ObsVec, nens[, update_B=True])
given observation vector, background state/ensemble, and statistics at a specific time instant, this function produces the analysis ensemble for the given cycle.
Parameters: - Model_Object (object) – An object created from the class
ModelBase_HyPar
. - Xf (numpy.ndarray) – the forecast ensemble array. (Nvar x Nens): each memeber is stored as a column.
- X_k1 (numpy.ndarray) – previous analysis ensemble (at the previous assimilation time instance). (Nvar x Nens): each memeber is stored as a column.
- ObsVec (numpy.ndarray) – observation vector at the current time instance.
Returns: Xa, Filter_Statistics.
Xa is the analysis ensemble. (Nvar x Nens): each memeber is stored as a column.
Filter_Statistics is a dictionary containing filter statistics such as:
- Effective sample size,
- Acceptance probabilities,
- Number of objective function evaluations,
- Number of gradient evaluations,
- etc.
Statistics differ from filter to filter.
-
-
DA_filtering_process
(Model_Object, in_Ref_IC=None)¶ -
DA_filtering_process
(Model_Object[, in_Ref_IC=None]) Sweep the filter timespan and do assimilation at points where observations are available as requested in the filter configurations file
da_solver.inp
.
Parameters: - Model_Object (object) – An object created from the class
ModelBase_HyPar
. - in_Ref_IC (numpy.ndarray) – reference initial condition vector.
This is needed for RMSE evaluation and to generate observation if it is synthetic.
It is created by default as
Model_Objec._Ref_IC
when the model object is initalized. For example, in HyPar models this is called by compiling ``aux/init.c/C file in the model directory.
Returns: This function does not return something as a variable. It saves the assimilation results to the assimilation results directory which by default is
results_directory=assimilation_results
-
-
create_Initil_Ensemble
(Model_Object, forecast)¶ -
create_Initil_Ensemble
(Model_Object, forecast) Create and save an initial ensemble to be used as analysis at the initial time point. The current scheme is so simple. More advanced schemes will be considered!
Parameters: - Model_Object (object) – An object created from the class
ModelBase_HyPar
. - forecast (numpy.ndarray) – background/forecast initial condition vector. This is obtained by perturbing the initial reference solution by adding gaussian noise with covariance matrix B.
Returns: This function does not return something as a variable. It saves the initial ensemble in the temporary directory
out_dir = 'ensemble_out
-
-
set_DA_filter
(Model_Object, set_uncertainty_parameters=True, create_initial_ensemble=True)¶ -
set_DA_filter
(Model_Object[, set_uncertainty_parameters=True][, create_initial_ensemble=True])
Sets up the data assimilation model/filter based on information in the configurations file. a shallow copy of the model object is passes just to extract necessary information
Parameters: - Model_Object (object) – An object created from the class
ModelBase_HyPar
. - set_uncertainty_parameters (bool) – if, True (default) uncertainty parameters such as model
error covariance matrix, background error covariance matrix and
observation error covariance matrix, based on settings in the
filter configuration file
da_solver.inp
. - create_initial_ensemble (bool) – if True (default) an intial ensemble is created and saved to disk by
calling
Model_Object.generate_initialForecast()
.
-
-