{ "cells": [ { "cell_type": "markdown", "id": "623cbc23-45bf-4dfd-9f49-8d814d0394ba", "metadata": { "papermill": { "duration": 0.006209, "end_time": "2025-08-20T22:04:08.408276", "exception": false, "start_time": "2025-08-20T22:04:08.402067", "status": "completed" }, "tags": [] }, "source": [ "# Link to ADF output\n", "\n", "The output from the stand-alone ADF configuration is in the link below\n", "\n", "\n", "Note that ADF is currently run by users. We hope to update this in response to [CUPiD issue #105](https://github.com/NCAR/CUPiD/issues/105). Temporarily, we suggest users walk through 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-08-20T22:04:08.412531Z", "iopub.status.busy": "2025-08-20T22:04:08.412337Z", "iopub.status.idle": "2025-08-20T22:04:08.747123Z", "shell.execute_reply": "2025-08-20T22:04:08.746644Z" }, "papermill": { "duration": 0.33778, "end_time": "2025-08-20T22:04:08.748158", "exception": false, "start_time": "2025-08-20T22:04:08.410378", "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-08-20T22:04:08.752350Z", "iopub.status.busy": "2025-08-20T22:04:08.751999Z", "iopub.status.idle": "2025-08-20T22:04:08.754960Z", "shell.execute_reply": "2025-08-20T22:04:08.754608Z" }, "papermill": { "duration": 0.005368, "end_time": "2025-08-20T22:04:08.755496", "exception": false, "start_time": "2025-08-20T22:04:08.750128", "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", "# adf_root will be external_diag_packages/computed_notebooks/ADF/" ] }, { "cell_type": "code", "execution_count": 3, "id": "a9f196b8", "metadata": { "execution": { "iopub.execute_input": "2025-08-20T22:04:08.759015Z", "iopub.status.busy": "2025-08-20T22:04:08.758868Z", "iopub.status.idle": "2025-08-20T22:04:08.767057Z", "shell.execute_reply": "2025-08-20T22:04:08.766711Z" }, "papermill": { "duration": 0.010639, "end_time": "2025-08-20T22:04:08.767606", "exception": false, "start_time": "2025-08-20T22:04:08.756967", "status": "completed" }, "tags": [ "injected-parameters" ] }, "outputs": [], "source": [ "# Parameters\n", "case_name = \"b.e30_beta06.B1850C_LTso.ne30_t232_wgx3.192\"\n", "base_case_name = \"b.e30_beta06.B1850C_LTso.ne30_t232_wgx3.188\"\n", "CESM_output_dir = \"/glade/derecho/scratch/hannay/archive\"\n", "base_case_output_dir = \"/glade/derecho/scratch/gmarques/archive\"\n", "start_date = \"0002-01-01\"\n", "end_date = \"0021-12-01\"\n", "base_start_date = \"0002-01-01\"\n", "base_end_date = \"0021-12-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 = True\n", "adf_root = \"../../examples/key_metrics/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", "subset_kwargs = {}\n", "product = \"/glade/work/hannay/CUPiD/examples/key_metrics/computed_notebooks//atm/link_to_ADF.ipynb\"\n" ] }, { "cell_type": "code", "execution_count": 4, "id": "81bf4573-8806-486f-a2f6-79e244415c07", "metadata": { "editable": true, "execution": { "iopub.execute_input": "2025-08-20T22:04:08.771216Z", "iopub.status.busy": "2025-08-20T22:04:08.771029Z", "iopub.status.idle": "2025-08-20T22:04:08.776833Z", "shell.execute_reply": "2025-08-20T22:04:08.776445Z" }, "papermill": { "duration": 0.008519, "end_time": "2025-08-20T22:04:08.777681", "exception": false, "start_time": "2025-08-20T22:04:08.769162", "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" ] }, { "cell_type": "code", "execution_count": 5, "id": "4104f878-a8c3-4d0f-8c00-555e6b2b3273", "metadata": { "editable": true, "execution": { "iopub.execute_input": "2025-08-20T22:04:08.781247Z", "iopub.status.busy": "2025-08-20T22:04:08.781071Z", "iopub.status.idle": "2025-08-20T22:04:08.789265Z", "shell.execute_reply": "2025-08-20T22:04:08.788938Z" }, "papermill": { "duration": 0.010913, "end_time": "2025-08-20T22:04:08.790164", "exception": false, "start_time": "2025-08-20T22:04:08.779251", "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", "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-08-20T22:04:08.794088Z", "iopub.status.busy": "2025-08-20T22:04:08.793860Z", "iopub.status.idle": "2025-08-20T22:04:08.803954Z", "shell.execute_reply": "2025-08-20T22:04:08.803571Z" }, "papermill": { "duration": 0.012461, "end_time": "2025-08-20T22:04:08.804498", "exception": false, "start_time": "2025-08-20T22:04:08.792037", "status": "completed" }, "slideshow": { "slide_type": "" }, "tags": [ "hide-input" ] }, "outputs": [ { "data": { "text/html": [ "Full ADF output" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "adf_comparison_name = f\"{case_name}_{case_year_range[0]}_{case_year_range[1]}_vs_{base_case_name}_{base_case_year_range[0]}_{base_case_year_range[1]}\"\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.001537, "end_time": "2025-08-20T22:04:08.807649", "exception": false, "start_time": "2025-08-20T22:04:08.806112", "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-08-20T22:04:08.811284Z", "iopub.status.busy": "2025-08-20T22:04:08.811097Z", "iopub.status.idle": "2025-08-20T22:04:08.815453Z", "shell.execute_reply": "2025-08-20T22:04:08.815121Z" }, "papermill": { "duration": 0.007365, "end_time": "2025-08-20T22:04:08.816564", "exception": false, "start_time": "2025-08-20T22:04:08.809199", "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-08-20T22:04:08.821357Z", "iopub.status.busy": "2025-08-20T22:04:08.821173Z", "iopub.status.idle": "2025-08-20T22:04:08.826220Z", "shell.execute_reply": "2025-08-20T22:04:08.825820Z" }, "papermill": { "duration": 0.007897, "end_time": "2025-08-20T22:04:08.827027", "exception": false, "start_time": "2025-08-20T22:04:08.819130", "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": 4.551764, "end_time": "2025-08-20T22:04:09.043576", "exception": null, "input_path": "/glade/derecho/scratch/hannay/tmp/tmp1tq99nc8.ipynb", "output_path": "/glade/work/hannay/CUPiD/examples/key_metrics/computed_notebooks/atm/link_to_ADF.ipynb", "parameters": { "CESM_output_dir": "/glade/derecho/scratch/hannay/archive", "adf_root": "../../examples/key_metrics/ADF_output/", "base_case_name": "b.e30_beta06.B1850C_LTso.ne30_t232_wgx3.188", "base_case_output_dir": "/glade/derecho/scratch/gmarques/archive", "base_end_date": "0021-12-01", "base_start_date": "0002-01-01", "case_name": "b.e30_beta06.B1850C_LTso.ne30_t232_wgx3.192", "end_date": "0021-12-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/work/hannay/CUPiD/examples/key_metrics/computed_notebooks//atm/link_to_ADF.ipynb", "serial": true, "start_date": "0002-01-01", "subset_kwargs": {}, "ts_dir": null }, "start_time": "2025-08-20T22:04:04.491812" } }, "nbformat": 4, "nbformat_minor": 5 }