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

Create a new example that will run full ADF package (not from notebook) #141

Merged
merged 21 commits into from
Nov 20, 2024

Conversation

mnlevy1981
Copy link
Collaborator

@mnlevy1981 mnlevy1981 commented Oct 10, 2024

This example can be generalized to other outside diagnostic packages as well (e.g. ILAMB). The goal is to have the JupyterBook-generated web site link to the ADF website from the side bar.

All Submissions:

  • Have you followed the guidelines in our Contributor's Guide (including the pre-commit check)?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change? Other pull requests that create the same changes do not exist; however, this is dependent upon generate ADF config file #142

New Feature Submissions:

  1. Does your submission pass tests?
  2. Have you lint your code locally prior to submission?

Changes to Core Features:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you successfully tested your changes locally?

@TeaganKing TeaganKing mentioned this pull request Nov 4, 2024
4 tasks
mnlevy1981 and others added 6 commits November 8, 2024 13:35
hide input and output for imports, and input for cell that will eventually have
plots as output
Notebook was linking to adf_root before updating the value from config.yml;
config.yml should set the default to where we expect ADF to write webpage
(which is in the same directory tree that CUPiD writes webpage)
@TeaganKing
Copy link
Collaborator

TeaganKing commented Nov 8, 2024

The last thing we have to do here is to add a flag if ADF exists in build.py (Done week of 11/11)

cupid/build.py Outdated
@@ -45,6 +46,14 @@ def build(config_path):
subprocess.run(
["jupyter-book", "build", f"{run_dir}/computed_notebooks/{sname}", "--all"],
)
adf_run = control["compute_notebooks"]["atm"]["link_to_ADF"]["parameter_groups"][
"none"
]["adf_run"]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could generalize for all components. Also use .get() to set default run_external_pkg value.

@TeaganKing
Copy link
Collaborator

TeaganKing commented Nov 12, 2024

We should also add documentation on how to run ADF until #105 is resolved (Done 11/13)

TeaganKing and others added 4 commits November 13, 2024 10:51
instead of

adf_run: True
adf_vars: ['...', '...']

Introduced

external_tool:
  tool_name: 'ADF'
  vars: ['...', '...']

I also moved this out of parameter_group since it's not needed by the
link_to_ADF.ipynb notebook (and added plotting_scripts: ['...', '...'] as an
extra option to set in config.yml)
adf_run: True
adf_vars: ['PRECT', 'SST']
external_tool:
tool_name: 'ADF'
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is great! One thought-- if we eventually want to loop through multiple tools, should the ADF-specific parameters be a subset of the ADF tool?

@TeaganKing
Copy link
Collaborator

We may want to remove the dependency on CESM (rather than just CUPiD and ADF)-- see note in #142.

ADF will write output to ${CUPiD}/examples/{example}/ADF_output; if
external_tool == "ADF" then that directory will be copied into _build/html/ADF
@mnlevy1981
Copy link
Collaborator Author

This runs for me with

$ cd ${CESM_ROOT}/tools/CUPiD/helper_scripts
$ ./generate_adf_config_file.py --cesm-root ${CESM_ROOT} --cupid-example external_diag_packages --adf-template ../externals/ADF/config_amwg_default_plots.yaml --out-file adf_config.yml
$ conda activate cupid-analysis
$ ../externals/ADF/run_adf_diag adf_config.yml # TOOK 75 seconds
$ cd ../examples/external_diag_packages/
$ conda activate cupid-dev
$ cupid-run
$ cupid-build

(assumes cupid-dev was points to ${CESM_ROOT}/tools/CUPiD/cupid`)

@mnlevy1981 mnlevy1981 marked this pull request as ready for review November 20, 2024 00:13
Copy link
Collaborator

@TeaganKing TeaganKing left a comment

Choose a reason for hiding this comment

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

This looks great and runs properly! Here's a screenshot of the output with the link to ADF working smoothly.
Screen Shot 2024-11-19 at 10 10 33 PM
Screen Shot 2024-11-19 at 10 08 25 PM

@TeaganKing TeaganKing merged commit 33e9705 into NCAR:main Nov 20, 2024
2 checks passed
@mnlevy1981 mnlevy1981 mentioned this pull request Nov 21, 2024
5 tasks
@mnlevy1981 mnlevy1981 deleted the link_ADF_webpage branch November 22, 2024 21:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants