API

This page provides a list of pyPDAF functions that are intended for users. They are grouped by functionalities. Clicking on a function name will lead to its documentation page.

These are not all available functions in pyPDAF. Similar to PDAF, pyPDAF maintains backward compatible legacy functions used prior to PDAF 3.0. For a complete list of functions, please refer to the [hidden and legacy function page](hidden_functions.md)

Initialisation and finalisation

pyPDAF.init

Initialise the PDAF system.

pyPDAF.set_parallel

Set MPI communicators and parallelisation in PDAF.

pyPDAF.init_forecast

The routine PDAF_init_forecast has to be called once at the end of the initialization of PDAF/start of DA cycles.

pyPDAF.PDAFomi.init

Allocating an array of obs_f derived types instances.

pyPDAF.PDAFomi.init_local(self, /)

Allocating an array of obs_l derived types instances.

pyPDAF.deallocate(self, /)

Finalise the PDAF systems including freeing some of the memory used by PDAF.

DA algorithms

Sequential DA

diagnoal observation matrix

pyPDAF.assimilate

Online ensemble filters and smoothers except for 3DVars for a single DA step using diagnoal observation error covariance matrix.

pyPDAF.assim_offline

Offline ensemble filters and smoothers except for 3DVars for a single DA step using diagnoal observation error covariance matrix.

non-diagnoal observation matrix

pyPDAF.assimilate_local_nondiagr

Online assimilation of domain local filters for a single DA step using non-diagnoal observation error covariance matrix.

pyPDAF.assimilate_global_nondiagr

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

pyPDAF.assimilate_lnetf_nondiagr

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

pyPDAF.assimilate_lknetf_nondiagr

Online assimilation of LKNETF for a single DA step using non-diagonal observation error covariance matrix.

pyPDAF.assimilate_enkf_nondiagr

Online assimilation of global or Covariance localised stochastic EnKF for a single DA step using non-diagonal observation error covariance matrix.

pyPDAF.assimilate_nonlin_nondiagr

Online assimilation of global nonlinear filters for a single DA step using non-diagonal observation error covariance matrix.

pyPDAF.assim_offline_local_nondiagr

Offline assimilation of domain local filters for a single DA step using non-diagnoal observation error covariance matrix.

pyPDAF.assim_offline_global_nondiagr

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

pyPDAF.assim_offline_lnetf_nondiagr

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

pyPDAF.assim_offline_lknetf_nondiagr

Offline assimilation of LKNETF for a single DA step using non-diagonal observation error covariance matrix.

pyPDAF.assim_offline_enkf_nondiagr

Offline assimilation of global or Covariance localised stochastic EnKF for a single DA step using non-diagonal observation error covariance matrix.

pyPDAF.assim_offline_lenkf_nondiagr

Online assimilation of covariance localised stochastic EnKF for a single DA step using non-diagonal observation error covariance matrix.

pyPDAF.assim_offline_nonlin_nondiagr

Offline assimilation of global nonlinear filters for a single DA step using non-diagonal observation error covariance matrix.

Variational DA

diagnoal observation matrix

pyPDAF.assimilate_3dvar_all

Online assimilation for all types of 3DVar DA for a single DA step using diagonal observation error covariance matrix.

pyPDAF.assim_offline_3dvar_all

Offline assimilation for all types of 3DVar DA for a single DA step using diagonal observation error covariance matrix.

non-diagnoal observation matrix

pyPDAF.assimilate_3dvar_nondiagr

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

pyPDAF.assimilate_en3dvar_estkf_nondiagr

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

pyPDAF.assimilate_en3dvar_lestkf_nondiagr

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

pyPDAF.assimilate_hyb3dvar_estkf_nondiagr

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

pyPDAF.assimilate_hyb3dvar_lestkf_nondiagr

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

pyPDAF.assim_offline_3dvar_nondiagr

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

pyPDAF.assim_offline_en3dvar_estkf_nondiagr

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

pyPDAF.assim_offline_en3dvar_lestkf_nondiagr

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

pyPDAF.assim_offline_hyb3dvar_estkf_nondiagr

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

pyPDAF.assim_offline_hyb3dvar_lestkf_nondiagr

Offline hybrid 3DEnVar for a single DA step using non-diagonal observation error covariance matrix.

OMI functions

setter functions

pyPDAF.PDAFomi.set_doassim

Setting the doassim attribute of obs_f for i-th observation type.

pyPDAF.PDAFomi.set_disttype

Setting the observation localisation distance calculation method for i-th observation type.

pyPDAF.PDAFomi.set_ncoord

