NCAR / NCAR/DART

bug: obs_increment_bounded_norm_rhf does not check for error returned from bnrh_cdf

Open
#784 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

QCEFF
Dominant language
Fortran
Stars
263
Forks
182
Avg merge
11d 12h
Merged PRs (30d)
7

Description

obs_increment_bounded_norm_rhf calls bnrh_cdf to get the quantiles for a prior ensemble. bnrh_cdf can fail if the computed prior standard deviation is not positive. If it fails, it returns a large negative value for tail_sd_left and tail_sd_right. There is no check for this failure in obs_increment_bounded_norm_rhf which proceeds to do a Bayes product and an inversion of the posterior quantiles. There is a check for negative variance at the start of obs_increment_bounded_norm_rhf that results in an error failure. However, the ways in which the prior variance are computed and the way the prior standard deviation is computed in bnrh_cdf are different. While I have not been able to create a test case that is a problem here, it seems like it could be possible.

The simple solution is to have obs_increment_bounded_norm_rhf fail if bnrh_cdf returns the large negative for tail_sd_left.

If this ever occured, a more subtle study of the actual case that results in the problem could advise a solution that would not involve failure.

In the long-term, it would be good to have consistent computation of the measure of the prior ensemble second moment (variance or standard deviation).

If the possible bug did manage to occur, the increments from a previously assimilated observation would be used for the current observation which could possibly lead to large, inappropriate increments to state or observation priors in the filter_assim.

This problem can be seen in v11.8.6-3-g942b02432 but has existed since the original QCEFF implementation.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at obs_increment_bounded_norm_rhf and trace its call to bnrh_cdf, focusing on how tail_sd_left and tail_sd_right signal failure. Compare the existing negative-variance check with bnrh_cdf's failure result, then inspect filter_assim's use of the increments. Done means the failure is detected before the Bayes product and posterior-quantile inversion, with a regression test if a reproducible case can be constructed.

Written by the indexing model from the issue text.

Assessment

Tech stack
fortran
Domain
data
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.