API

Initialisation and finalisation

pyPDAF.PDAF.init

This function initialises the PDAF system.

pyPDAF.PDAF.omi_init

Allocating an array of obs_f derived types instances.

pyPDAF.PDAF.deallocate

This function finalise the PDAF systems including freeing all memory used by PDAF.

pyPDAF.PDAF.print_info

Printing the wallclock time and memory measured by PDAF.

Fully parallel DA algorithms

Sequential DA

diagnoal observation matrix

pyPDAF.PDAF.omi_assimilate_global

Global filters except for 3DVar for a single DA step using diagnoal observation error covariance matrix.

pyPDAF.PDAF.omi_assimilate_lenkf

Covariance localised stochastic EnKF for a single DA step using diagnoal observation error covariance matrix.

pyPDAF.PDAF.localomi_assimilate

Domain local filters for a single DA step using diagnoal observation error covariance matrix.

non-diagnoal observation matrix

pyPDAF.PDAF.omi_assimilate_global_nondiagR

Global filters except for 3DVar and stochastic EnKF for a single DA step using non-diagnoal observation error covariance matrix.

pyPDAF.PDAF.omi_assimilate_enkf_nondiagR

Stochastic EnKF for a single DA step using non-diagnoal observation error covariance matrix.

pyPDAF.PDAF.omi_assimilate_lenkf_nondiagR

Covariance localised stochastic EnKF for a single DA step using non-diagnoal observation error covariance matrix.

pyPDAF.PDAF.localomi_assimilate_nondiagR

Domain local filters for a single DA step using non-diagnoal observation error covariance matrix.

pyPDAF.PDAF.omi_assimilate_nonlin_nondiagR

Global nonlinear filters for a single DA step using non-diagnoal observation error covariance matrix.

pyPDAF.PDAF.localomi_assimilate_lnetf_nondiagR

LNETF for a single DA step using non-diagnoal observation error covariance matrix.

pyPDAF.PDAF.localomi_assimilate_lknetf_nondiagR

LKNETF for a single DA step using non-diagnoal observation error covariance matrix.

Variational DA

diagnoal observation matrix

pyPDAF.PDAF.omi_assimilate_3dvar

3DVar DA for a single DA step using diagnoal observation error covariance matrix.

pyPDAF.PDAF.omi_assimilate_en3dvar_estkf

3DEnVar for a single DA step using diagnoal observation error covariance matrix.

pyPDAF.PDAF.omi_assimilate_hyb3dvar_estkf

Hybrid 3DEnVar for a single DA step using diagnoal observation error covariance matrix.

pyPDAF.PDAF.localomi_assimilate_en3dvar_lestkf

3DEnVar for a single DA step where the ensemble anomaly is generated by LESTKF using diagnoal observation error covariance matrix.

pyPDAF.PDAF.localomi_assimilate_hyb3dvar_lestkf

Hybrid 3DEnVar for a single DA step using diagnoal observation error covariance matrix.

non-diagnoal observation matrix

pyPDAF.PDAF.omi_assimilate_3dvar_nondiagR

3DVar DA for a single DA step using non-diagnoal observation error covariance matrix.

pyPDAF.PDAF.omi_assimilate_en3dvar_estkf_nondiagR

3DEnVar for a single DA step using non-diagnoal observation error covariance matrix.

pyPDAF.PDAF.omi_assimilate_hyb3dvar_estkf_nondiagR

Hybrid 3DEnVar for a single DA step using non-diagnoal observation error covariance matrix.

pyPDAF.PDAF.localomi_assimilate_en3dvar_lestkf_nondiagR

3DEnVar for a single DA step where the ensemble anomaly is generated by LESTKF using non-diagnoal observation error covariance matrix.

pyPDAF.PDAF.localomi_assimilate_hyb3dvar_lestkf_nondiagR

Hybrid 3DEnVar for a single DA step using diagnoal observation error covariance matrix.

Flexible DA algorithms

Sequential DA

diagnoal observation matrix

pyPDAF.PDAF.omi_put_state_global

Global filters except for 3DVar for a single DA step using diagnoal observation error covariance matrix without post-processing, distributing analysis, and setting next observation step.

pyPDAF.PDAF.omi_put_state_lenkf

Stochastic EnKF (ensemble Kalman filter) with covariance localisation using diagnoal observation error covariance matrix without post-processing, distributing analysis, and setting next observation step.

pyPDAF.PDAF.localomi_put_state

Domain local filters for a single DA step using diagnoal observation error covariance matrix without post-processing, distributing analysis, and setting next observation step.

diagnoal observation matrix

pyPDAF.PDAF.omi_put_state_global_nondiagR

