Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated Inflation Documentation #806

Merged
merged 10 commits into from
Feb 3, 2025
Merged

Conversation

mgharamti
Copy link
Contributor

Description:

Completely re-wrote the inflation documentation: docs.dart.ucar.edu/en/latest/guide/inflation.html

Fixes issue

This fixes issues: #775 and #276

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

Documentation changes needed?

  • My change requires a change to the documentation.
    • I have updated the documentation accordingly.

Tests

Please describe any tests you ran to verify your changes.

Checklist for merging

  • Updated changelog entry
  • Documentation updated
  • Update conf.py

Checklist for release

  • Merge into main
  • Create release from the main branch with appropriate tag
  • Delete feature-branch

Testing Datasets

  • Dataset needed for testing available upon request
  • Dataset download instructions included
  • No dataset needed

@hkershaw-brown
Copy link
Member

Hi Moha, I'm going to rewrite the history on this branch so it is just your inflation changes.
Sorry for the round-about-ness, I just want to loose the funky merge history.

@braczka
Copy link
Contributor

braczka commented Jan 23, 2025

Thanks @mgharamti and @hkershaw-brown . I will take a look at this soon.

@hkershaw-brown
Copy link
Member

@jlaucar
Copy link
Contributor

jlaucar commented Jan 27, 2025 via email

@hkershaw-brown
Copy link
Member

@mgharamti we need to fix your local copy main branch, otherwise you'll just keep committing this merge history:
Screenshot 2025-01-27 at 1 53 18 PM

@hkershaw-brown
Copy link
Member

I'll rewrite the history, lets get your repo up to date after the standup tomorrow.

@mgharamti
Copy link
Contributor Author

Sounds great. Thanks!

The inflation documentation has been re-written, making it
concise and clear to the users. Several recommendations on
what type of inflation (and for what reason) to use, are made.
I also provide detailed steps on how to test inflation behavior.
Removed old deprecated algorithms and added the supported
ones using the QCEF formulation. Also, replaced the old
(unclear) localization image.
@braczka
Copy link
Contributor

braczka commented Jan 30, 2025

@hkershaw-brown What's the best way for me to push my changes to the inf_docs branch? I am used to a branch being created on the DART repo, where I can check out and make changes locally, however, in this case it looks like inf_docs exists on Moha's repo -- which I can also check out, but given the history rewrite etc, just wanted to be sure what's the best approach here.

@hkershaw-brown
Copy link
Member

@braczka because this is a pull request, you have write permission to this branch on Moha's fork of DART

Couple of ways you can work with this:

  1. You can clone Moha's fork:
   git clone https://github.com/mgharamti/DART.git DART.Moha
   cd DART.Moha
   git checkout inf_docs
       make your changes
   git push origin inf_docs
  1. Or you can add Moha's fork as a remote to your local DART
   cd DART (a regular clone of DART)
   git remote add moha https://github.com/mgharamti/DART.git 
   git checkout inf_docs
      make your changes
   git push moha inf_docs

@hkershaw-brown
Copy link
Member

@braczka
Copy link
Contributor

braczka commented Jan 30, 2025

@hkershaw-brown Still having some issue pushing my changes -- when I do a git push moha inf_docs it asks for my username and password information which I provide, but password authentication is deprecated, so I generated a token for my password -- but it still giving me permission errors:

remote: Permission to mgharamti/DART.git denied to braczka.
fatal: unable to access 'https://github.com/mgharamti/DART.git/': The requested URL returned error: 403

I thought I had permission given its a PR on the DART repo -- but maybe I need permission on Moha's repo as well?

@hkershaw-brown
Copy link
Member

bummer, maintainers (including you) are allowed edit this pull request.
Screenshot 2025-01-30 at 1 43 08 PM
I've been pushing to this branch with wild abandon.

@mgharamti
Copy link
Contributor Author

@braczka, if it becomes too complicated could you provide your input as comments in the changed files? I'll update the files then according to your suggestions.

Otherwise, @hkershaw-brown please let me know if I need to do any permission changes on my end.

@braczka
Copy link
Contributor

braczka commented Jan 30, 2025

I feel like its just complicated enough, where suggesting changes in the comments is difficult and tedious. I can do that if necessary -- I must be messing something up on the git command process......

@braczka
Copy link
Contributor

braczka commented Jan 30, 2025

There we go ! I was using a 'fine-grained' token instead of the general use token, which was messing me up I think. In addition to the commits, I need to add some comments too..... will finish in a bit.

Copy link
Contributor

@braczka braczka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mgharamti This is fantastic -- thank you so much for updating this. This was very helpful for me to understanding inflation a lot better. Sorry, if I was a little heavy-handed with my commit changes -- it just expands on the distinction between the update of inflation versus the application of inflation, and also more detail on how the obs_impact_tool interacts with inflation. Really, just a bit more hand-holding and warnings for non-inflation experts like myself who could easily make a mistake in implementation or understanding of inflation.