Setting the number of spatial dimensions of observations for i-th observation type.

pyPDAF.PDAFomi.set_obs_err_type

Setting the type of observation error distribution for i-th observation type.

pyPDAF.PDAFomi.set_use_global_obs

Switch for only use process-local observations for i-th observation type.

pyPDAF.PDAFomi.set_inno_omit

Setting innovation threshold for removing observation outliers.

pyPDAF.PDAFomi.set_inno_omit_ivar

Setting the inverse of observation error variance for omitted observations.

pyPDAF.PDAFomi.set_id_obs_p

Setting the id_obs_p attribute of obs_f for i-th observation type.

pyPDAF.PDAFomi.set_icoeff_p

Setting the observation interpolation coefficient for i-th observation type.

pyPDAF.PDAFomi.set_domainsize

Setting the domain periodicity attribute of obs_f for i-th observation type.

pyPDAF.PDAFomi.set_name

Set a name for given observation type

pyPDAF.PDAFomi.gather_obs

Gather the dimension of a given type of observation across multiple local domains/filter processors.

Observation operators

pyPDAF.PDAFomi.obs_op_gridpoint

A (partial) identity observation operator

pyPDAF.PDAFomi.obs_op_gridavg

Observation operator that average values on given model grid points.

pyPDAF.PDAFomi.obs_op_extern

Observation operator for given observed model state.

pyPDAF.PDAFomi.obs_op_interp_lin

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

pyPDAF.PDAFomi.obs_op_adj_gridavg

The adjoint observation operator of pyPDAF.PDAFomi.obs_op_gridavg().

pyPDAF.PDAFomi.obs_op_adj_gridpoint

The adjoint observation operator of pyPDAF.PDAFomi.obs_op_gridpoint().

pyPDAF.PDAFomi.obs_op_adj_interp_lin

The adjoint observation operator of pyPDAF.PDAFomi.obs_op_interp_lin().

pyPDAF.PDAFomi.gather_obsstate

This function is used to implement custom observation operators.

Interpolations

pyPDAF.PDAFomi.get_interp_coeff_tri

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

pyPDAF.PDAFomi.get_interp_coeff_lin1d

The coefficient for linear interpolation in 1D.

pyPDAF.PDAFomi.get_interp_coeff_lin

The coefficient for linear interpolation up to 3D.

Localisation

pyPDAF.PDAFomi.init_dim_obs_l_iso

Initialize the observation information corresponding to an isotropic local analysis domain.

pyPDAF.PDAFomi.init_dim_obs_l_noniso

Initialize the observation information corresponding to a non-isotropic local analysis domain.

pyPDAF.PDAFomi.init_dim_obs_l_noniso_locweights

Initialize the observation information corresponding to a non-isotropic local analysis domain.

pyPDAF.PDAFomi.observation_localization_weights

Returns a vector of observation localisation weights.

pyPDAF.PDAFomi.set_domain_limits

Set the domain limits for domain decomposed local domain.

pyPDAF.PDAFomi.get_domain_limits_unstr

Set the domain limits for unstructured domain decomposed local domain.

pyPDAF.PDAFomi.set_localize_covar_iso

Initialise local observation information for isotropic covariance localisation.

pyPDAF.PDAFomi.set_localize_covar_noniso

Initialise local observation information for non-isotropic covariance localisation.

pyPDAF.PDAFomi.set_localize_covar_noniso_locweights

Initialise local observation information for non-isotropic covariance localisation.

Custom local observation initialisation

pyPDAF.PDAFomi.set_localization

Stores the isotropic localization parameters (cradius, sradius, locweight) in OMI.

pyPDAF.PDAFomi.set_localization_noniso

Stores the non-isotropic localization parameters (cradius, sradius, locweight) in OMI.

pyPDAF.PDAFomi.set_dim_obs_l

Stores the local number of observations for OMI-internal initialisations.

pyPDAF.PDAFomi.store_obs_l_index

Save local observation information in PDAF.

pyPDAF.PDAFomi.store_obs_l_index_vdist

Save local observation information for 2+1D factorized localization in the vertical direction in PDAF.

Diagnostics

pyPDAF.PDAFomi.check_error

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

pyPDAF.PDAFomi.set_debug_flag

Activate the debug output of the PDAFomi.

pyPDAF.PDAFomi.set_obs_diag

Activate or deactivate the observation diagnostics.

pyPDAF.PDAFomi.diag_dimobs(self, /)

Observation dimension for each observation type.

pyPDAF.PDAFomi.diag_get_hx

Observed ensemble for given observation type.