Global filters except for 3DVar and stochastic EnKF for a single DA step using non-diagnoal observation error covariance matrix without post-processing, distributing analysis, and setting next observation step.

pyPDAF.PDAF.omi_put_state_enkf_nondiagR

Stochastic EnKF for a single DA step using non-diagnoal observation error covariance matrix without post-processing, distributing analysis, and setting next observation step.

pyPDAF.PDAF.omi_put_state_lenkf_nondiagR

Covariance localised stochastic EnKF for a single DA step using non-diagnoal observation error covariance matrix without post-processing, distributing analysis, and setting next observation step.

pyPDAF.PDAF.localomi_put_state_nondiagR

Domain local filters for a single DA step using non-diagnoal observation error covariance matrix without post-processing, distributing analysis, and setting next observation step.

pyPDAF.PDAF.omi_put_state_nonlin_nondiagR

Global nonlinear filters for a single DA step using non-diagnoal observation error covariance matrix without post-processing, distributing analysis, and setting next observation step.

pyPDAF.PDAF.localomi_put_state_lnetf_nondiagR

LNETF for a single DA step using non-diagnoal observation error covariance matrix without post-processing, distributing analysis, and setting next observation step.

pyPDAF.PDAF.localomi_put_state_lknetf_nondiagR

LKNETF for a single DA step using non-diagnoal observation error covariance matrix without post-processing, distributing analysis, and setting next observation step.

Variational DA

diagnoal observation matrix

pyPDAF.PDAF.omi_put_state_3dvar

3DVar DA for a single DA step using diagnoal observation error covariance matrix without post-processing, distributing analysis, and setting next observation step.

pyPDAF.PDAF.omi_put_state_en3dvar_estkf

3DEnVar for a single DA step using diagnoal observation error covariance matrix without post-processing, distributing analysis, and setting next observation step.

pyPDAF.PDAF.omi_put_state_hyb3dvar_estkf

Hybrid 3DEnVar for a single DA step using diagnoal observation error covariance matrix without post-processing, distributing analysis, and setting next observation step.

pyPDAF.PDAF.localomi_put_state_en3dvar_lestkf

3DEnVar for a single DA step where the ensemble anomaly is generated by LESTKF using diagnoal observation error covariance matrix without post-processing, distributing analysis, and setting next observation step.

pyPDAF.PDAF.localomi_put_state_hyb3dvar_lestkf

Hybrid 3DEnVar for a single DA step using diagnoal observation error covariance matrix without post-processing, distributing analysis, and setting next observation step.

non-diagnoal observation matrix

pyPDAF.PDAF.omi_put_state_3dvar_nondiagR

3DVar DA for a single DA step using non-diagnoal observation error covariance matrix without post-processing, distributing analysis, and setting next observation step.

pyPDAF.PDAF.omi_put_state_en3dvar_estkf_nondiagR

3DEnVar for a single DA step using non-diagnoal observation error covariance matrix without post-processing, distributing analysis, and setting next observation step.

pyPDAF.PDAF.omi_put_state_hyb3dvar_estkf_nondiagR

Hybrid 3DEnVar for a single DA step using non-diagnoal observation error covariance matrix without post-processing, distributing analysis, and setting next observation step.

pyPDAF.PDAF.localomi_put_state_en3dvar_lestkf_nondiagR

3DEnVar for a single DA step without post-processing, distributing analysis, and setting next observation step.

pyPDAF.PDAF.localomi_put_state_hyb3dvar_lestkf_nondiagR

Hybrid 3DEnVar for a single DA step using non-diagnoal observation error covariance matrix without post-processing, distributing analysis, and setting next observation step.

OMI functions

obs_f setter functions

pyPDAF.PDAF.omi_set_doassim

This function sets the doassim attribute of obs_f typically used in user-supplied function py__init_dim_obs_pdaf.

pyPDAF.PDAF.omi_set_disttype

This function sets the disttype attribute of obs_f typically used in user-supplied function py__init_dim_obs_pdaf.

pyPDAF.PDAF.omi_set_ncoord

This function sets the ncoord attribute of obs_f typically used in user-supplied function py__init_dim_obs_pdaf.

pyPDAF.PDAF.omi_set_id_obs_p

Setting the id_obs_p attribute of obs_f.

pyPDAF.PDAF.omi_set_icoeff_p

This function sets the icoeff_p attribute of obs_f typically used in user-supplied function py__init_dim_obs_pdaf.

pyPDAF.PDAF.omi_set_domainsize

This function sets the domainsize attribute of obs_f typically used in user-supplied function py__init_dim_obs_pdaf.

