{ "cells": [ { "cell_type": "markdown", "id": "3daa9f7f-12d6-439c-8ec2-d9fafcd43412", "metadata": {}, "source": [ "# YAML files\n", "\n" ] }, { "cell_type": "raw", "id": "cfaecd25-1908-4d73-b025-07816fec6f7f", "metadata": {}, "source": [ "## How to run the ADF\n", "\n", "There are two ways to run the ADF, the first and most stright forward is runnning the ADF in the terminal and the second is via Jupyter.\n", "\n", "The first steps are to set the desired (and required) variables in the config yaml file(s). In this demo, we will run the ADF standard variable defaults file (`adf_variable_defaults.yaml`), but feel free to explore making your own, please refer back to the Variable Defaults yaml section.\n", "\n", "\n", "\n", "\n", "## Types of ADF Comparisons\n", "\n", "There are a couple different ADF runs one can do:\n", "\n", "

Single Case Comparison

\n", "

Multiple Case Comparison**

\n", "

  ** In progress, will not be part of this tutorial currently :(

\n", "\n", "## Available Comparison Cases\n", "\n", "There are essentially 3 types of comparisons:\n", "\n", "* CAM vs CAM\n", "* CAM vs Observations/Reanalysis\n", "* CAM vs CMIP\n", "\n", "Each have their own requirements for the run-time config file (eg `config_cam_baseline_example`). The requirements for each type of comparison will be addressed in their respective sections of this tutorial.\n" ] }, { "cell_type": "markdown", "id": "7efb79a7-b054-4f0c-a34d-5b1f38c580bc", "metadata": {}, "source": [ "\n", "\n", "The ADF requires 2 different yaml configuration files: \n", "\n", "`config_cam_baseline_example.yaml` and `adf_variable_defaults.yaml`\n", "\n", "NOTE: Throughout this tutorial we will reference these as the run-time and variable default yaml files respectively.\n", "\n", "\n", "If yaml files are new to you, they are just specialized text files that python (and other languages) can read in and use as configuration files. In the case of the ADF, the variables set in the yaml files will be parsed into Python dictionaries and will accessable throughout the ADF workflow.\n", "\n", "A couple of notes about using the ADF yaml files:
\n", "  Variables can be referenced within the yaml file called with the `${}` syntax.
\n", "IE if we set a `user` variable `user: richling` we can call this by `${user}` and `richling` wil be used where ever it is referenced.
\n", "\n", "\n", "\n", "\n", "\n", "\n", "::::{Warning}\n", "Please do not modify either of these files!\n", " \n", "It is recommended to make a copy of each file, make modifications in those copies, and then run them with the ADF.\n", "\n", "Modifying the originals should only be done if you plan to push changes back to the main ADF repo.\n", "::::\n", "\n", "\n", "##### Run-time yaml\n", "\n", "
 config_cam_baseline_example.yaml
\n", "\n", "\n", "

This is the most important file for the ADF, it stores all the necessary information that the ADF needs to run including all the relevant information about the case and baseline/observation/cmip runs.

\n", "\n", "

It is also broken up into subsections with each subsection of the yaml file representing grouped sets of information sent to the ADF each having their own variable names.

\n", "\n", "###### Subsections\n", "\n", "* diag_basic_info\n", " - Basic overall run variables\n", " \n", "* diag_cam_climo\n", " - Test (experiment) case variables\n", " \n", "* diag_cam_baseline_climo\n", " - Baseline (control) case variables\n", " - Note: these are the same variables as `diag_cam_climo` just for the baseline case\n", " \n", "* diag_cvdp_info\n", " - For running the Climate Variability Diagnostics Package https://www.cesm.ucar.edu/projects/cvdp\n", " - This will run in the background of the ADF\n", " \n", "* time_averaging_scripts\n", " - Climotology file creation\n", " \n", "* regridding_scripts\n", " - Regridding of climo files\n", " \n", "* analysis_scripts\n", " - AMWG statisics tables\n", " \n", "* plotting_scripts\n", " - Various plotting scripts\n", " \n", "* diag_var_list\n", " - List of CAM variables for ADF to run\n", "\n", "\n", "CAVEAT: using variables in this yaml file
\n", "In this file, we have built subsections in which variables set in a subsection are only callable by referencing the subsection first with a \"`.`\" then variable name.\n", "\n", "IE: Say we want to set the climo years in the test case subsection `diag_cam_climo` and call them in the baseline case subsection `diag_cam_baseline_climo`\n", "\n", "diag_cam_climo:
\n", "\n", "   start_year: 1995 -> we would reference this with `diag_cam_climo.start_year`
\n", "   end_year: 2000 -> we would reference this with `diag_cam_climo.end_year`
\n", "\n", "Now if we wanted to reference these climo years in the baseline subsection:
\n", "\n", "diag_cam_baseline_climo:
\n", "\n", "   start_year: ${`diag_cam_climo.start_year`}
\n", "   end_year: ${`diag_cam_climo.end_year`}\n", "

\n", "\n", "\n", "We can also set global variables (like the `user` example) that can be called in any subsections without the '.' notation. \n", "\n", "IE: Say we want to reference the user variable in the test case subsection `diag_cam_climo`\n", " \n", "diag_cam_climo:
\n", "\n", "   cam_climo_loc: /glade/work/${user}/ADF/data/climos/ -> /glade/work/richling/ADF/data/climos/\n", "\n", "```{tip}\n", "

Please see the config yaml file reference section for more details about this config file including how to use defined variables and more information about the config variables.

\n", "```\n", "\n" ] }, { "cell_type": "markdown", "id": "eb815026-db7c-46e7-9fe4-8f5e92b97875", "metadata": {}, "source": [ "---" ] }, { "cell_type": "markdown", "id": "925db366-c934-4b0c-87f6-b7bf146691ce", "metadata": {}, "source": [ "##### Variable Default yaml\n", "\n", "
 lib/adf_variable_defaults.yaml
\n", "\n", "\n", "This yaml file is designed to host a myriad of information related to each of the variables that are being analyzed in the ADF. Some main points to using this file is to customize plotting options or calcuations/analysis on a variable by variable basis.\n", "\n", "Example of options for zonal wind `U` \n", "```\n", "U:\n", " colormap: \"Blues\"\n", " contour_levels_range: [-10, 90, 5]\n", " diff_colormap: \"BrBG\"\n", " diff_contour_range: [-15, 15, 2]\n", " scale_factor: 1\n", " add_offset: 0\n", " new_unit: \"ms$^{-1}$\"\n", " mpl:\n", " colorbar:\n", " label : \"ms$^{-1}$\"\n", " obs_file: \"U_ERA5_monthly_climo_197901-202112.nc\"\n", " obs_name: \"ERA5\"\n", " obs_var_name: \"U\"\n", " vector_pair: \"V\"\n", " vector_name: \"Wind\"\n", " category: \"State\"\n", "```\n", "\n" ] }, { "cell_type": "raw", "id": "4342f081-132c-4ccb-84a9-ce4138e70453", "metadata": {}, "source": [ "```{tip}\n", "

Please see the variable defaults yaml file reference section for more details of the contents.

\n", "\n", "

Also visit the exercise example for using a custom variable defaults file.

\n", "```\n", "---" ] }, { "cell_type": "raw", "id": "26f023fe-be02-4abb-9492-e2f4eb42b358", "metadata": {}, "source": [ "Please see the reference section for the variable defaults file for more details of the contents. \n", "\n", "Also see the exercise example for using a custom variable defaults file." ] }, { "cell_type": "raw", "id": "a4cf5de1-531a-4715-9f28-2fda7b4cb88f", "metadata": {}, "source": [ "###### Custom Set\n", "\n", "::::{Warning}\n", "Please do not modify this file unless you plan to push your changes back to the ADF repo!\n", " \n", "If you would like to modify this file for your personal ADF runs then it is recommended to make a copy of this file, make modifications in that copy, and then point the ADF.
\n", "\n", "Please see the reference section for the variable defaults file for further assistance. Also see the exercise example for customization\n", "::::" ] } ], "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.9.12" } }, "nbformat": 4, "nbformat_minor": 5 }