Add EnRTS Smoother - #268
Merged
Merged
Conversation
This commit adds an EnRTS smoother to complement the EnKF. This is based on the presentation of [Raanes (2016)](https://rmets.onlinelibrary.wiley.com/doi/10.1002/qj.2728), which also demonstrates an equivalence with the forward pass-only "ensemble Kalman smoother." Some implementation choices: - The EnRTS smoother requires the "predicted states," i.e., the ensemble $x_{t+1 \mid t}$. Under the current EnKf implementation, this would require re-computing $E_{t+1 \mid t}$, which felt wasteful. Moreover, since the EnKF implementation is of the stochastic EnKF, one would have to be rather careful with PRNG keys as well to make this happen. The compromise I took is thus to add a `store_predicted_states` option to the filter, and store the corresponding info in the `EnKFState`. To run the EnRTS filter, this information must be present. This comes at a modest memory cost (at least, for the typical EnKF application of N_particles << d_X). - I left this new argument to be `False` by default, documented its need in the EnRTS, and give errors if it is not in the EnKF state. The EnRTS tests in `cuthbertlib` includes a basic atomic test of the update, whilst the tests in cuthbert do a more end-to-end comparison to the RTS smoother with a large particle count.
These passed exactly on my machine, but apparently need a small epsilon on the GitHub CI machines.
SamDuffield
reviewed
Aug 6, 2026
SamDuffield
left a comment
Contributor
There was a problem hiding this comment.
Love this @DanWaxman thanks! Couple of minors and then good to merge!
I did also wonder if it made sense to rename e.g. cuthbert.enkf to cuthbert.ensemble_kalman with the addition of smoothing but it's a fair bit longer. What do you think?
Collaborator
Author
I think that makes sense! I made this change in 63a1bcb, and addressed the other comments as well. |
SamDuffield
approved these changes
Aug 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses #242. This PR adds an EnRTS smoother to complement the EnKF. This is based on the presentation of Raanes (2016), which also demonstrates an equivalence with the forward pass-only "ensemble Kalman smoother."
Some implementation choices:
store_predicted_statesoption to the filter, and store the corresponding info in theEnKFState. To run the EnRTS filter, this information must be present. This comes at a modest memory cost (at least, for the typical EnKF application of N_particles << d_X).Falseby default, documented its need in the EnRTS, and give errors if it is not in the EnKF state.The EnRTS tests in
cuthbertlibincludes a basic atomic test of the update, whilst the tests in cuthbert do a more end-to-end comparison to the RTS smoother with a large particle count.