pyPDAF.PDAF.omi_set_obs_err_type

This function sets the obs_err_type attribute of obs_f typically used in user-supplied function py__init_dim_obs_pdaf.

pyPDAF.PDAF.omi_set_use_global_obs

This function sets the use_global_obs attribute of obs_f typically used in user-supplied function py__init_dim_obs_pdaf.

pyPDAF.PDAF.omi_set_inno_omit

This function sets the inno_omit attribute of obs_f typically used in user-supplied function py__init_dim_obs_pdaf.

pyPDAF.PDAF.omi_set_inno_omit_ivar

This function sets the inno_omit_ivar attribute of obs_f typically used in user-supplied function py__init_dim_obs_pdaf.

Observation operators

pyPDAF.PDAF.omi_obs_op_gridpoint

A (partial) identity observation operator

pyPDAF.PDAF.omi_obs_op_gridavg

Observation operator that average values on given model grid points.

pyPDAF.PDAF.omi_obs_op_interp_lin

Observation operator that linearly interpolates model grid values to observation location.

pyPDAF.PDAF.omi_obs_op_adj_gridavg

The adjoint observation operator of pyPDAF.PDAF.omi_obs_op_gridavg().

pyPDAF.PDAF.omi_obs_op_adj_gridpoint

The adjoint observation operator of pyPDAF.PDAF.omi_obs_op_gridpoint().

pyPDAF.PDAF.omi_obs_op_adj_interp_lin

The adjoint observation operator of pyPDAF.PDAF.omi_obs_op_interp_lin().

Interpolations

pyPDAF.PDAF.omi_get_interp_coeff_tri

The coefficient for linear interpolation in 2D on unstructure triangular grid.

pyPDAF.PDAF.omi_get_interp_coeff_lin1D

The coefficient for linear interpolation in 1D.

pyPDAF.PDAF.omi_get_interp_coeff_lin

The coefficient for linear interpolation up to 3D.

Localisation

pyPDAF.PDAF.omi_obsstats_l

This function is called in the update routine of local filters and write statistics on locally used and excluded observations.

pyPDAF.PDAF.omi_weights_l

This function computes a weight vector according to the distances of observations from the local analysis domain with a vector of localisation radius.

pyPDAF.PDAF.omi_weights_l_sgnl

This function computes a weight vector according to the distances of observations from the local analysis domain with given localisation radius.

pyPDAF.PDAF.omi_init_dim_obs_l_iso

The function has to be called in init_dim_obs_l_OBTYPE in each observation module if a domain-localized filter (LESTKF/LETKF/LNETF/LSEIK)is used.

pyPDAF.PDAF.omi_init_dim_obs_l_noniso

The function has to be called in init_dim_obs_l_OBTYPE in each observation module if a domain-localized filter (LESTKF/LETKF/LNETF/LSEIK)is used.

pyPDAF.PDAF.omi_init_dim_obs_l_noniso_locweights

The function has to be called in init_dim_obs_l_OBTYPE in each observation module if a domain-localized filter (LESTKF/LETKF/LNETF/LSEIK)is used.

pyPDAF.PDAF.omi_localize_covar_iso

The function has to be called in localize_covar_OBTYPE in each observation module.

pyPDAF.PDAF.omi_localize_covar_noniso

The function has to be called in localize_covar_OBTYPE in each observation module.

pyPDAF.PDAF.omi_localize_covar_noniso_locweights

The function has to be called in localize_covar_OBTYPE in each observation module.

Others

pyPDAF.PDAF.omi_set_domain_limits

This is used to set the domain limits for the use of pyPDAF.PDAF.omi_set_use_global_obs.Currently, it only supports 2D limitations.

pyPDAF.PDAF.omi_set_debug_flag

This sets the debug flag for OMI.

pyPDAF.PDAF.omi_gather_obs

This function is typically called in the user-supplied function py__init_dim_obs_pdaf.

pyPDAF.PDAF.omi_gather_obsstate

This function is used to implement custom observation operators.

pyPDAF.PDAF.omi_gather_obsdims

This function gathers the information about the full dimension of each observation type in each process-local subdomain.

pyPDAF.PDAF.omi_obsstats

The function is called in the update routine of global filters and writes statistics on used and excluded observations.

pyPDAF.PDAF.omit_obs_omi

This function computes innovation and omit corresponding observations in assimilation if the innovation is too large.

pyPDAF.PDAF.omi_deallocate_obs

It deallocates teh OMI-internal obsrevation arrays but this should not be called as it is called internally in PDAF.

pyPDAF.PDAF.omi_check_error

This function returns the value of the PDAF-OMI internal error flag.

Local module functions

