Specifying Observation Errors

DAPyr can specify both a “true” observation error distribution, which is used when generating observations from a nature run, and an “assumed” observation error distribution, which is used when observations are assimilated. Currently, two different forms of the observation error are supported; to add a new one, add an additional section to sample_errors or get_likelihood. Observation error distributions are set by means of the true_obs_err_dist and assumed_obs_err_dist flags when initializing experiments, and the parameters for each distribution are specified in true_obs_err_params and assumed_obs_err_params, respectively.

Setting the True Observation Error Distribution

DAPyr.OBS_ERRORS.sample_errors(states: ndarray, true_obs_err_dist: int, true_obs_err_params: dict, rng: Generator)

Generate samples of observation error according to a prescribed distribution.

Parameters:
  • states (np.array(M, T)) – M-dimensional model states valid at T different times that each observation error will correspond to.

  • true_obs_err_dist (int) – Flag for specifying what distribution observation errors should be sampled from.

  • true_obs_err_params (dict) – Parameters of the distribution specified by true_obs_err_dist.

  • rng (numpy.random.Generator) – Random number generator to sample errors with.

Returns:

errors – Sampled observation errors.

Return type:

array(M, T)

Setting the Assumed Observation Error Distribution

DAPyr.OBS_ERRORS.get_likelihood(assumed_obs_err_dist: int, assumed_obs_err_params: dict)

Create likelihood fucntion corresponding to a prescribed observation error distribution. If a Gaussian observation error is assumed, this also determines the variance used by the ensemble Kalman filter.

Parameters:
  • assumed_obs_err_dist (int) – Flag for specifying what distribution observation errors should be assumed to come from.

  • assumed_obs_err_params (dict) – Parameters of the distribution specified by assumed_obs_err_dist.

Returns:

L – Callable likelihood function L(y, hx). The first argument is a vector of scalar observations, and the second argument is the model state projected into observation space.

Return type:

functools.partial

Currently Supported Observation Error Distributions

Name

Distribution Flag

Parameters

Description

Gaussian

0

‘mu’, ‘sigma’

Gaussian distribution with mean ‘mu’ and standard deviation ‘sigma’.

State-Dependent Gaussian

1

‘mu1’, ‘sigma1’, ‘mu2’, ‘sigma2’, ‘threshold’

If the model state x < ‘threshold’, draws from a Gaussian distribution with mean
‘mu1’ and standard deviation ‘sigma1’. Otherwise, draws from a Gaussian
distribution with mean ‘mu2’ and standard deviation ‘sigma2’.