Skip to content

Conversation

@AritraDey-Dev
Copy link
Member

Description

Added a Quarto notebook tutorial for PEcAn uncertainty analysis (uncertainty.qmd) that demonstrates ensemble and sensitivity analysis workflows. The tutorial includes:

  • Complete workflow from loading settings to running ensemble/sensitivity analyses
  • Parameter customization sections for ensemble size, sampling methods, and sensitivity quantiles
  • Comprehensive output interpretation guide explaining variance decomposition and parameter prioritization
  • Model result visualization with run ID identification
  • Session information for reproducibility

Motivation and Context

This change introduces Demo2 for the Quarto notebook focused on uncertainty analysis. It serves as a continuation and enhancement of the work initiated in Demo1. The goal is to extend the functionality and provide a more comprehensive demonstration of uncertainty analysis within the PEcAn framework.

Review Time Estimate

  • Immediately
  • Within one week
  • When possible

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 change)

Checklist:

  • My change requires a change to the documentation.
  • My name is in the list of CITATION.cff
  • I agree that PEcAn Project may distribute my contribution under any or all of
    • the same license as the existing code,
    • and/or the BSD 3-clause license.
  • I have updated the CHANGELOG.md.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@AritraDey-Dev AritraDey-Dev changed the title Quarto ensemble sensivity Quarto notebook tutorial for PEcAn uncertainty analysis Jul 13, 2025
@AritraDey-Dev AritraDey-Dev force-pushed the quarto-ensemble-sensivity branch from 7033438 to 122ef77 Compare July 15, 2025 11:45
Copy link
Member

@dlebauer dlebauer left a comment

Choose a reason for hiding this comment

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

Thank you for this PR, it is off to a great start and it is clear that you have a good understanding of how these analyses work.

I've started reviewing the notebook and have a few suggestions for how and what information is presented - I think it will be most effective if I flesh out some of the more technical details, and determine what information can be provided as cross references to publications vs what should be explained here.

But I'd also like to request some changes from the workflow side. Many of these are changes to Demo 1 that I suggested (AritraDey-Dev#6), and I think these should be reflected in this repository.

Some specific changes that come to mind:

  • eliminate hard coded paths like /pecan and /data
  • use R's file.copy() function in place of system('cp ...)
  • don't assume user will be running in Docker with local binaries and absolute paths pre-installed
  • the only difference between the pecan.xml files should be related to uncertainty / ensemble / sensitivity analysis. File paths and other settings should be the same. This helps clarify and identify the meaningful changes that are necessary.
  • Make directory naming consistent - not clear why there is 01_Demo_basic_run, 02_Demo_Uncertainty_Analysis, and Demo_02_Uncertainty_Analysis.

These changes should help keep the tutorial easier to understand and maintain. Let me know if you’d like help implementing them—happy to pair on a walkthrough or review the follow-up PR. Thanks!

@AritraDey-Dev
Copy link
Member Author

Yes, once the Demo 1 PR gets merged, I’ll add the changes you mentioned above here.

@AritraDey-Dev AritraDey-Dev force-pushed the quarto-ensemble-sensivity branch from 12f7e60 to b9cb3bf Compare August 26, 2025 13:58
@AritraDey-Dev
Copy link
Member Author

@dlebauer I have incorporated the changes from demo1, based on your feedback here.This PR is now ready for review. Could you please take a look.

@AritraDey-Dev AritraDey-Dev requested a review from dlebauer August 26, 2025 20:29
@dlebauer dlebauer changed the title Quarto notebook tutorial for PEcAn uncertainty analysis Demo 2 Quarto notebook tutorial for PEcAn uncertainty analysis Aug 27, 2025
@dlebauer
Copy link
Member

dlebauer commented Sep 1, 2025

Great work getting Demo 1 in #3531 merged 🎉 — that’s a big milestone!

Now that that one is merged, there is still a fair bit of cleanup to do here, and it will require updating Demo 1 as well. It’s all very doable, and I think the payoff will be a much more polished and user-friendly Demo 2.

Here are some steps:

  • Merge branches and resolve conflicts. This branch is out of sync with the develop branch (which includes Demo 1. Some conflicts are trivial - e.g., Changelog, News) and should be straightforward to resolve. Some like standard_vars.csv and download_sipnet.R may not be as simple. I think you want standard_vars from the develop branch and download_sipnet from this branch.
  • Remove / consolidate Background material:
    • All explanation of setup that is generic to PEcAn (PEcAn intro, scenario description, installing PEcAn + SIPNET, etc.) belongs in Demo 1.
    • We should assume users have completed Demo 1 already, and reference Demo 1 for more details.
    • Demo 2 can still include code snippets to ensure standalone execution, but the narrative should “jump right in,” mirroring the flow of the web-based Demo 2.
  • Make sure that Pedagogical content from Web Demo 2 is included
    • Right now, a lot of the educational/explanatory scaffolding is missing. We’ll need to bring over:
      • Normal quantile explanation for sensitivity (pnorm(-2:2))
      • File/output map (what’s in /run, /out, /pft, etc.)
      • Plot interpretation guide (sensitivity curves, variance decomposition)
      • Reflective exercises on prioritizing constraints
      • Links to support/docs
    • These can be integrated as callouts, subsections, or short exercises so the Quarto tutorial keeps its runnable focus but doesn’t lose the teaching value.
  • use plot_sensitivities and plot_variance_decomposition functions to show the results.

