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

Implement "equilibrium state" test for SA part of calibration process. #666

Open
tobeycarman opened this issue Jan 24, 2024 · 9 comments
Open
Labels
calibration Anything related to fixing, changing improving the workflow and tools for calibration enhancement

Comments

@tobeycarman
Copy link
Member

Need to expand upon the concept that is drafted in "mads_calibration/equlibrium_check.py".

@tobeycarman tobeycarman added enhancement AC-REFAC Feedback for the ac-refac branch, pre-merge. labels Jan 24, 2024
@tobeycarman
Copy link
Member Author

Thinking that this might get built as part of drivers/Sensitivity.py such that the "collate results" function will run the various equilibrium state checks (stability, slope, etc) and output a file equilibrium_state.csv in each sample directory. Each column of the csv file may have a boolean value for whether each of the respective tests pass. Then this csv file can be read at a later date to assess whether the sample run reached equlibrium via various metrics.

@tobeycarman
Copy link
Member Author

So far checks we have thought of are:

  • slope of a linear regression over N years
  • "stability" which is the coefficient of variation over N years
  • long term stability where you look at a long time series and see if there are periods of equilibrium separated by distinct steps from one equilibrium state to another

@tobeycarman
Copy link
Member Author

Propose that the "equlibrium check" logic is added to the util/metrics.py module.

@Elchin
Copy link
Collaborator

Elchin commented Jan 26, 2024

In general, it would be nice to build the equilibrium check into the C++ code of the dvm-dos-them. This will eliminate the extra steps that need to be taken to make sure that the model is equilibrated. In addition, this could help with the overall model -eq case when the model will check and decide when the equilibrium run needs to be terminated without the user specifying the number of years because some cases might take longer or shorter to equilibrate. When we provide a hard number, usually 2000 years, if the model is not at equilibrium, then it will continue to lose carbon during the -tr and -sc stages, which would make it harder to match observations.

@tobeycarman
Copy link
Member Author

@Elchin yeah, we would like to put this in the C++ code but decided that we should implement in Python first as a "post hoc" check because it will be faster for development and will allow us to experiment with different methods of testing for equilibrium state.

@tobeycarman tobeycarman added calibration Anything related to fixing, changing improving the workflow and tools for calibration and removed AC-REFAC Feedback for the ac-refac branch, pre-merge. labels Jan 26, 2024
@valeriabriones
Copy link
Collaborator

@tobeycarman not sure if this structurally makes sense, but in thinking about the workflow post SA, right now the equilibrium check is for all samples run from SA, but am curious if there's another way to have it work from the SA_post_hoc_analysis.n_top_runs(), which selects the samples which meet these criteria based on r2lim and have an equilibrium check work from these top samples as a way to complement or supplement the SA results? Just a thought! Have been trying to work through it but its messy

@tobeycarman
Copy link
Member Author

tobeycarman commented Feb 5, 2024 via email

@hgenet
Copy link
Collaborator

hgenet commented Feb 5, 2024 via email

@tobeycarman
Copy link
Member Author

@valeriabriones, @Benjamin-Maglio, @jsclein-uaf, just pushed changes (commit: ffd82c0) implementing a draft roughly as discussed above. Details in the commit message.🤞 that it might run for you. Note that I did not push anything that actually "checks" the equilibrium - the code I pushed makes various "measurements" and summarizes the data. The "check" still needs to be written...i.e. "only use samples with slope < .1" or "only use samples with cv<.5".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
calibration Anything related to fixing, changing improving the workflow and tools for calibration enhancement
Projects
None yet
Development

No branches or pull requests

4 participants