pyPDAF.PDAF.local_set_indices

Set index vector to map local state vector to global state vectors.

pyPDAF.PDAF.local_set_increment_weights

This function initialises a PDAF_internal local array of increment weights.

pyPDAF.PDAF.local_clear_increment_weights

This function deallocates the local increment weight vector in pyPDAF.PDAF.local_set_increment_weights if it is allocated

Utilities

Synthetic experiments

pyPDAF.PDAF.omi_generate_obs

Generation of synthetic observations based on given error statistics and observation operator for diagonal observation error covariance matrix.

pyPDAF.PDAF.generate_obs

Generation of synthetic observations based on given error statistics and observation operator.

pyPDAF.PDAF.omi_put_state_generate_obs

Generation of synthetic observations based on given error statistics and observation operator for diagonal observation error covariance matrix without post-processing, distributing analysis, and setting next observation step.

pyPDAF.PDAF.put_state_generate_obs

Generation of synthetic observations based on given error statistics and observation operator.

Statistical diagnostics

pyPDAF.PDAF.diag_effsample

Calculating the effective sample size of a particle filter.

pyPDAF.PDAF.diag_ensstats

Computing the skewness and kurtosis of the ensemble of a given element of the state vector.

pyPDAF.PDAF.diag_histogram

Computing the rank histogram of an ensemble.

pyPDAF.PDAF.diag_CRPS

Obtain a continuous rank probability score for an ensemble.

pyPDAF.PDAF.diag_CRPS_nompi

Obtain a continuous rank probability score for an ensemble without using MPI parallelisation.

Ensemble generation

pyPDAF.PDAF.eofcovar

EOF analysis of an ensemble of state vectors by singular value decomposition.

pyPDAF.PDAF.SampleEns

This function generates an ensemble from singular values and their vectors (EOF modes) centred on given mean state.

Diagnostics

pyPDAF.PDAF.get_assim_flag

This function returns the flag that indicates if the DA is performed in the last time step.

pyPDAF.PDAF.get_ensstats

This is a diagnotics function for LKNETF which returns the skewness and kutosis used there.

pyPDAF.PDAF.get_localfilter

This function returns whether a local filter is used.

pyPDAF.PDAF.get_memberid

This function returns the ensemble member id on the current process.

pyPDAF.PDAF.get_obsmemberid

This function returns the ensemble member id when observation operator is being applied.

pyPDAF.PDAF.get_smootherens

This function returns the smoothed ensemble in earlier time steps.

pyPDAF.PDAF.set_debug_flag

This function activates the debug output of the PDAF.

pyPDAF.PDAF.print_local_obsstats

This function print the observation statistics of local domain on screen.

pyPDAF.PDAF.print_domain_stats

This function make screen output of statistics of the local domains on current process.

Advanced manipulation

pyPDAF.PDAF.set_ens_pointer

This function returns the ensemble array in a numpy array where the internal array data has the same memoery address as PDAF ensemble array.

pyPDAF.PDAF.set_smootherens

This function can be used in the offline implementation when a smoother is used.

pyPDAF.PDAF.set_memberid

This function sets the ensemble member index to given value.

pyPDAF.PDAF.set_comm_pdaf

This function sets the MPI communicator of PDAF.

pyPDAF.PDAF.set_offline_mode

This function activates offline mode.

pyPDAF.PDAF.reset_forget

This function allows a user to reset the forgetting factor manually during the assimilation process.

pyPDAF.PDAF.init_local_obsstats

This function initialise the observation statistics of local domain.

pyPDAF.PDAF.incr_local_obsstats

This function update the observation statistics of local domain.

pyPDAF.PDAF.force_analysis

This function overwrite member index of the ensemble state by local_dim_ens (number of ensembles for current process, in full parallel setup, this is 1.) and the counter cnt_steps by nsteps-1.

Others

pyPDAF.PDAF.get_state

Post-processing the analysis and distributing state vector back to the model.

pyPDAF.PDAF.assimilate_prepost

It is used to preprocess and postprocess of the ensemble.

pyPDAF.PDAF.prepost

This function does not perform any DA.

pyPDAF.PDAF.put_state_prepost

It is used to preprocess and postprocess of the ensemble.

pyPDAF.PDAF.gather_dim_obs_f

Gathers the dimension of observation vector across multiple local domains/filter processors.

pyPDAF.PDAF.gather_obs_f

In the local filters (LESKTF, LETKF, LSEIK, LNETF) this function returns the total observation vector from process-local observations.

pyPDAF.PDAF.gather_obs_f2

In the local filters (LESKTF, LETKF, LSEIK, LNETF) this function returns the full observation coordinates from process-local observation coordinates.

