-
Notifications
You must be signed in to change notification settings - Fork 26
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
Include ILAMB output in notebook and provide link to full diagnostic package #165
base: main
Are you sure you want to change the base?
Conversation
Note the linked issue also requires workflow updates to include ILAMB and choose BGC or SP. |
|
Made some changes per discussion in CUPiD meeting today.
Still need to do the following:
|
For display(
HTML(
'<iframe src="/path/to/table.html"></iframe>'
)
) But I agree that it's not very useful for the single run case. If the above code works, maybe we could include it in an
|
(my first version of the above comment relied on javascript, but I think the HTML |
Removing |
I'm still getting a VarNotInModel error from ILAMB-- also with the old configurations from the previous ILAMB example. Otherwise this full workflow is working. |
This worked with a different dataset: When model_setup.txt used this filepath: The exact same setup did not work with clean directories and |
"# Model Name , Location of Files , Shift From, Shift To\n", # noqa: E501 | ||
) | ||
ms.write( | ||
f"CTSM51 , {base_case_output_dir}/lnd/hist/regrid/", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I should add some sort of "if regrid" then append the regrid directory here. Perhaps this would be useful to in the long term create the regridded files if they don't yet exist, and in the short term print out a "warning: please run regridding with command below"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a note that regridded files are required
We actually want to remap with this command to avoid steradian units and instead get km^2 for area: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't try to run this, but read through the diffs and have a few comments. Overall, this looks really good and I'm excited about adding ILAMB to external_diag_packages
!
Should we address #160 in this PR, since we'll have the same problem with ILAMB and users only running CUPiD on non-land components? Seeing your change to cupid/cupid_webpage.py
brought that issue to mind, but I'd be happy to wait for a later PR to try to fix it.
This is running smoothly now. I added a note to remove the ILAMB_output directory if it exists, as that potentially causes errors. After talking with Keith, we also decided that using a BGC/SP flag specified by users is better than relying on an assumption that f cases are usually SP and b cases are usually BGC. If an SP case is run with a BGC flag, we may just have some additional variables that don't produce graphs, etc. This is now ready for review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had one comment about cleaning up some of the code in cupid_webpage.py
, but I also have a general question about the functionality of the new generate_ilamb_config_files.py
.
I was trying to see how this would fit in with the CESM workflow, so I went into a test case directory and used generate_cupid_config_for_cesm_case.py
to create config.yml
. Then I used the new script to generate the config files for ILAMB:
$ ../../../tools/CUPiD/helper_scripts/generate_ilamb_config_files.py --cesm-root /glade/work/mlevy/codes/CESM/cesm3_0_beta04_cupid --cupid-config-loc ${PWD} --run-type SP
{'cesm_root': '/glade/work/mlevy/codes/CESM/cesm3_0_beta04_cupid', 'cupid_config_loc': '/glade/work/mlevy/codes/CESM/cesm3_0_beta04_cupid/cases/test_cupid_30b04.005/cupid', 'run_type': 'SP'}
wrote /glade/work/mlevy/codes/CESM/cesm3_0_beta04_cupid/tools/CUPiD/ilamb_aux/ilamb_nohoff_final_CLM_SP.cfg
wrote /glade/work/mlevy/codes/CESM/cesm3_0_beta04_cupid/cases/test_cupid_30b04.005/cupid/model_setup.txt
WARNING: ILAMB requires regridded output to be in /glade/derecho/scratch/mlevy/archive/b.e23_alpha17f.BLT1850.ne30_t232.092/lnd/hist/regrid/ directory.
You can now run ILAMB with the following commands:
(Users on a super computer should make sure they are on a compute node rather than a login node)
---------
conda activate cupid-analysis
export ILAMB_ROOT=../ilamb_aux
ilamb-run --config /glade/work/mlevy/codes/CESM/cesm3_0_beta04_cupid/tools/CUPiD/ilamb_aux/ilamb_nohoff_final_CLM_SP.cfg --build_dir /glade/work/mlevy/codes/CESM/cesm3_0_beta04_cupid/cases/test_cupid_30b04.005/cupid/ILAMB_output/ --df_errs /glade/work/mlevy/codes/CESM/cesm3_0_beta04_cupid/tools/CUPiD/ilamb_aux/quantiles_Whittaker_cmip5v6.parquet --define_regions /glade/work/mlevy/codes/CESM/cesm3_0_beta04_cupid/tools/CUPiD/ilamb_aux/DATA/regions/LandRegions.nc /glade/work/mlevy/codes/CESM/cesm3_0_beta04_cupid/tools/CUPiD/ilamb_aux/DATA/regions/Whittaker.nc --regions global --model_setup /glade/work/mlevy/codes/CESM/cesm3_0_beta04_cupid/cases/test_cupid_30b04.005/cupid/model_setup.txt --filter .clm2.h0.
---------
The first thing that caught my eye is the location of the output files:
wrote /glade/work/mlevy/codes/CESM/cesm3_0_beta04_cupid/tools/CUPiD/ilamb_aux/ilamb_nohoff_final_CLM_SP.cfg
wrote /glade/work/mlevy/codes/CESM/cesm3_0_beta04_cupid/cases/test_cupid_30b04.005/cupid/model_setup.txt
model_setup.txt
showed up in the directory where I ran the generate script, which is good. Shouldn't ilamb_nohoff_final_CLM_SP.cfg
also be written locally? We may need to also copy the quantiles file locally, then we can change the recommendation from export ILAMB_ROOT=../ilamb_aux
to set the current working directory to ILAMB_ROOT
.
-print("export ILAMB_ROOT=../ilamb_aux")
+print(f"export ILAMB_ROOT={os.getcwd()}")
(which was actually the second thing I noticed -- as the script is written, we want print(f"export ILAMB_ROOT=os.path.join(cesm_root,'tools','CUPiD','ilamb_aux')")
).
I think some of these suggestions for getting better output in the CESM workflow may break things for the CUPiD examples; it'll probably take a little back-and-forth to figure out how we want things to work in both use-cases.
Hi @mnlevy1981 , Thanks for reviewing this-- I have addressed your comments! RE "Shouldn't ilamb_nohoff_final_CLM_SP.cfg also be written locally?": I did update this per your suggestion. For context, my original thought was that these won't actually change with every configuration for running CUPiD; there's really just a general specification of ilamb_config_data_loc that gets added, and that's the only change, so I figured it could be used from the same place for any ILAMB runs using the same CESM root. That said, it's not a large file, so I think that it may be clearer to write it locally and keep everything together anyways. |
Description of changes:
model_setup.txt
file based onconfig.yml
link to ILAMB
notebook which includes a link to ILAMB full output as well as a few 'key metric' plots from ILAMB directly in the jupyterbookglade
paths) in a parallel location to ADF config file templates.pre-commit
checks passed (#8 in Adding Notebooks Guide)?