Skip to content

Commit

Permalink
Add the ADF comparison table to notebook
Browse files Browse the repository at this point in the history
ADF stores the data for its comparison table in a CSV file, so we can import
pandas and then use display(HTML(df.to_html())) to get it rendered properly in
the notebook.

Also cleaned up the hist_str for time series in external_diag_packages
  • Loading branch information
mnlevy1981 committed Dec 5, 2024
1 parent 90713d7 commit 02cb0ce
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
2 changes: 1 addition & 1 deletion examples/external_diag_packages/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ timeseries:
atm:
vars: ['PSL']
derive_vars: []
hist_str: 'h0a'
hist_str: 'cam.h0a'
start_years: [1,1]
end_years: [100,100]
level: 'lev'
Expand Down
28 changes: 26 additions & 2 deletions nblibrary/atm/link_to_ADF.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@
"outputs": [],
"source": [
"import os\n",
"\n",
"from IPython.core.display import HTML, Image\n",
"from IPython.display import display"
"from IPython.display import display\n",
"import pandas as pd"
]
},
{
Expand Down Expand Up @@ -144,7 +146,29 @@
"metadata": {},
"source": [
"## Key Metrics from ADF\n",
"These will eventually be put in the key_metrics example, but are a proof of concept of including individual plots from ADF directly linked in the JupyterBook."
"\n",
"Some important things to look at from ADF include a comparison table and a few maps:"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "a5b02451-98ad-4089-b184-75391a262db3",
"metadata": {
"editable": true,
"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)))"
]
},
{
Expand Down

0 comments on commit 02cb0ce

Please sign in to comment.