pyPDAF.PDAF.incremental

This is a helper function to apply analysis increment to model state in model forecast phase.

pyPDAF.PDAF.add_increment

This function directly adds analysis increment to given state vector without the need for user-supplied functions.

pyPDAF.PDAF.local_weight

The function is used for localisation in the analysis step of a filter and computes a weight according to the specified distance and the settings for the localising function.

pyPDAF.PDAF.local_weights

This function returns a vector of the localisation weights based on distance and localisation functions and radii.

pyPDAF.PDAF.gather_obs_f2_flex

In the local filters (LESKTF, LETKF, LSEIK, LNETF) this function returns the full observation coordinates from process-local observation coordinates.

pyPDAF.PDAF.gather_obs_f_flex

In the local filters (LESKTF, LETKF, LSEIK, LNETF) this function returns the total observation vector from process-local observations.

Internal matrix operations

pyPDAF.PDAF.seik_TtimesA

This is an internal function in PDAF where it perform matrix calculation of B = TA.

pyPDAF.PDAF.etkf_Tleft

This is an internal function in PDAF where it perform matrix calculation of B = TA.

pyPDAF.PDAF.estkf_OmegaA

This function is an internal function in PDAF.

pyPDAF.PDAF.enkf_omega

Generation of a random matrix with orthogonal basis following SEEK approach for EnKF with given properties.

pyPDAF.PDAF.seik_omega

Generation of a random matrix with orthogonal basis following SEIK approach.

Internal callback functions

pyPDAF.PDAF.omi_init_obs_f_cb

This function is an internal PDAF-OMI function that is used as a call-back function to initialise the observation vector.

pyPDAF.PDAF.omi_init_obsvar_cb

This function is an internal PDAF function that is used as a call-back function to initialise the observation error variance.

pyPDAF.PDAF.omi_g2l_obs_cb

This function is an internal PDAF-OMI function that is used as a call-back function to convert between global and local observation vectors in domain localisation.

pyPDAF.PDAF.omi_init_obs_l_cb

This function is an internal PDAF-OMI function that is used as a call-back function to initialise local observation vector in domain localisation.

pyPDAF.PDAF.omi_init_obsvar_l_cb

This function is an internal PDAF-OMI function that is used as a call-back function to initialise local observation vector in domain localisation.

pyPDAF.PDAF.omi_prodRinvA_l_cb

This function is an internal PDAF-OMI function that is used as a call-back function to perform the matrix multiplication inverse of local observation error covariance and a matrix A in domain localisation.

pyPDAF.PDAF.omi_likelihood_l_cb

This is an internal PDAF-OMI function that is used as a call-back function to compute the likelihood of the observation for a given ensemble member according to the observations used for the local analysis in the localized LNETF.

pyPDAF.PDAF.omi_prodRinvA_cb

This function is an internal PDAF-OMI function that is used as a call-back function to perform the matrix multiplication inverse of observation errro covariance and a matrix A.

pyPDAF.PDAF.omi_likelihood_cb

This is an internal PDAF-OMI function that is used as a call-back function to compute the likelihood of the observation for a given ensemble member according to the observations used for the local analysis for NETF or particle filter.

pyPDAF.PDAF.omi_add_obs_error_cb

This is an internal PDAF-OMI function that is used as a call-back function to add random observation error to stochastic EnKF.

pyPDAF.PDAF.omi_init_obscovar_cb

This is an internal PDAF-OMI function that is used as a call-back function to construct a full observation error covariance matrix used only in stochastic EnKF.

pyPDAF.PDAF.omi_init_obserr_f_cb

This is an internal PDAF-OMI function that is used as a call-back function to construct a full observation error covariance matrix used only in stochastic EnKF.

pyPDAF.PDAF.omi_prodRinvA_hyb_l_cb

This function is an internal PDAF-OMI function that is used as a call-back function to perform the matrix multiplication inverse of local observation error covariance and a matrix A in LKNETF.

pyPDAF.PDAF.omi_likelihood_hyb_l_cb

This is an internal PDAF-OMI function that is used as a call-back function to compute the likelihood of the observation for a given ensemble member according to the observations used for the local analysis in LKNETF.

pyPDAF.PDAF.omi_omit_by_inno_l_cb

The function is called during the analysis step on each local analysis domain.

pyPDAF.PDAF.omi_omit_by_inno_cb

The function is called during the analysis step of a global filter.

pyPDAF.PDAF.local_g2l_cb

Project a global to a local state vector for the localized filters.

pyPDAF.PDAF.local_l2g_cb

Initialise elements of a global state vector from a local state vector.