Comment on lines 15 to 18
:math:`\widetilde{\mathbf{x}}_k^i = \sqrt{\lambda} \left( \mathbf{x}_k^i -
\overline{\mathbf{x}}_k \right) + \overline{\mathbf{x}}_k, \quad
i = 1, 2, ..., N_e`

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the subscript 'k' serve any purpose here? It's not defined and I wasn't sure if 'k' was the the same thing as 'e' the total ensemble members.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 'k' is there because of habit. I am just used to writing variables with their time index. I think there is no need for it here. I will remove it and will also set the ensemble size to 'N' rather than 'N_e'

Comment on lines 313 to 314
1. Start without any inflation; i.e., ``inf_flavor = 0, 0`` and assess the performance. For a healthy ensemble
DA system, one expects the prior RMSE and the total spread to be of the same order. We often use the ensemble
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this say the RMSE and tot_spread should be roughly the same 'value' or 'magnitude'? If you say they should be roughly the same 'order' this might suggest to me 'order of magnitude' which means even a 4-5x difference could be acceptable -- but I think we don't want the RMSE/tot_spread ratio being outside of 0.5 to 1.5 range.... correct? Could you clarify this for me ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The term that is often used in the literature is 'order'. Overall, I think you want to avoid insanely large consistency values but sometimes 4-5x could actually be acceptable especially if it doesn't persist over long assimilation windows. So, I wouldn't be so stringent on the range of the ensemble consistency values. Clearly, a consistency of 1 is what we're after but this may not be even possible in systems where error growth is limited. Yet, I'm going to use the word 'magnitude' because it provides a better guidance for the users.

@@ -83,21 +83,32 @@ DART includes advanced adaptive inflation algorithms that allow inflation
to vary dynamically in both space and time. These algorithms treat inflation
as a random variable characterized by a probability density function (PDF).
The mean (or mode) of the PDF is used as the inflation value, while the standard
deviation reflects the level of confidence in that value.
deviation reflects the level of confidence in that value. In this way, the
inflation parameters (mean, standard deviation) are prognostic variables and
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am going to omit the term 'prognostic variables'. This is typically used to describe a variable that the model predicts through integrating a physical equation. To me, a prognostic variable is a variable that has a partial derivative with respect to time in the model PDEs. Inflation mean and standard deviation is like a physical model parameter. I'll reword and push the change.

from being applied to a variable when inflation is turned on. If a variable is
not updated by observations because either 1) observation gaps exist in space or time
2)the state is outside the spatial localization distance, or 3) variable localization
was applied through the ``obs_impact_tool``, --the inflation update for that part of the
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

inflation damping happens whether inflation was updated with observations or not. I am not a fan of the word 'revert', I'll edit the text.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

inflation damping happens whether inflation was updated with observations or not. I am not a fan of the word 'revert', I'll edit the text.

Definitely check for this mistake elsewhere, because this was a misunderstanding on my part.

Copy link
Contributor Author

@mgharamti mgharamti Jan 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm on it. I realize that I needed to provide more clarity so I added a note detailing the order of inflation operations in DART. Will push shortly

Copy link
Contributor

@braczka braczka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good -- see my suggestion on order of operations.

Comment on lines 234 to 241
.. note::
Order of (prior) inflation operations within DART:

- Inflation is read from file or namelist
- Inflation damping is applied: :math:`\sqrt{\lambda} \leftarrow 1 + \rho(\sqrt{\lambda} - 1),` where :math:`\rho` is the damping factor
- Damped Inflation is applied to the prior ensemble
- Inflation is updated with observations
- Updated inflation values are written out
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really like this order of operations. It emphasizes that the inflation damping and inflation estimation with observations are performed in series. Could you maybe number the steps, because I think this would emphasize that the updated inflation values from step 5 (updated inflation is written out), are copied back into step 1 (Read in inflation from restart file). Also instead of just saying Inflation is updated with observations in step 4, it would really help if it was stated Inflation is updated with observations using inf_flavor algorithm, or using equation 1 which is defined at the beginning of the section. Something that really distinguishes between the damping update versus the observation update.

Further clarification around inflation damping. Added text
detailing the order of operations for inflation.
Comment on lines 301 to 306
Inflation is only applied to the variables that are **updated** by DART
by specifying ``UPDATE`` within the ``&model_nml`` section of ``input.nml``.
Alternatively, if the variables are not updated (``NO_COPY_BACK``) then inflation
will not impact them. ``NO_COPY_BACK`` variables are often used to compute the forward
operators, however, they don't take part in the update and as such
they will not be inflated.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mgharamti @braczka
A question on this 'important' section.

NO_COPY_BACK does not prevent the variables being inflated, a user has to set the initial inflation file to have inflation values of 1.0 to have have no inflation #276
Do you have code elsewhere that queries no_copy_back before applying inflation?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Helen, I thought this feature has already been implemented after the science discussions we had. Perhaps, this is something I'll work on in a separate PR (in the near future). We will need to query the variables before applying inflation.

For the sake of this documentation PR, I'll edit the text for the NO_COPY_BACK section and push.

Copy link
Member

@hkershaw-brown hkershaw-brown left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see NO_COPY_BACK cmoment

guide/inflation.rst Outdated Show resolved Hide resolved
@hkershaw-brown hkershaw-brown added the release! bundle with next release label Jan 31, 2025
@hkershaw-brown hkershaw-brown merged commit b4558ea into NCAR:main Feb 3, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release! bundle with next release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants