Skip to content

Commit

Permalink
Merge pull request #206 from cecilehannay/main
Browse files Browse the repository at this point in the history
Challenge exercises: adding pages for paleo exercises
  • Loading branch information
cecilehannay authored Jul 2, 2024
2 parents 0883c16 + 4135c1f commit 63ef20e
Show file tree
Hide file tree
Showing 3 changed files with 321 additions and 0 deletions.
3 changes: 3 additions & 0 deletions _toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@ chapters:
- file: notebooks/challenge/cam/exercise_4
- file: notebooks/challenge/cam/exercise_5
- file: notebooks/challenge/cam/exercise_6
- file: notebooks/challenge/paleo/paleo
sections:
- file: notebooks/challenge/paleo/exercise_1
- file: notebooks/challenge/cam-chem_waccm/cam-chem_waccm
sections:
- file: notebooks/challenge/cam-chem_waccm/exercise_1
Expand Down
265 changes: 265 additions & 0 deletions notebooks/challenge/paleo/exercise_1.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,265 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "f406f992-92bd-4b17-9bd3-b99c5c8abaf3",
"metadata": {},
"source": [
"# 1: Paleo case\n",
"\n",
"I leave the following as a template."
]
},
{
"cell_type": "markdown",
"id": "b90d4773-7ca0-4131-ab07-517608a3e976",
"metadata": {},
"source": [
"\n",
"<div class=\"alert alert-info\">\n",
"<strong>Exercise: Customize your CAM history files</strong><br><br>\n",
" \n",
"Create, configure, build and run a case called ``f2000_control`` with the ``F2000climo`` compset (data ocean and climatological forcings from around year 2000). \n",
"\n",
"Run for 5 days, with 3-hourly instantaneous output of the variables: TS, PS, Z500, U850, U200, T850, T500, T200, CLDLOW, PRECT, LHFLX, SHFLX, FLNT, FLNS.\n",
"You are also welcome to output your own variables\n",
"\n",
"</div>\n"
]
},
{
"cell_type": "markdown",
"id": "65b2cbda-2d54-48ee-898b-4c391f16ca79",
"metadata": {},
"source": [
"\n",
"<div class=\"alert alert-warning\"> \n",
"<details>\n",
"\n",
"<summary> <font face=\"Times New Roman\" color='blue'>Click here for hints</font> </summary>\n",
"<br>\n",
"\n",
"**How do I output 3 hourly instantaneous variables?**\n",
"\n",
"- Use namelist variables: ``nhtfrq``, ``mfilt``, ``fincl``. \n",
"- For more information, look at the chapter: <br>\n",
"**NAMELIST MODIFICATIONS** -> **Customize CAM output**\n",
"\n",
"**What is the resolution for F2000climo?**\n",
"\n",
"- Use resolution: f09_f09_mg17\n",
"\n",
"\n",
"</details>\n",
"</div>\n"
]
},
{
"cell_type": "markdown",
"id": "7dd602b7-372d-4f36-b6d1-df8e22ba1646",
"metadata": {},
"source": [
"\n",
"<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",
" \n",
"**# Set environment variables** \n",
"\n",
"Set environment variables with the commands:\n",
" \n",
"**For tcsh users** \n",
" \n",
"```\n",
"set CASENAME=f2000_control\n",
"set CASEDIR=/glade/u/home/$USER/cases/$CASENAME\n",
"set RUNDIR=/glade/derecho/scratch/$USER/$CASENAME/run\n",
"set COMPSET=F2000climo\n",
"set RESOLUTION=f19_f19_mg17\n",
"```\n",
"**For bash users** \n",
" \n",
"```\n",
"export CASENAME=f2000_control\n",
"export CASEDIR=/glade/u/home/$USER/cases/$CASENAME\n",
"export RUNDIR=/glade/derecho/scratch/$USER/$CASENAME/run\n",
"export COMPSET=F2000climo\n",
"export RESOLUTION=f19_f19_mg17\n",
"```\n",
"\n",
"**# Make a case directory**\n",
"\n",
"If needed create a directory `cases` into your home directory:\n",
" \n",
"```\n",
"mkdir /glade/u/home/$USER/cases/\n",
"```\n",
" \n",
"\n",
"**# Create a new case**\n",
"\n",
"Create a new case with the command ``create_newcase``:\n",
"```\n",
"cd /glade/work/$USER/code/my_cesm_code/cime/scripts/\n",
"./create_newcase --case $CASEDIR --res $RESOLUTION --compset $COMPSET\n",
"```\n",
"\n",
"**# Change the job queue and account number**\n",
"\n",
"If needed, change ``job queue`` and ``account number``.<br>\n",
"For instance, to run in the queue ``regular`` and the project number ``UESM00??``. You should use the project number given for this tutorial.\n",
"``` \n",
"cd $CASEDIR\n",
"./xmlchange JOB_QUEUE=regular,PROJECT=UESM00??\n",
"```\n",
"This step can be redone at anytime in the process. \n",
"\n",
"**# Setup**\n",
"\n",
"Invoke ``case.setup`` with the command:\n",
"``` \n",
"cd $CASEDIR\n",
"./case.setup \n",
"``` \n",
"\n",
"**# Customize namelists**\n",
"\n",
"Edit the file ``user_nl_cam`` and add the lines:\n",
"```\n",
"nhtfrq(2) = -3\n",
"mfilt(2) = 240\n",
"fincl2 = 'TS:I','PS:I', 'U850:I','T850:I','PRECT:I','LHFLX:I','SHFLX:I','FLNT:I','FLNS:I'\n",
"```\n",
"You can do this with a text editor. Alternatively, you can use the echo command:\n",
"```\n",
"echo \"nhtfrq(2) = -3\">> user_nl_cam \n",
"echo \"mfilt(2) = 240\">> user_nl_cam\n",
"echo \"fincl2 = 'TS:I','PS:I', 'U850:I','T850:I','PRECT:I','LHFLX:I','SHFLX:I','FLNT:I','FLNS:I'\">> user_nl_cam\n",
"echo \"\">> user_nl_cam \n",
"```\n",
"\n",
"You build the namelists with the command:\n",
"```\n",
"./preview_namelists\n",
"```\n",
"This step is optional as the script ``preview_namelists`` is automatically called by ``case.build`` and ``case.submit``. But it is nice to check that your changes made their way into:\n",
"```\n",
"$CASEDIR/CaseDocs/atm_in\n",
"```\n",
"\n",
"\n",
"**# Set run length**\n",
"\n",
"If needed, change the ``run length``. If you want to run 5 days, you don't have to do this, as 5 days is the default. \n",
"``` \n",
"./xmlchange STOP_N=5,STOP_OPTION=ndays\n",
"```\n",
"\n",
"\n",
"**# Build and submit**:\n",
"```\n",
"qcmd -- ./case.build\n",
"./case.submit\n",
"```\n",
"------------\n",
"\n",
"\n",
"\n",
"**# Check your solution**\n",
"\n",
"When the run is completed, look at the history files into the archive directory. \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/$CASENAME/atm/hist\n",
"ls \n",
"```\n",
"\n",
"As your run is only 5-day, there should be no monthly file (``h0``)\n",
"\n",
"(2) Look at the contents of the ``h1`` files using ``ncdump``.\n",
"\n",
"```\n",
"cd /glade/derecho/scratch/$USER/archive/$CASENAME/atm/hist\n",
"ncdump -h f2000_control.cam.h1.0001-01-01-00000.nc\n",
"```\n",
"\n",
"- The file should contain the instantaneous output in the file ``h1`` for the variables:\n",
"```\n",
" float FLNS(time, lat, lon) ;\n",
" FLNS:Sampling_Sequence = \"rad_lwsw\" ;\n",
" FLNS:units = \"W/m2\" ;\n",
" FLNS:long_name = \"Net longwave flux at surface\" ;\n",
" float FLNT(time, lat, lon) ;\n",
" FLNT:Sampling_Sequence = \"rad_lwsw\" ;\n",
" FLNT:units = \"W/m2\" ;\n",
" FLNT:long_name = \"Net longwave flux at top of model\" ;\n",
" float LHFLX(time, lat, lon) ;\n",
" LHFLX:units = \"W/m2\" ;\n",
" LHFLX:long_name = \"Surface latent heat flux\" ;\n",
" float PRECT(time, lat, lon) ;\n",
" PRECT:units = \"m/s\" ;\n",
" PRECT:long_name = \"Total (convective and large-scale) precipitation rate (liq + ice)\" ;\n",
" float PS(time, lat, lon) ;\n",
" PS:units = \"Pa\" ;\n",
" PS:long_name = \"Surface pressure\" ;\n",
" float SHFLX(time, lat, lon) ;\n",
" SHFLX:units = \"W/m2\" ;\n",
" SHFLX:long_name = \"Surface sensible heat flux\" ;\n",
" float T850(time, lat, lon) ;\n",
" T850:units = \"K\" ;\n",
" T850:long_name = \"Temperature at 850 mbar pressure surface\" ;\n",
" float TS(time, lat, lon) ;\n",
" TS:units = \"K\" ;\n",
" TS:long_name = \"Surface temperature (radiative)\" ;\n",
" float U850(time, lat, lon) ;\n",
" U850:units = \"m/s\" ;\n",
" U850:long_name = \"Zonal wind at 850 mbar pressure surface\" ;\n",
"```\n",
"Note that these variables have no ``cell_methods`` attribute becasue the output is instantaneous. \n",
"\n",
"</details>\n",
"</div>\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "472131c7-88f9-4863-a2bc-d7364333542d",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "815be0bc-515a-474b-a3dd-b7ba02831b9a",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.13"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
53 changes: 53 additions & 0 deletions notebooks/challenge/paleo/paleo.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "f406f992-92bd-4b17-9bd3-b99c5c8abaf3",
"metadata": {},
"source": [
"# Paleo"
]
},
{
"cell_type": "markdown",
"id": "b6f4905b-cd2a-454e-89cf-ccc585c90247",
"metadata": {
"tags": []
},
"source": [
"## Learning Goals\n",
"\n",
"- Blabla"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "e961b1bd-a1c8-4e54-bafc-46dcf78454f1",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.13"
}
},
"nbformat": 4,
"nbformat_minor": 5
}

0 comments on commit 63ef20e

Please sign in to comment.