pyPDAF.PDAFomi.diag_get_hxmean

Observed ensemble mean for given observation type.

pyPDAF.PDAFomi.diag_get_ivar

Inverse of observation error variance for given observation type.

pyPDAF.PDAFomi.diag_get_obs

Observation vector and corresponding coordinates for specified observation type.

pyPDAF.PDAFomi.diag_nobstypes

The number of observation types that are active in an assimilation run.

pyPDAF.PDAFomi.diag_obs_rmsd

Root mean squared distance between observation and obseved model state for each observation type.

pyPDAF.PDAFomi.diag_stats

A selection of 6 statistics comparing the observations and the observed ensemble mean for each observation type.

Localisation functions

pyPDAF.PDAFlocal.set_indices

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

pyPDAF.PDAFlocal.set_increment_weights

Initialises a PDAF_internal local array of increment weights.

pyPDAF.PDAFlocal.clear_increment_weights(self, /)

Deallocates the local increment weight vector in pyPDAF.PDAFlocal.set_increment_weights().

pyPDAF.PDAF.correlation_function

The value of the chosen correlation function according to the specified length scale.

pyPDAF.PDAF.local_weight

Get localisation weight for given distance, cut-off radius, support radius, weighting type, and weighting function.

pyPDAF.PDAF.local_weights

Get a vector of localisation weights for given distances, cut-off radius, support radius, weighting type, and weighting function.

Utilities

PDAF state and setup information

pyPDAF.get_fcst_info

Return the number of time steps, current model time, and a flag whether the forecasting should be exited.

pyPDAF.PDAF.get_assim_flag(self, /)

Return the flag that indicates if the DA is performed in the last time step.

pyPDAF.PDAF.get_localfilter(self, /)

Return whether a local filter is used.

pyPDAF.PDAF.get_local_type(self, /)

The routine returns the information on the localization type of the selected filter.

pyPDAF.PDAF.get_memberid

Return the ensemble member id on the current process.

pyPDAF.PDAF.get_obsmemberid

Return the ensemble member id when observation operator is being applied.

pyPDAF.PDAF.get_smoother_ens(self, /)

Return the smoothed ensemble in earlier time steps.

pyPDAF.PDAF.print_filter_types

Print the list of available named filter types and their IDs.

pyPDAF.PDAF.print_da_types

Print the list of available named DA method types and their IDs.

pyPDAF.PDAF.print_info

Print PDAF timing and memory information.

Observation MPI handling

pyPDAF.PDAF.gather_dim_obs_f

Gather 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.gather_obs_f_flex

Gather full observation from processor local observation without PDAF-internal info.

pyPDAF.PDAF.gather_obs_f2_flex

Gather full observation coordinates from processor local observation coordinates without PDAF-internal info.

Synthetic experiments

pyPDAF.generate_obs

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

pyPDAF.generate_obs_offline

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

Incremental analysis update

pyPDAF.PDAF.iau_init

Initialise parameters for incremental analysis updates, IAU.

pyPDAF.PDAF.iau_reset

Modify the IAU type and the number of IAU time steps during a run

pyPDAF.PDAF.iau_set_pointer(self, /)

Set a pointer to the ensemble increments array.

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_mpi

Obtain a continuous rank probability score for an ensemble.

pyPDAF.PDAF.diag_crps_nompi

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

Ensemble generation

pyPDAF.PDAF.eofcovar

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

pyPDAF.PDAF.sample_ens

Generate an ensemble from singular values and their vectors (EOF modes) of an ensemble anomaly matrix.

PDAF debug options

pyPDAF.PDAF.set_debug_flag

Activate the debug output of the PDAF.

Advanced manipulation

pyPDAF.PDAF.set_iparam

Set integer parameters for PDAF.

pyPDAF.PDAF.set_rparam

Set floating-point parameters for PDAF.

pyPDAF.PDAF.set_comm_pdaf

Set the MPI communicator used by PDAF.

pyPDAF.PDAF.set_ens_pointer(self, /)

Return the ensemble in a numpy array.

pyPDAF.PDAF.set_memberid

Set the ensemble member index to given value.

pyPDAF.PDAF.set_offline_mode

Activate offline mode of PDAF.

pyPDAF.PDAF.set_seedset

Choose a seedset for the random number generator used in PDAF.

pyPDAF.PDAF.set_smoother_ens

Get a pointer to smoother ensemble.

pyPDAF.PDAF.force_analysis(self, /)

Perform assimilation after this function call.

pyPDAF.PDAF.reset_forget

Reset the forgetting factor manually during the assimilation process.