Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added images/challenge/FATES_complexity_modes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/challenge/FATES_schematic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/challenge/clm_fates_lh_diff.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/challenge/clm_sp_bgc_diff.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/challenge/clm_sp_plot_monthly_gpp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/challenge/fates_bart_canopy_structure.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/challenge/fates_bart_gpp_lai.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/challenge/fates_bart_growth_mortality.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/challenge/fates_bart_layered_LAI_bg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/challenge/fates_bart_layered_LAI_init.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/challenge/fates_bart_mortality.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/challenge/fates_bart_mortality_by_size.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/challenge/fates_bart_patch_age.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/challenge/fates_bart_stand_structure.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/challenge/fates_clm_gpp_diff.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/challenge/fates_monthly_gpp_pft.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/challenge/fates_plot_monthly_gpp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/challenge/fates_vcmax_diff.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/challenge/fates_vcmax_lh_diff.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
70 changes: 40 additions & 30 deletions notebooks/challenge/clm_ctsm/clm_ctsm.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"\n",
"It can be useful for people interested in land science to run simulations with only an active land components and atmospheric forcing. In this exercise, you will learn how to run one of these land-only simulations.\n",
"\n",
"This exercise was created by Peter Lawrence, Erik Kluzek and Alice DuVivier."
"These exercises were created by Adrianna Foster and Erik Kluzek."
]
},
{
Expand All @@ -27,9 +27,10 @@
"id": "346cbd7b-3b8e-41f0-b120-b369ab20f6cc",
"metadata": {},
"source": [
"- Student will learn what a I compset is, the types of forcing available to run one, and how to run one.\n",
"- Student will learn how to run a case with satellite phenology and one with prognostic crops and compare the two experiments.\n",
"- Learn what inputs CLM needs and what they look like.\n"
"- Students will learn what an \"I\" compset is, the types of forcing available to run one, and how to run one.\n",
"- Students will learn how to run a default CLM (\"big leaf\") case with satellite phenology and one with prognostic BGC and crops and compare the two experiments.\n",
"- Students will learn how to run FATES and compare to big leaf CLM output.\n",
"- Students will learn how to modify an input parameter file and investigate its effect on output."
]
},
{
Expand All @@ -46,18 +47,18 @@
"metadata": {},
"source": [
"- This exercise uses the same code base as the rest of the tutorial. \n",
"- You will be using the I2000Clm50Sp and IHistClm50BgcCrop compsets at the f09_g17_gl4 resolution.\n",
"- You will run a control simulation and two experimental simulations. \n",
"- You will modify netcdf input files. \n",
"- You will use simple, command line netcdf tools to evaluate how the experiments differ from the control simulation."
"- You will be using the I2000Clm60Sp, IHistClm60BgcCrop, and I2000Clm60FatesSpCrujraRsGs compsets at the f19_f19_mt233 resolution.\n",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I think we should add a note that the forcing changes between these three.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
"- You will be using the I2000Clm60Sp, IHistClm60BgcCrop, and I2000Clm60FatesSpCrujraRsGs compsets at the f19_f19_mt233 resolution.\n",
"- You will be using the I2000Clm60Sp, IHistClm60BgcCrop, and I2000Clm60FatesSpCrujraRsGs compsets at the f19_f19_mt233 resolution.\n",
"- The first two use GSWP3 atmospheric forcing and the last uses CRUJRA-2024 forcing.\n",

"- You will run a CLM SP simulation, a CLM BGC simulation, and two FATES SP simulations.\n",
"- You will modify a json input file.\n",
"- You will use the `xarray` and `matplotlib` libraries to evaluate how the simulations differ."
]
},
{
"cell_type": "markdown",
"id": "fd2ff959-6ec0-4534-8713-f5dfdb13b955",
"metadata": {},
"source": [
"## Useful CLM references"
"## Useful CLM and FATES references"
]
},
{
Expand All @@ -67,7 +68,7 @@
"source": [
"<div class=\"alert alert-info\" style=\"text-align: center;\">\n",
"\n",
"[CESM CLM/CTSM User's Guide](https://escomp.github.io/ctsm-docs/versions/master/html/users_guide/index.html)\n",
"[CESM CLM/CTSM User's Guide](https://escomp.github.io/CTSM/users_guide/index.html)\n",
"\n",
"</div>"
]
Expand All @@ -86,6 +87,18 @@
"</div>"
]
},
{
"cell_type": "markdown",
"id": "e9024cab-f818-4d8a-99bb-720a69bc19ce",
"metadata": {},
"source": [
"<div class=\"alert alert-info\" style=\"text-align: center;\">\n",
"\n",
"[FATES Users Guide](https://fates-users-guide.readthedocs.io/en/latest/)\n",
"\n",
"</div>"
]
},
{
"cell_type": "markdown",
"id": "cb8a0e10-a920-41dd-8bc4-5c03395d231e",
Expand All @@ -99,11 +112,12 @@
"id": "69988cae-fd26-4fda-8fee-6ab52e79f42d",
"metadata": {},
"source": [
"The I compset has active clm with a data atmosphere. The sea ice, ocean, atmosphere, and wave models are not active. There are two types of options for I compsets:\n",
"- SP: Satellite Phenology\n",
"- BGC: Biogeochemistry \n",
"\"I\" compsets have active CLM with a data atmosphere (DATM). The sea ice, ocean, atmosphere, and wave models are not active. There are three types of options for I compsets:\n",
"- SP: Satellite Phenology (with CLM big leaf)\n",
"- BGC: Biogeochemistry (with CLM big leaf)\n",
"- FATES: The FATES cohort vegetation model instead of big leaf, either SP or BGC\n",
"\n",
"We will use the Satellite Phenology option for our control case."
"We will use the Satellite Phenology option for our first simulation."

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I was thinking "control case" is good to use, because then it's the one that the others are compared to. What is the thinking about this change?

]
},
{
Expand All @@ -113,7 +127,7 @@
"source": [
"![icase](../../../images/challenge/i2000.png)\n",
"\n",
"*<p style=\"text-align: center;\"> Figure: I2000 compset definition. </p>*"
"*<p style=\"text-align: left;\"> Figure: I2000 compset definition. </p>*"
]
},
{
Expand All @@ -135,32 +149,28 @@
"source": [
"## Post processing and viewing your output\n",
"\n",
"You will use [ncview](https://ncar.github.io/CESM-Tutorial/notebooks/tools/netcdf_tools.html#ncview) and [NCO operator](https://ncar.github.io/CESM-Tutorial/notebooks/tools/netcdf_tools.html#netcdf-operators-nco) tools to evaluate how the experiments differ from the control simulation.\n",
"\n",
"These tools will need to be loaded into your environment using the NCAR HPC [modules](https://ncar.github.io/CESM-Tutorial/notebooks/tools/unix/modules.html)."
"You will use python and the `xarray` and `matplotlib` libraries to evaluate how the experiments differ."
]
},
{
"cell_type": "markdown",
"id": "828e538d-3558-4747-9b61-3b29da04e294",
"metadata": {},
"source": [
"1) You can create an annual average of the first year's data for each simulationg using the `ncra` (netCDF averager) command from the netCDF operators package \\([NCO](https://nco.sourceforge.net/)\\). \n",
"1) You can read in multiple history files using the [xarray](https://docs.xarray.dev/en/stable/) command:\n",
"```\n",
"ncra $OUTPUT_DIR/*.clm.*nc $CASENAME.cln.h.0001.nc\n",
"ds = open_mfdataset(files)\n",
"```\n",
"\n",
"2) Create a file that contains differences between each of the experiments and the control simulation\n",
"2) Look at differences between the same variable on two different xarray datasets:\n",
"```\n",
"ncdiff i.day5.b.clm2.XXX.nc /glade/derecho/scratch/$user/archive/i.day5.a/lnd/hist/i.day5.a.clm2.XXX.nc i_diff.nc\n",
"gpp_diff = ds_1.GPP - ds_2.GPP\n",
"```\n",
"\n",
"3) Examine variables within each annual mean and the difference files using `ncview`\n",
"```\n",
"ncview i_diff.nc\n",
"3) Examine variables using the `.plot()` function\n",
"```\n",
"\n",
"4) You can also look at other monthly-mean outputs or component log files."
"ds.GPP.plot()\n",
"```"
]
},
{
Expand All @@ -174,9 +184,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "CMIP6 2019.10",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "cmip6-201910"
"name": "python3"
},
"language_info": {
"codemirror_mode": {
Expand All @@ -188,7 +198,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.10"
"version": "3.10.13"
}
},
"nbformat": 4,
Expand Down
141 changes: 113 additions & 28 deletions notebooks/challenge/clm_ctsm/clm_exercise_1.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
"id": "f406f992-92bd-4b17-9bd3-b99c5c8abaf3",
"metadata": {},
"source": [
"# 1: Control case"
"# 1: CLM SP\n",
"\n",
"We will first run CLM in satellite phenology (SP) mode. In SP mode, CLM prescribes vegetation state (i.e., leaf area, height, and stem area) from satellite observations rather than growing it. The model only computes the biophysical exchange of energy, water, and carbon over that fixed canopy, which makes SP runs cheap and a good baseline when you want realistic surface fluxes without a prognostic carbon cycle."
]
},
{
Expand All @@ -14,45 +16,105 @@
"metadata": {},
"source": [
"<div class=\"alert alert-info\">\n",
"<strong>Exercise: Run a control case</strong><br><br>\n",
"<strong>Exercise: Run a CLM SP case</strong><br><br>\n",
" \n",
"Create a case called **i.day5.a** using the compset `I2000Clm50Sp` at `f09_g17_gl4` resolution. \n",
"Create a case called **i.clm.sp.year1** using the compset `I2000Clm60Sp` at `f19_f19_mt233` resolution. \n",
" \n",
"Set the run length to **5 days**. \n",
"Set the run length to **1 year**.\n",
"\n",
"Build and run the model. Since this is a control case, we want to build it \"out of the box\" without any modifications. \n",
"Build and run the model.\n",
"\n",
"</div>\n"
]
},
{
"cell_type": "markdown",
"id": "f639e182-f48a-431c-a594-9c34323417eb",
"id": "656858f2-ff60-44cc-b9fb-a48cd4ed3506",
"metadata": {},
"source": [
"<div class=\"alert alert-warning\"> \n",
"<details>\n",
"\n",
"<summary> <font face=\"Times New Roman\">Click here for hints</font> </summary>\n",
"\n",
"<br>\n",
"\n",
"**How do I compile?**\n",
"\n",
"You can compile with the command:\n",
"```\n",
"qcmd -- ./case.build\n",
"```\n",
"\n",
"<br>\n",
"\n",
"**How do I change the run length to 1 year?**\n",
"\n",
"Use xml variables: ``STOP_OPTION`` and ``STOP_N``. \n",
"\n",
"<br>\n",
"\n",
"**How do I check my solution?**\n",
"\n",
"When your run is completed, go to the archive directory and navigate to the subdirectory `lnd/hist`\n",
"\n",
"```\n",
"cd /glade/derecho/scratch/$USER/archive/i.clm.sp.year1\n",
"cd lnd/hist\n",
"```\n",
"\n",
"Check that your archive directory contains the files:\n",
"\n",
"```\n",
"i.clm.sp.year1.clm2.h0a.2000-01.nc i.clm.sp.year1.clm2.h0i.2000-01.nc\n",
"i.clm.sp.year1.clm2.h0a.2000-02.nc i.clm.sp.year1.clm2.h0i.2000-02.nc\n",
"i.clm.sp.year1.clm2.h0a.2000-03.nc i.clm.sp.year1.clm2.h0i.2000-03.nc\n",
"i.clm.sp.year1.clm2.h0a.2000-04.nc i.clm.sp.year1.clm2.h0i.2000-04.nc\n",
"i.clm.sp.year1.clm2.h0a.2000-05.nc i.clm.sp.year1.clm2.h0i.2000-05.nc\n",
"i.clm.sp.year1.clm2.h0a.2000-06.nc i.clm.sp.year1.clm2.h0i.2000-06.nc\n",
"i.clm.sp.year1.clm2.h0a.2000-07.nc i.clm.sp.year1.clm2.h0i.2000-07.nc\n",
"i.clm.sp.year1.clm2.h0a.2000-08.nc i.clm.sp.year1.clm2.h0i.2000-08.nc\n",
"i.clm.sp.year1.clm2.h0a.2000-09.nc i.clm.sp.year1.clm2.h0i.2000-09.nc\n",
"i.clm.sp.year1.clm2.h0a.2000-10.nc i.clm.sp.year1.clm2.h0i.2000-10.nc\n",
"i.clm.sp.year1.clm2.h0a.2000-11.nc i.clm.sp.year1.clm2.h0i.2000-11.nc\n",
"i.clm.sp.year1.clm2.h0a.2000-12.nc i.clm.sp.year1.clm2.h0i.2000-12.nc\n",
"```\n",
"</details>\n",
"</div>"
]
},
{
"cell_type": "markdown",
"id": "f639e182-f48a-431c-a594-9c34323417eb",
"metadata": {},
"source": [
"<div class=\"alert alert-success\"> \n",
"<details>\n",
"<summary><font face=\"Times New Roman\" color='blue'>Click here for the solution</font></summary><br>\n",
" \n",
"Create a new case <font face=\"Courier\" color='purple'><strong>i.day5.a </strong></font> with the command:\n",
"<summary><font face=\"Times New Roman\">Click here for the solution</font></summary><br>\n",
"\n",
"**Create a new case**\n",
"\n",
"Create a new case <font face=\"Courier\" color='purple'><strong>i.clm.sp.year1 </strong></font> with the command:\n",
"```\n",
"cd /glade/u/home/$USER/code/my_cesm_code/cime/scripts\n",
"./create_newcase --case ~/cases/i.day5.a --compset I2000Clm50Sp --res f09_g17_gl4 --run-unsupported\n",
"./create_newcase --case ~/cases/i.clm.sp.year1 --compset I2000Clm60Sp --res f19_f19_mt233 --run-unsupported\n",
"```\n",
"<br>\n",
"\n",
"Case <font face=\"Courier\" color='purple'><strong>setup</strong></font>:\n",
"**Case setup**\n",
"\n",
"``` \n",
"cd ~/cases/i.day5.a \n",
"cd ~/cases/i.clm.sp.year1\n",
"./case.setup\n",
"```\n",
"\n",
"<br>\n",
"\n",
"Change the <font face=\"Courier\" color='purple'><strong>clm namelist</strong></font> using user_nl_clm by adding the following lines:\n",
"**Set run length**\n",
" \n",
"Change the `run length`:\n",
"``` \n",
"hist_nhtfrq = -24\n",
"hist_mfilt = 6\n",
"./xmlchange STOP_N=1,STOP_OPTION=nyears\n",
"```\n",
"<br>\n",
" \n",
Expand All @@ -62,48 +124,71 @@
"```\n",
"<br>\n",
"\n",
"If needed, change <font face=\"Courier\" color='purple'><strong>job queue</strong></font>, <font face=\"Courier\" color='purple'><strong>account number</strong></font>, or <font face=\"Courier\" color='purple'><strong>wallclock time</strong></font>. \n",
"For instance:\n",
"**Change the job queue and account number**\n",
"\n",
"If needed, change <font face=\"Courier\" color='purple'><strong>job queue</strong></font> and <font face=\"Courier\" color='purple'><strong>account number</strong></font>. \n",
"\n",
"For instance, to run in the queue `tutorial` and the project number `UESM0016`:\n",
"``` \n",
"./xmlchange JOB_QUEUE=tutorial,PROJECT=UESM0016 --force,JOB_WALLCLOCK_TIME=0:15:00\n",
"./xmlchange JOB_QUEUE=tutorial,PROJECT=UESM0016 --force\n",
"```\n",
"<br>\n",
"\n",
"Build and submit:\n",
"**Change the wallclock time**\n",
"\n",
"```\n",
"./xmlchange --subgroup case.run JOB_WALLCLOCK_TIME=01:00:00\n",
"```\n",
"<br>\n",
"\n",
"\n",
"**Build case**\n",
"```\n",
"qcmd -- ./case.build\n",
"```\n",
"<br>\n",
"\n",
"**Submit case**\n",
"```\n",
"./case.submit\n",
"```\n",
"<br>\n",
"\n",
"**Check the run:**\n",
"When the run is completed, look into the archive directory for: \n",
"<font face=\"Courier\" color='purple'><strong>i.day5.a</strong></font>. \n",
"<font face=\"Courier\" color='purple'><strong>i.clm.sp.year1</strong></font>. \n",
" \n",
"(1) Check that your archive directory on derecho (The path will be different on other machines): \n",
"```\n",
"cd /glade/derecho/scratch/$USER/archive/i.day5.a/lnd/hist\n",
"cd /glade/derecho/scratch/$USER/archive/i.clm.sp.year1/lnd/hist\n",
"\n",
"ls \n",
"```\n",
"<br>\n",
"\n",
"(2) Look at the output using ncview\n"
"<br>"
]
},
{
"cell_type": "markdown",
"id": "289c5251-a0bb-4a9d-9b40-d320953c621a",
"metadata": {},
"source": [
"We will investigate the output in a subsequent exercise."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "17cf7e19-1211-45f2-97cd-fe2badc69dac",
"id": "de84fb8e-aa52-4bf6-b7c7-583af74b1328",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "CMIP6 2019.10",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "cmip6-201910"
"name": "python3"
},
"language_info": {
"codemirror_mode": {
Expand All @@ -115,7 +200,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.10"
"version": "3.10.13"
}
},
"nbformat": 4,
Expand Down
Loading