This is very close! While this is still a bit of work, it’s mostly structural and editorial / pedagogical. Once you have successfully merged the branches, consolidated the background, and made sure that all information from the original Demo 2 is in the new version, I can take a final pass at the writing.

@AritraDey-Dev AritraDey-Dev force-pushed the quarto-ensemble-sensivity branch 2 times, most recently from 8d965d1 to cfface8 Compare September 30, 2025 17:23
legend("topright", legend = c("LAI", "Above Ground Wood"), col = c("darkgreen", "brown"), lty = 1)
```

# 18. PEcAn Outputs
Copy link
Member Author

Choose a reason for hiding this comment

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

This part is almost same as section 9 which tells about pecan outputs,also in this part as it mentions trait and meta analysis which we are not doing in this notebook,so can we remove this part @dlebauer ?

Copy link
Member

Choose a reason for hiding this comment

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

I will remove this part and push the changes.

I've created #3661 to track future re-implementation of a meta-analysis tutorial.

Copy link
Member

Choose a reason for hiding this comment

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

And have implemented the requested revisions in AritraDey-Dev#10

@mdietze
Copy link
Member

mdietze commented Nov 3, 2025

@AritraDey-Dev @dlebauer anything left to do or is this ready to merge?

@AritraDey-Dev
Copy link
Member Author

Most of the core work for this PR is done; just waiting for @dlebauer’s review to get it merged.

….qmd demo

- Enable auto-numbered and cross-referenced sections
Copy link
Member

@dlebauer dlebauer left a comment

Choose a reason for hiding this comment

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

I've consolidated sections 9&18, move some content to Demo 1, and automated section numbering 🤞🏻.

Please review AritraDey-Dev#10 and make or request any additional changes. Once that is complete, this should be ready to merge!


Editing the more interesting settings to change the PFT (`settings$pfts`) or extend the run (`settings$run$end.date`) is an optional exercise for the user. For example, you could change the pft or the end date, but this requires additional parameter files and meteorological inputs. This includes files containing parameters for that PFT (`settings$pfts$pft$posterior.files`), or a climate file (`settings$run$met$path$path1`) that extends to the desired simulation period.

# 7. Create Output Directory
Copy link
Member

Choose a reason for hiding this comment

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

@AritraDey-Dev I think that this is automated by the prepare.settings() function, so the section can be removed. Please confirm.

Copy link
Member Author

Choose a reason for hiding this comment

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

yes indeed this is not needed.

legend("topright", legend = c("LAI", "Above Ground Wood"), col = c("darkgreen", "brown"), lty = 1)
```

# 18. PEcAn Outputs
Copy link
Member

Choose a reason for hiding this comment

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

I will remove this part and push the changes.

I've created #3661 to track future re-implementation of a meta-analysis tutorial.

legend("topright", legend = c("LAI", "Above Ground Wood"), col = c("darkgreen", "brown"), lty = 1)
```

# 18. PEcAn Outputs
Copy link
Member

Choose a reason for hiding this comment

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

And have implemented the requested revisions in AritraDey-Dev#10


1. Disabling database write operations because we are not using a database
```{r disable-db-write}
settings$database <- NULL # Disable database operations for this demo
Copy link
Member

Choose a reason for hiding this comment

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

As we discussed for demo 1, I don't see why this is needed -- setting a list entry to NULL is the same as removing it, so why not just delete it from the XML in the first place?) -- and I'm really quite sure the user should not need to do it. If deleting this line makes the demo work wrong, please file an issue with a reprex so that we can fix whatever makes this distracting hack necessary.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, for now deleting this line will not make the demo work. I agree that this line is unrelated to the demo. This is probably an issue with the PEcAn DB package.

├── run/ # Configuration & execution metadata
│ ├── runs.txt # List of run IDs (one per model realization)
│ ├── <runid>/ # Model-specific config copies (sometimes)
│ └── config.* # Generated model configs (e.g., SIPNET)
Copy link
Member

@infotroph infotroph Nov 11, 2025

Choose a reason for hiding this comment

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

I have never seen config.* in the rundir! What module generates them?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes,A lot of refactoring need to be done in this part.i will fix this.

Comment on lines 182 to 190
├── sensitivity.analysis/ # Sensitivity raw outputs &amp; figures
│ ├── sensitivity.output.*.Rdata
│ └── sensitivity.analysis.*.pdf
├── ensemble.analysis/ # Ensemble summaries &amp; figures
│ ├── ensemble.Rdata
│ ├── ensemble.analysis.*.pdf
│ └── ensemble.ts.*.pdf
├── variance.decomposition/ # Created when variance decomposition runs
│ └── variance.decomposition.*.pdf
Copy link
Member

Choose a reason for hiding this comment

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

I'm used to seeing all of these saved directly in outdir without their own subdirectories -- what process creates these?

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed in 97c15b9

Copy link
Member

@dlebauer dlebauer left a comment

Choose a reason for hiding this comment

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

Looks great, thanks for your persistence addressing all of the feedback!

@dlebauer dlebauer added this pull request to the merge queue Nov 25, 2025
Merged via the queue into PecanProject:develop with commit 579b9d9 Nov 25, 2025
19 of 26 checks passed
@AritraDey-Dev AritraDey-Dev deleted the quarto-ensemble-sensivity branch November 25, 2025 07:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants