{
"cells": [
{
"cell_type": "markdown",
"id": "623cbc23-45bf-4dfd-9f49-8d814d0394ba",
"metadata": {
"papermill": {
"duration": 0.003051,
"end_time": "2025-12-10T17:13:52.266466",
"exception": false,
"start_time": "2025-12-10T17:13:52.263415",
"status": "completed"
},
"tags": []
},
"source": [
"# ADF\n",
"\n",
"A number of plots are provided from ADF. The full output from the stand-alone ADF configuration is in the link below.\n",
"\n",
"\n",
"Note that in standalone format (eg, CUPiD run not through CESM workflow), ADF is currently run by users via the following process:\n",
"1) Install ADF and activate cupid-analysis\n",
"2) Use the `CUPiD/helper_scripts/generate_adf_config_file.py` script to generate an ADF config file based on a CUPiD configuration file.\n",
" * `cd CUPiD/examples/external_diag_packages`\n",
" * `../../helper_scripts/generate_adf_config_file.py --cupid-config-loc . --adf-template ../../externals/ADF/config_amwg_default_plots.yaml --out-file ADF_config.yaml`\n",
"3) Run ADF with the newly created configuration file.\n",
" * `../../externals/ADF/run_adf_diag ADF_config.yaml`"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "82af7435-3849-4fd1-bb2d-2e062719ec5b",
"metadata": {
"editable": true,
"execution": {
"iopub.execute_input": "2025-12-10T17:13:52.273602Z",
"iopub.status.busy": "2025-12-10T17:13:52.273365Z",
"iopub.status.idle": "2025-12-10T17:14:03.964261Z",
"shell.execute_reply": "2025-12-10T17:14:03.963718Z"
},
"papermill": {
"duration": 11.696117,
"end_time": "2025-12-10T17:14:03.965877",
"exception": false,
"start_time": "2025-12-10T17:13:52.269760",
"status": "completed"
},
"slideshow": {
"slide_type": ""
},
"tags": [
"hide-cell"
]
},
"outputs": [],
"source": [
"import os\n",
"\n",
"from IPython.core.display import HTML, Image\n",
"from IPython.display import display\n",
"import pandas as pd"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "2a759f1b-eca7-4eec-a16a-eede1a6ab36c",
"metadata": {
"editable": true,
"execution": {
"iopub.execute_input": "2025-12-10T17:14:03.977095Z",
"iopub.status.busy": "2025-12-10T17:14:03.976728Z",
"iopub.status.idle": "2025-12-10T17:14:03.980076Z",
"shell.execute_reply": "2025-12-10T17:14:03.979662Z"
},
"papermill": {
"duration": 0.009476,
"end_time": "2025-12-10T17:14:03.980762",
"exception": false,
"start_time": "2025-12-10T17:14:03.971286",
"status": "completed"
},
"slideshow": {
"slide_type": ""
},
"tags": [
"parameters",
"hide-cell"
]
},
"outputs": [],
"source": [
"adf_root = \".\"\n",
"case_name = None\n",
"base_case_name = None\n",
"start_date = \"\"\n",
"end_date = \"\"\n",
"base_start_date = None\n",
"base_end_date = None\n",
"key_plots = None\n",
"compare_obs: False\n",
"# adf_root will be external_diag_packages/computed_notebooks/ADF/"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "27a38e9d",
"metadata": {
"execution": {
"iopub.execute_input": "2025-12-10T17:14:03.987710Z",
"iopub.status.busy": "2025-12-10T17:14:03.987482Z",
"iopub.status.idle": "2025-12-10T17:14:03.991580Z",
"shell.execute_reply": "2025-12-10T17:14:03.991202Z"
},
"papermill": {
"duration": 0.008342,
"end_time": "2025-12-10T17:14:03.992294",
"exception": false,
"start_time": "2025-12-10T17:14:03.983952",
"status": "completed"
},
"tags": [
"injected-parameters"
]
},
"outputs": [],
"source": [
"# Parameters\n",
"case_name = \"b.e23_alpha17f.BLT1850.ne30_t232.092\"\n",
"base_case_name = \"b.e30_beta02.BLT1850.ne30_t232.104\"\n",
"case_nickname = \"BLT1850_92\"\n",
"base_case_nickname = \"BLT1850_104\"\n",
"CESM_output_dir = \"/glade/campaign/cesm/development/cross-wg/diagnostic_framework/CESM_output_for_testing\"\n",
"start_date = \"0001-01-01\"\n",
"end_date = \"0021-01-01\"\n",
"climo_start_date = \"0001-01-01\"\n",
"climo_end_date = \"0021-01-01\"\n",
"base_start_date = \"0001-01-01\"\n",
"base_end_date = \"0045-01-01\"\n",
"base_climo_start_date = \"0001-01-01\"\n",
"base_climo_end_date = \"0021-01-01\"\n",
"obs_data_dir = (\n",
" \"/glade/campaign/cesm/development/cross-wg/diagnostic_framework/CUPiD_obs_data\"\n",
")\n",
"ts_dir = None\n",
"lc_kwargs = {\"threads_per_worker\": 1}\n",
"serial = False\n",
"adf_root = \"../../examples/external_diag_packages/ADF_output/\"\n",
"key_plots = [\n",
" \"Surface_Wind_Stress_ANN_LatLon_Vector_Mean.png\",\n",
" \"PRECT_ANN_LatLon_Mean.png\",\n",
" \"PS_DJF_SHPolar_Mean.png\",\n",
" \"TaylorDiag_ANN_Special_Mean.png\",\n",
"]\n",
"compare_obs = False\n",
"subset_kwargs = {}\n",
"product = \"/glade/derecho/scratch/richling/compass-cupid/CUPiD/examples/external_diag_packages/computed_notebooks//atm/ADF.ipynb\"\n"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "81bf4573-8806-486f-a2f6-79e244415c07",
"metadata": {
"editable": true,
"execution": {
"iopub.execute_input": "2025-12-10T17:14:03.999522Z",
"iopub.status.busy": "2025-12-10T17:14:03.999242Z",
"iopub.status.idle": "2025-12-10T17:14:04.002324Z",
"shell.execute_reply": "2025-12-10T17:14:04.001936Z"
},
"papermill": {
"duration": 0.007479,
"end_time": "2025-12-10T17:14:04.002994",
"exception": false,
"start_time": "2025-12-10T17:14:03.995515",
"status": "completed"
},
"slideshow": {
"slide_type": ""
},
"tags": [
"hide-cell"
]
},
"outputs": [],
"source": [
"# Want some base case parameter defaults to equal control case values\n",
"if base_case_name is not None:\n",
" if base_start_date is None:\n",
" base_start_date = start_date\n",
"\n",
" if base_end_date is None:\n",
" base_end_date = end_date\n",
"if compare_obs:\n",
" base_case_name = \"Obs\"\n",
" base_start_date = None\n",
" base_end_date = None"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "4104f878-a8c3-4d0f-8c00-555e6b2b3273",
"metadata": {
"editable": true,
"execution": {
"iopub.execute_input": "2025-12-10T17:14:04.010215Z",
"iopub.status.busy": "2025-12-10T17:14:04.010028Z",
"iopub.status.idle": "2025-12-10T17:14:04.013246Z",
"shell.execute_reply": "2025-12-10T17:14:04.012862Z"
},
"papermill": {
"duration": 0.007715,
"end_time": "2025-12-10T17:14:04.013941",
"exception": false,
"start_time": "2025-12-10T17:14:04.006226",
"status": "completed"
},
"slideshow": {
"slide_type": ""
},
"tags": [
"hide-cell"
]
},
"outputs": [],
"source": [
"# convert start-date and end-date to year range\n",
"case_year_range = [int(start_date.split(\"-\")[0]), int(end_date.split(\"-\")[0]) - 1]\n",
"\n",
"if (not base_start_date) and (not base_end_date):\n",
" base_case_year_range = None\n",
"else:\n",
" base_case_year_range = [\n",
" int(base_start_date.split(\"-\")[0]),\n",
" int(base_end_date.split(\"-\")[0]) - 1,\n",
" ]"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "ee0774cc-c68a-4385-b94c-08fa806f28c0",
"metadata": {
"editable": true,
"execution": {
"iopub.execute_input": "2025-12-10T17:14:04.023099Z",
"iopub.status.busy": "2025-12-10T17:14:04.022911Z",
"iopub.status.idle": "2025-12-10T17:14:04.028973Z",
"shell.execute_reply": "2025-12-10T17:14:04.028615Z"
},
"papermill": {
"duration": 0.01259,
"end_time": "2025-12-10T17:14:04.029972",
"exception": false,
"start_time": "2025-12-10T17:14:04.017382",
"status": "completed"
},
"slideshow": {
"slide_type": ""
},
"tags": [
"hide-input"
]
},
"outputs": [
{
"data": {
"text/html": [
"Full ADF output"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"if base_case_year_range:\n",
" base_case_yr_range_str = f\"_{base_case_year_range[0]}_{base_case_year_range[1]}\"\n",
"else:\n",
" base_case_yr_range_str = \"\"\n",
"adf_comparison_name = f\"{case_name}_{case_year_range[0]}_{case_year_range[1]}_vs_{base_case_name}{base_case_yr_range_str}\"\n",
"adf_root = os.path.join(adf_root, adf_comparison_name)\n",
"display(\n",
" HTML(\n",
" f'Full ADF output'\n",
" )\n",
")"
]
},
{
"cell_type": "markdown",
"id": "f9234aec-1fe5-4bbf-ad6c-fb565297afbe",
"metadata": {
"papermill": {
"duration": 0.00344,
"end_time": "2025-12-10T17:14:04.038610",
"exception": false,
"start_time": "2025-12-10T17:14:04.035170",
"status": "completed"
},
"tags": []
},
"source": [
"## Key Metrics from ADF\n",
"\n",
"Some important things to look at from ADF include a comparison table and a few maps:"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "a5b02451-98ad-4089-b184-75391a262db3",
"metadata": {
"editable": true,
"execution": {
"iopub.execute_input": "2025-12-10T17:14:04.046341Z",
"iopub.status.busy": "2025-12-10T17:14:04.046097Z",
"iopub.status.idle": "2025-12-10T17:14:04.049255Z",
"shell.execute_reply": "2025-12-10T17:14:04.048864Z"
},
"papermill": {
"duration": 0.00779,
"end_time": "2025-12-10T17:14:04.049952",
"exception": false,
"start_time": "2025-12-10T17:14:04.042162",
"status": "completed"
},
"slideshow": {
"slide_type": ""
},
"tags": [
"hide-input"
]
},
"outputs": [],
"source": [
"comparison_table = os.path.join(adf_root, \"amwg_table_comp.csv\")\n",
"if os.path.isfile(comparison_table):\n",
" table = pd.read_csv(comparison_table)\n",
" display(HTML(table.to_html(index=False, float_format=\"{:6g}\".format)))"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "be819352-c723-4f48-afac-d93f6d192f96",
"metadata": {
"editable": true,
"execution": {
"iopub.execute_input": "2025-12-10T17:14:04.057263Z",
"iopub.status.busy": "2025-12-10T17:14:04.057077Z",
"iopub.status.idle": "2025-12-10T17:14:04.059773Z",
"shell.execute_reply": "2025-12-10T17:14:04.059428Z"
},
"papermill": {
"duration": 0.007143,
"end_time": "2025-12-10T17:14:04.060456",
"exception": false,
"start_time": "2025-12-10T17:14:04.053313",
"status": "completed"
},
"slideshow": {
"slide_type": ""
},
"tags": [
"hide-input"
]
},
"outputs": [],
"source": [
"for path_to_key_plot in key_plots:\n",
" full_path = os.path.join(adf_root, path_to_key_plot)\n",
" if os.path.isfile(full_path):\n",
" display(Image(full_path))"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "cupid-infrastructure",
"language": "python",
"name": "cupid-infrastructure"
},
"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.11.4"
},
"papermill": {
"duration": 18.824281,
"end_time": "2025-12-10T17:14:04.480417",
"exception": null,
"input_path": "/glade/derecho/scratch/richling/tmp/tmpvraqcytn.ipynb",
"output_path": "/glade/derecho/scratch/richling/compass-cupid/CUPiD/examples/external_diag_packages/computed_notebooks/atm/ADF.ipynb",
"parameters": {
"CESM_output_dir": "/glade/campaign/cesm/development/cross-wg/diagnostic_framework/CESM_output_for_testing",
"adf_root": "../../examples/external_diag_packages/ADF_output/",
"base_case_name": "b.e30_beta02.BLT1850.ne30_t232.104",
"base_case_nickname": "BLT1850_104",
"base_climo_end_date": "0021-01-01",
"base_climo_start_date": "0001-01-01",
"base_end_date": "0045-01-01",
"base_start_date": "0001-01-01",
"case_name": "b.e23_alpha17f.BLT1850.ne30_t232.092",
"case_nickname": "BLT1850_92",
"climo_end_date": "0021-01-01",
"climo_start_date": "0001-01-01",
"compare_obs": false,
"end_date": "0021-01-01",
"key_plots": [
"Surface_Wind_Stress_ANN_LatLon_Vector_Mean.png",
"PRECT_ANN_LatLon_Mean.png",
"PS_DJF_SHPolar_Mean.png",
"TaylorDiag_ANN_Special_Mean.png"
],
"lc_kwargs": {
"threads_per_worker": 1
},
"obs_data_dir": "/glade/campaign/cesm/development/cross-wg/diagnostic_framework/CUPiD_obs_data",
"product": "/glade/derecho/scratch/richling/compass-cupid/CUPiD/examples/external_diag_packages/computed_notebooks//atm/ADF.ipynb",
"serial": false,
"start_date": "0001-01-01",
"subset_kwargs": {},
"ts_dir": null
},
"start_time": "2025-12-10T17:13:45.656136"
}
},
"nbformat": 4,
"nbformat_minor": 5
}