{ "cells": [ { "cell_type": "markdown", "id": "623cbc23-45bf-4dfd-9f49-8d814d0394ba", "metadata": { "papermill": { "duration": 0.002234, "end_time": "2025-10-10T23:07:43.364176", "exception": false, "start_time": "2025-10-10T23:07:43.361942", "status": "completed" }, "tags": [] }, "source": [ "# Link to LDF output\n", "\n", "The output from the stand-alone LDF configuration is in the link below\n", "\n", "\n", "Note that LDF is currently run by users. Temporarily, we suggest users walk through the following process:\n", "1) Install LDF and activate cupid-analysis\n", "2) Use the `CUPiD/helper_scripts/generate_ldf_config_file.py` script to generate a LDF config file based on a CUPiD configuration file.\n", " * `cd CUPiD/examples/external_diag_packages`\n", " * `../../helper_scripts/generate_ldf_config_file.py --cupid-config-loc . --ldf-template ../../externals/LDF/config_clm_unstructured_plots.yaml --out-file LDF_config.yaml`\n", "2) Run LDF with the newly created configuration file.\n", " * `../../externals/LDF/run_adf_diag LDF_config.yaml`" ] }, { "cell_type": "code", "execution_count": 1, "id": "82af7435-3849-4fd1-bb2d-2e062719ec5b", "metadata": { "editable": true, "execution": { "iopub.execute_input": "2025-10-10T23:07:43.369274Z", "iopub.status.busy": "2025-10-10T23:07:43.369045Z", "iopub.status.idle": "2025-10-10T23:07:46.071802Z", "shell.execute_reply": "2025-10-10T23:07:46.071315Z" }, "papermill": { "duration": 2.706462, "end_time": "2025-10-10T23:07:46.072803", "exception": false, "start_time": "2025-10-10T23:07:43.366341", "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-10-10T23:07:46.077891Z", "iopub.status.busy": "2025-10-10T23:07:46.077633Z", "iopub.status.idle": "2025-10-10T23:07:46.080389Z", "shell.execute_reply": "2025-10-10T23:07:46.080006Z" }, "papermill": { "duration": 0.005915, "end_time": "2025-10-10T23:07:46.080992", "exception": false, "start_time": "2025-10-10T23:07:46.075077", "status": "completed" }, "slideshow": { "slide_type": "" }, "tags": [ "parameters", "hide-cell" ] }, "outputs": [], "source": [ "ldf_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", "# ldf_root will be external_diag_packages/computed_notebooks/LDF/" ] }, { "cell_type": "code", "execution_count": 3, "id": "a9598188", "metadata": { "execution": { "iopub.execute_input": "2025-10-10T23:07:46.085314Z", "iopub.status.busy": "2025-10-10T23:07:46.085136Z", "iopub.status.idle": "2025-10-10T23:07:46.093010Z", "shell.execute_reply": "2025-10-10T23:07:46.092600Z" }, "papermill": { "duration": 0.011056, "end_time": "2025-10-10T23:07:46.093914", "exception": false, "start_time": "2025-10-10T23:07:46.082858", "status": "completed" }, "tags": [ "injected-parameters" ] }, "outputs": [], "source": [ "# Parameters\n", "case_name = \"b.e30_beta02.BLT1850.ne30_t232.104\"\n", "base_case_name = \"b.e23_alpha17f.BLT1850.ne30_t232.092\"\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 = \"0101-01-01\"\n", "base_start_date = \"0001-01-01\"\n", "base_end_date = \"0101-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", "ldf_root = \"../../examples/key_metrics/LDF_output/\"\n", "key_plots = [\n", " \"GPP_ANN_LatLon_Mean.png\",\n", " \"ELAI_ANN_LatLon_Mean.png\",\n", " \"TOTECOSYSC_GlobalMean_ANN_TimeSeries_Mean.png\",\n", " \"RegionalClimo_Amazonia_RegionalClimo_Mean.png\",\n", "]\n", "subset_kwargs = {}\n", "product = \"/glade/work/richling/CUPid_pr_test/CUPiD/examples/key_metrics/computed_notebooks//lnd/link_to_LDF.ipynb\"\n" ] }, { "cell_type": "code", "execution_count": 4, "id": "81bf4573-8806-486f-a2f6-79e244415c07", "metadata": { "editable": true, "execution": { "iopub.execute_input": "2025-10-10T23:07:46.099341Z", "iopub.status.busy": "2025-10-10T23:07:46.099155Z", "iopub.status.idle": "2025-10-10T23:07:46.106248Z", "shell.execute_reply": "2025-10-10T23:07:46.105762Z" }, "papermill": { "duration": 0.010552, "end_time": "2025-10-10T23:07:46.107181", "exception": false, "start_time": "2025-10-10T23:07:46.096629", "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-10-10T23:07:46.111933Z", "iopub.status.busy": "2025-10-10T23:07:46.111752Z", "iopub.status.idle": "2025-10-10T23:07:46.119450Z", "shell.execute_reply": "2025-10-10T23:07:46.118811Z" }, "papermill": { "duration": 0.011092, "end_time": "2025-10-10T23:07:46.120369", "exception": false, "start_time": "2025-10-10T23:07:46.109277", "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-10-10T23:07:46.125282Z", "iopub.status.busy": "2025-10-10T23:07:46.125068Z", "iopub.status.idle": "2025-10-10T23:07:46.133628Z", "shell.execute_reply": "2025-10-10T23:07:46.133124Z" }, "papermill": { "duration": 0.012054, "end_time": "2025-10-10T23:07:46.134469", "exception": false, "start_time": "2025-10-10T23:07:46.122415", "status": "completed" }, "slideshow": { "slide_type": "" }, "tags": [ "hide-input" ] }, "outputs": [ { "data": { "text/html": [ "Full LDF output" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "ldf_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", "ldf_root = os.path.join(ldf_root, ldf_comparison_name)\n", "display(\n", " HTML(\n", " f'Full LDF output'\n", " )\n", ")" ] }, { "cell_type": "markdown", "id": "f9234aec-1fe5-4bbf-ad6c-fb565297afbe", "metadata": { "papermill": { "duration": 0.002063, "end_time": "2025-10-10T23:07:46.138796", "exception": false, "start_time": "2025-10-10T23:07:46.136733", "status": "completed" }, "tags": [] }, "source": [ "## Key Metrics from LDF\n", "\n", "Some important things to look at from LDF 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-10-10T23:07:46.143746Z", "iopub.status.busy": "2025-10-10T23:07:46.143456Z", "iopub.status.idle": "2025-10-10T23:07:46.223884Z", "shell.execute_reply": "2025-10-10T23:07:46.223380Z" }, "papermill": { "duration": 0.083906, "end_time": "2025-10-10T23:07:46.224688", "exception": false, "start_time": "2025-10-10T23:07:46.140782", "status": "completed" }, "slideshow": { "slide_type": "" }, "tags": [ "hide-input" ] }, "outputs": [ { "data": { "text/html": [ "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
variableunittestcontroldiff
TSAK281.593281.916-0.323
PRECmm d$^{-1}$2.4122.3920.02
ELAIm${-2}$ m${-2}$1.481.4710.009
FSDSW m$^{-2}$198.272200.666-2.394
FLDSW m$^{-2}$299.518302.207-2.689
ASA% reflected28.18628.1860
RNETW m$^{-2}$71.01873.295-2.277
FSHW m$^{-2}$30.60832.922-2.314
ETW m$^{-2}$39.6439.5920.048
FCTRW m$^{-2}$19.77319.957-0.184
FGEVW m$^{-2}$12.45912.2030.256
FCEVW m$^{-2}$7.4087.431-0.023
QRUNOFF_TO_COUPLERmm d$^{-1}$0.9950.9740.021
SNOWDPm2.2232.241-0.018
GPPPgC y$^{-1}$110.783110.926-0.143
NPPPgC y$^{-1}$47.12247.0360.086
NEEPgC y$^{-1}$-0.678-0.553-0.125
NBPPgC y$^{-1}$0.1360.03060.105
BTRANMNunitless0.5740.5740
TOTVEGCPgC741.471722.48118.99
TOTECOSYSCgC/m^216462.916592-129.106
TOTSOMC_1mPgC1001.851026.08-24.231
ALTMAXm35.22634.6920.534
FAREA_BURNEDs-11.58e-091.68e-09-1e-10
DSTFLXTPg y$^{-1}$48.34646.9161.43
MEG_isopreneTg y$^{-1}$554.114564.054-9.94
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "comparison_table = os.path.join(ldf_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-10-10T23:07:46.230846Z", "iopub.status.busy": "2025-10-10T23:07:46.230613Z", "iopub.status.idle": "2025-10-10T23:07:46.233966Z", "shell.execute_reply": "2025-10-10T23:07:46.233506Z" }, "papermill": { "duration": 0.007215, "end_time": "2025-10-10T23:07:46.234766", "exception": false, "start_time": "2025-10-10T23:07:46.227551", "status": "completed" }, "slideshow": { "slide_type": "" }, "tags": [ "hide-input" ] }, "outputs": [], "source": [ "for path_to_key_plot in key_plots:\n", " full_path = os.path.join(ldf_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.142344, "end_time": "2025-10-10T23:07:46.553530", "exception": null, "input_path": "/glade/derecho/scratch/richling/tmp/tmptbdcjcfv.ipynb", "output_path": "/glade/work/richling/CUPid_pr_test/CUPiD/examples/key_metrics/computed_notebooks/lnd/link_to_LDF.ipynb", "parameters": { "CESM_output_dir": "/glade/campaign/cesm/development/cross-wg/diagnostic_framework/CESM_output_for_testing", "base_case_name": "b.e23_alpha17f.BLT1850.ne30_t232.092", "base_end_date": "0101-01-01", "base_start_date": "0001-01-01", "case_name": "b.e30_beta02.BLT1850.ne30_t232.104", "end_date": "0101-01-01", "key_plots": [ "GPP_ANN_LatLon_Mean.png", "ELAI_ANN_LatLon_Mean.png", "TOTECOSYSC_GlobalMean_ANN_TimeSeries_Mean.png", "RegionalClimo_Amazonia_RegionalClimo_Mean.png" ], "lc_kwargs": { "threads_per_worker": 1 }, "ldf_root": "../../examples/key_metrics/LDF_output/", "obs_data_dir": "/glade/campaign/cesm/development/cross-wg/diagnostic_framework/CUPiD_obs_data", "product": "/glade/work/richling/CUPid_pr_test/CUPiD/examples/key_metrics/computed_notebooks//lnd/link_to_LDF.ipynb", "serial": false, "start_date": "0001-01-01", "subset_kwargs": {}, "ts_dir": null }, "start_time": "2025-10-10T23:07:42.411186" } }, "nbformat": 4, "nbformat_minor": 5 }