Skip to content

Commit

Permalink
Merge pull request #230 from cecilehannay/main
Browse files Browse the repository at this point in the history
rename exrecise in chapter xml
  • Loading branch information
cecilehannay authored Jul 22, 2024
2 parents a065575 + f1b91e3 commit 0a86881
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 45 deletions.
18 changes: 9 additions & 9 deletions notebooks/diagnostics/cam/basics_cam.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
{
"data": {
"text/plain": [
"'/glade/derecho/scratch/PUT_USER_NAME_HERE/archive/b.day2.1/atm/hist/b.day2.1.cam.h0.0003-07.nc'"
"'/glade/derecho/scratch/PUT_USER_NAME_HERE/archive/b1850.run_length/atm/hist/b1850.run_length.cam.h0.0003-07.nc'"
]
},
"execution_count": 2,
Expand All @@ -94,15 +94,15 @@
"# Set your username here:\n",
"username = \"PUT_USER_NAME_HERE\"\n",
"\n",
"# Here we point to the archive directory from your b.day2.1 simulation\n",
"monthly_output_path = f\"/glade/derecho/scratch/{username}/archive/b.day2.1/atm/hist\"\n",
"# Here we point to the archive directory from your b1850.run_length simulation\n",
"monthly_output_path = f\"/glade/derecho/scratch/{username}/archive/b1850.run_length/atm/hist\"\n",
"\n",
"# If you were unable to successfully run the b.day2.1 simulation, then feel free to use\n",
"# If you were unable to successfully run the b1850.run_length simulation, then feel free to use\n",
"# this provided simulation data instead:\n",
"#monthly_output_path = \"/glade/campaign/cesm/tutorial/tutorial_2023_archive/b.day2.1/atm/hist\"\n",
"#monthly_output_path = \"/glade/campaign/cesm/tutorial/tutorial_2023_archive/b1850.run_length/atm/hist\"\n",
"\n",
"# Name of history file to plot\n",
"file_name = \"b.day2.1.cam.h0.0003-07.nc\"\n",
"file_name = \"b1850.run_length.cam.h0.0003-07.nc\"\n",
"\n",
"files = os.path.join(monthly_output_path, file_name)\n",
"files"
Expand All @@ -116,14 +116,14 @@
"outputs": [
{
"ename": "FileNotFoundError",
"evalue": "[Errno 2] No such file or directory: '/glade/derecho/scratch/PUT_USER_NAME_HERE/archive/b.day2.1/atm/hist/b.day2.1.cam.h0.0003-07.nc'",
"evalue": "[Errno 2] No such file or directory: '/glade/derecho/scratch/PUT_USER_NAME_HERE/archive/b1850.run_length/atm/hist/b1850.run_length.cam.h0.0003-07.nc'",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mKeyError\u001b[0m Traceback (most recent call last)",
"File \u001b[0;32m/glade/u/apps/opt/conda/envs/npl-2023b/lib/python3.10/site-packages/xarray/backends/file_manager.py:211\u001b[0m, in \u001b[0;36mCachingFileManager._acquire_with_cache_info\u001b[0;34m(self, needs_lock)\u001b[0m\n\u001b[1;32m 210\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m--> 211\u001b[0m file \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_cache\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_key\u001b[49m\u001b[43m]\u001b[49m\n\u001b[1;32m 212\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mKeyError\u001b[39;00m:\n",
"File \u001b[0;32m/glade/u/apps/opt/conda/envs/npl-2023b/lib/python3.10/site-packages/xarray/backends/lru_cache.py:56\u001b[0m, in \u001b[0;36mLRUCache.__getitem__\u001b[0;34m(self, key)\u001b[0m\n\u001b[1;32m 55\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_lock:\n\u001b[0;32m---> 56\u001b[0m value \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_cache\u001b[49m\u001b[43m[\u001b[49m\u001b[43mkey\u001b[49m\u001b[43m]\u001b[49m\n\u001b[1;32m 57\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_cache\u001b[38;5;241m.\u001b[39mmove_to_end(key)\n",
"\u001b[0;31mKeyError\u001b[0m: [<class 'netCDF4._netCDF4.Dataset'>, ('/glade/derecho/scratch/PUT_USER_NAME_HERE/archive/b.day2.1/atm/hist/b.day2.1.cam.h0.0003-07.nc',), 'r', (('clobber', True), ('diskless', False), ('format', 'NETCDF4'), ('persist', False)), 'da467520-dd8b-4048-a691-3445d0f0f93e']",
"\u001b[0;31mKeyError\u001b[0m: [<class 'netCDF4._netCDF4.Dataset'>, ('/glade/derecho/scratch/PUT_USER_NAME_HERE/archive/b1850.run_length/atm/hist/b1850.run_length.cam.h0.0003-07.nc',), 'r', (('clobber', True), ('diskless', False), ('format', 'NETCDF4'), ('persist', False)), 'da467520-dd8b-4048-a691-3445d0f0f93e']",
"\nDuring handling of the above exception, another exception occurred:\n",
"\u001b[0;31mFileNotFoundError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[0;32mIn[3], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m ds \u001b[38;5;241m=\u001b[39m \u001b[43mxr\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mopen_dataset\u001b[49m\u001b[43m(\u001b[49m\u001b[43mfiles\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 2\u001b[0m ds\n",
Expand All @@ -138,7 +138,7 @@
"File \u001b[0;32m/glade/u/apps/opt/conda/envs/npl-2023b/lib/python3.10/site-packages/xarray/backends/file_manager.py:217\u001b[0m, in \u001b[0;36mCachingFileManager._acquire_with_cache_info\u001b[0;34m(self, needs_lock)\u001b[0m\n\u001b[1;32m 215\u001b[0m kwargs \u001b[38;5;241m=\u001b[39m kwargs\u001b[38;5;241m.\u001b[39mcopy()\n\u001b[1;32m 216\u001b[0m kwargs[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mmode\u001b[39m\u001b[38;5;124m\"\u001b[39m] \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_mode\n\u001b[0;32m--> 217\u001b[0m file \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_opener\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_args\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 218\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_mode \u001b[38;5;241m==\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mw\u001b[39m\u001b[38;5;124m\"\u001b[39m:\n\u001b[1;32m 219\u001b[0m \u001b[38;5;66;03m# ensure file doesn't get overridden when opened again\u001b[39;00m\n\u001b[1;32m 220\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_mode \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124ma\u001b[39m\u001b[38;5;124m\"\u001b[39m\n",
"File \u001b[0;32msrc/netCDF4/_netCDF4.pyx:2464\u001b[0m, in \u001b[0;36mnetCDF4._netCDF4.Dataset.__init__\u001b[0;34m()\u001b[0m\n",
"File \u001b[0;32msrc/netCDF4/_netCDF4.pyx:2027\u001b[0m, in \u001b[0;36mnetCDF4._netCDF4._ensure_nc_success\u001b[0;34m()\u001b[0m\n",
"\u001b[0;31mFileNotFoundError\u001b[0m: [Errno 2] No such file or directory: '/glade/derecho/scratch/PUT_USER_NAME_HERE/archive/b.day2.1/atm/hist/b.day2.1.cam.h0.0003-07.nc'"
"\u001b[0;31mFileNotFoundError\u001b[0m: [Errno 2] No such file or directory: '/glade/derecho/scratch/PUT_USER_NAME_HERE/archive/b1850.run_length/atm/hist/b1850.run_length.cam.h0.0003-07.nc'"
]
}
],
Expand Down
10 changes: 5 additions & 5 deletions notebooks/diagnostics/cice/basics_cice.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,15 @@
"# Set your username here:\n",
"username = \"PUT_USER_NAME_HERE\"\n",
"\n",
"# Here we point to the archive directory from your b.day2.1 simulation\n",
"monthly_output_path = f\"/glade/derecho/scratch/{username}/archive/b.day2.1/ice/hist\"\n",
"# Here we point to the archive directory from your b1850.run_length simulation\n",
"monthly_output_path = f\"/glade/derecho/scratch/{username}/archive/b1850.run_length/ice/hist\"\n",
"\n",
"# If you were unable to successfully run the b.day2.1 simulation, then feel free to use\n",
"# If you were unable to successfully run the b1850.run_length simulation, then feel free to use\n",
"# this provided simulation data instead:\n",
"#monthly_output_path = \"/glade/campaign/cesm/tutorial/tutorial_2023_archive/b.day2.1/ice/hist\"\n",
"#monthly_output_path = \"/glade/campaign/cesm/tutorial/tutorial_2023_archive/b1850.run_length/ice/hist\"\n",
"\n",
"# Name of CESM run\n",
"run_name = \"b.day2.1\"\n",
"run_name = \"b1850.run_length\"\n",
"\n",
"# Create path to all files, including unix wild card for all dates\n",
"files = os.path.join(monthly_output_path, run_name + \".cice.h.*\")\n",
Expand Down
12 changes: 6 additions & 6 deletions notebooks/diagnostics/clm_ctsm/basics_clm.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
"source": [
"## 1. Reading and formatting data\n",
"\n",
"**Note**: the drop-down solutions, below, assume you used b.day2.1 output for plotting for this section"
"**Note**: the drop-down solutions, below, assume you used b1850.run_length output for plotting for this section"
]
},
{
Expand All @@ -135,15 +135,15 @@
"# Set your username here:\n",
"username = \"PUT_USER_NAME_HERE\"\n",
"\n",
"# Here we point to the archive directory from your b.day2.1 simulation\n",
"monthly_output_path = f\"/glade/derecho/scratch/{username}/archive/b.day2.1/lnd/hist\"\n",
"# Here we point to the archive directory from your b1850.run_length simulation\n",
"monthly_output_path = f\"/glade/derecho/scratch/{username}/archive/b1850.run_length/lnd/hist\"\n",
"\n",
"# If you were unable to successfully run the b.day2.1 simulation, then feel free to use\n",
"# If you were unable to successfully run the b1850.run_length simulation, then feel free to use\n",
"# this provided simulation data instead:\n",
"#monthly_output_path = \"/glade/campaign/cesm/tutorial/tutorial_2023_archive/b.day2.1/lnd/hist\"\n",
"#monthly_output_path = \"/glade/campaign/cesm/tutorial/tutorial_2023_archive/b1850.run_length/lnd/hist\"\n",
"\n",
"# Name of CESM run\n",
"run_name = \"b.day2.1\"\n",
"run_name = \"b1850.run_length\"\n",
"\n",
"# Create path to all files, including unix wild card for all dates\n",
"files = os.path.join(monthly_output_path, run_name + \".clm2.h0.*\")\n",
Expand Down
2 changes: 1 addition & 1 deletion notebooks/diagnostics/cupid.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@
" ts_done: [False]\n",
" overwrite_ts: [False]\n",
" ts_output_dir: /glade/derecho/scratch/USERNAME/archive #<-Replace \"USERNAME\" with your own username\n",
" case_name: 'b.day2.1'\n",
" case_name: 'b1850.run_length'\n",
"\n",
" #Variables can either be provided as a list (e.g. ['X', 'Y', 'Z']) or,\n",
" #if you want to convert everything on the file, by using the ['process_all']\n",
Expand Down
6 changes: 3 additions & 3 deletions notebooks/diagnostics/pop/advanced_pop.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,12 @@
"source": [
"# Set your username here:\n",
"username = \"PUT_USER_NAME_HERE\"\n",
"casename = 'b.day2.1'\n",
"casename = 'b1850.run_length'\n",
"\n",
"# Here we point to the archive directory from your b.day2.1 simulation\n",
"# Here we point to the archive directory from your b1850.run_length simulation\n",
"pth = f\"/glade/derecho/scratch/{username}/archive/{casename}/ocn/hist/\"\n",
"\n",
"# If you were unable to successfully run the b.day2.1 simulation, then feel free to use\n",
"# If you were unable to successfully run the b1850.run_length simulation, then feel free to use\n",
"# this provided simulation data instead:\n",
"#pth = f'/glade/campaign/cesm/tutorial/tutorial_2023_archive/{casename}/ocn/hist/'\n",
"\n",
Expand Down
16 changes: 8 additions & 8 deletions notebooks/diagnostics/pop/basics_pop.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@
"source": [
"### Get the data \n",
"\n",
"**Note**: the drop-down solutions, below, assume you used b.day2.1 output for plotting"
"**Note**: the drop-down solutions, below, assume you used b1850.run_length output for plotting"
]
},
{
Expand All @@ -234,12 +234,12 @@
"outputs": [],
"source": [
"# Set your casename here:\n",
"casename = 'b.day2.1'\n",
"casename = 'b1850.run_length'\n",
"\n",
"# Here we point to the archive directory from your b.day2.1 simulation\n",
"# Here we point to the archive directory from your b1850.run_length simulation\n",
"pth = f\"/glade/derecho/scratch/{username}/archive/{casename}/ocn/hist/\"\n",
"\n",
"# If you were unable to successfully run the b.day2.1 simulation, then feel free to use\n",
"# If you were unable to successfully run the b1850.run_length simulation, then feel free to use\n",
"# this provided simulation data instead:\n",
"#pth = f'/glade/campaign/cesm/tutorial/tutorial_2023_archive/{casename}/ocn/hist/'\n",
"\n",
Expand All @@ -253,10 +253,10 @@
"metadata": {},
"source": [
"##### Details on files \n",
"- b.day2.1.pop.h.0001-01.nc : one timestep year ???? and month -?? for a number of 2D and 3D variables and constants\n",
"- b.day2.1.pop.h.nday1.0001-01-01.nc : daily timestep output for one month for SST, SST variance, SSS and (max) mixed layer depth\n",
"- b.day2.1.pop.h.once.nc : (background) mixing values\n",
"- b.day2.1.pop.hv.nc: viscosities"
"- b1850.run_length.pop.h.0001-01.nc : one timestep year ???? and month -?? for a number of 2D and 3D variables and constants\n",
"- b1850.run_length.pop.h.nday1.0001-01-01.nc : daily timestep output for one month for SST, SST variance, SSS and (max) mixed layer depth\n",
"- b1850.run_length.pop.h.once.nc : (background) mixing values\n",
"- b1850.run_length.pop.hv.nc: viscosities"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"\n",
"<strong>Exercise: Modify the `env_run.xml` file </strong><br><br>\n",
"**Part I**: \n",
"Create a new fully coupled **startup** case named \"b.day2.1\" from the 1850 climate conditions with a resolution of f19_g17. Increase the amount of standard output produced by the model for debugging. Run for 1 month. <br><br>\n",
"Create a new fully coupled **startup** case named \"b1850.run_length\" from the 1850 climate conditions with a resolution of f19_g17. Increase the amount of standard output produced by the model for debugging. Run for 1 month. <br><br>\n",
" \n",
"**Part II**:\n",
"*Do part II only **after** Part I has finished running*. \n",
Expand Down Expand Up @@ -74,14 +74,14 @@
" \n",
"```\n",
" cd /glade/work/$USER/code/my_cesm_code/cime/scripts\n",
" ./create_newcase --case /glade/work/$USER/cases/b.day2.1 --res f19_g17 --compset B1850\n",
" ./create_newcase --case /glade/work/$USER/cases/b1850.run_length --res f19_g17 --compset B1850\n",
"```\n",
"<br>\n",
" \n",
"In your case directory, change debugging levels and set runtime variables:\n",
"\n",
"```\n",
" cd /glade/work/$USER/cases/b.day2.1\n",
" cd /glade/work/$USER/cases/b1850.run_length\n",
" ./xmlchange INFO_DBUG=2,STOP_N=3,STOP_OPTION=nmonths\n",
" ./xmlchange --subgroup case.run JOB_WALLCLOCK_TIME=2:00:00\n",
"```\n",
Expand Down Expand Up @@ -152,7 +152,7 @@
"```\n",
"\n",
"<br>\n",
"6. Submit (./case.submit) from your b.day2.1 case directory:\n",
"6. Submit (./case.submit) from your b1850.run_length case directory:\n",
"\n",
"```\n",
" ./case.submit\n",
Expand Down
10 changes: 5 additions & 5 deletions notebooks/modifications/xml/exercises/xml_runtype_exercise.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"\n",
"<strong>Exercise: Modify the `env_run.xml` file </strong><br><br>\n",
" \n",
"Branch from the end of Exercise 1 Part I to create a new case named \"b.day2.2\". \n",
"Branch from the end of Exercise 1 Part I to create a new case named \"b1850.branch\". \n",
"Double the ocean coupling frequency (`OCN_NCPL`). Include an initial file as output data. Run for 1 month, then restart for 1 month. \n",
" \n",
" \n",
Expand Down Expand Up @@ -69,17 +69,17 @@
" \n",
"```\n",
" cd /glade/work/$USER/code/my_cesm_code/cime/scripts/\n",
" ./create_newcase --case /glade/work/$USER/cases/b.day2.2 --res f19_g17 --compset B1850\n",
" ./create_newcase --case /glade/work/$USER/cases/b1850.branch --res f19_g17 --compset B1850\n",
"```\n",
"<br>\n",
"\n",
"<br> \n",
"2. In your case directory, change the run type to branch, and change the associated RUN_* variables:\n",
"\n",
"```\n",
" cd /glade/work/$USER/cases/b.day2.2\n",
" cd /glade/work/$USER/cases/b1850.branch\n",
" ./xmlchange RUN_TYPE=branch\n",
" ./xmlchange RUN_REFCASE=b.day2.1,RUN_REFDATE=0001-04-01,GET_REFCASE=FALSE\n",
" ./xmlchange RUN_REFCASE=b1850.run_length,RUN_REFDATE=0001-04-01,GET_REFCASE=FALSE\n",
"```\n",
"\n",
"<br> \n",
Expand All @@ -101,7 +101,7 @@
" \n",
"```\n",
" ./case.setup\n",
" cp /glade/derecho/scratch/$USER/archive/b.day2.1/rest/0001-04-01-00000/* /glade/derecho/scratch/$USER/b.day2.2/run/\n",
" cp /glade/derecho/scratch/$USER/archive/b1850.run_length/rest/0001-04-01-00000/* /glade/derecho/scratch/$USER/b1850.branch/run/\n",
"```\n",
" \n",
"<br>\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,15 @@
" \n",
"```\n",
" cd /glade/work/$USER/code/my_cesm_code/cime/scripts/\n",
" ./create_newcase --case /glade/work/$USER/cases/b.day2.3 --res f19_g17 --compset B1850\n",
" ./create_newcase --case /glade/work/$USER/cases/b1850.timestep --res f19_g17 --compset B1850\n",
"```\n",
" \n",
"<br> \n",
"2. In your case directory, change run type and runtime variables:\n",
" \n",
"```\n",
" cd /glade/work/$USER/cases/b.day2.3\n",
" ./xmlchange RUN_TYPE=hybrid,RUN_REFCASE=b.day2.2,RUN_REFDATE=0001-06-01,GET_REFCASE=FALSE,JOB_WALLCLOCK_TIME=2:00:00\n",
" cd /glade/work/$USER/cases/b1850.timestep\n",
" ./xmlchange RUN_TYPE=hybrid,RUN_REFCASE=b1850.branch,RUN_REFDATE=0001-06-01,GET_REFCASE=FALSE,JOB_WALLCLOCK_TIME=2:00:00\n",
"```\n",
" \n",
"<br> \n",
Expand All @@ -85,7 +85,7 @@
" \n",
"```\n",
" ./case.setup\n",
" cp /glade/derecho/scratch/$USER/archive/b.day2.2/rest/0001-06-01-00000/* /glade/derecho/scratch/$USER/b.day2.3/run/\n",
" cp /glade/derecho/scratch/$USER/archive/b1850.branch/rest/0001-06-01-00000/* /glade/derecho/scratch/$USER/b1850.timestep/run/\n",
"```\n",
" \n",
"<br> \n",
Expand Down

0 comments on commit 0a86881

Please sign in to comment.