Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: Fix api changes in intake-esgf #81

Merged
merged 2 commits into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ dependencies:
- jupyterlab
- jupyter_server
- globus-compute-sdk
- ipywidgets
- pip
- sphinx-pythia-theme
- ipywidgets
Expand Down
26 changes: 18 additions & 8 deletions notebooks/example-workflows/enso-esgf.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@
" source_id=\"CESM2\",\n",
" variable_id=[\"tos\"],\n",
" member_id='r11i1p1f1',\n",
" grid_label=\"gn\",\n",
" table_id=\"Omon\",\n",
" )"
]
Expand All @@ -129,18 +130,30 @@
},
"outputs": [],
"source": [
"tos_tree = cat.to_datatree()\n",
"tos_tree = cat.to_dataset_dict()\n",
"tos_tree"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "3694d7de-3b75-4e25-8001-1fa5c7877f53",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"tos_tree[]"
]
},
{
"cell_type": "markdown",
"id": "5395c611-afda-405e-9b1c-35b7566c557f",
"metadata": {
"tags": []
},
"source": [
"The nodes in the tree represent two different, grids. We would like to stay on the native model grid, using the `gn` node of the datatree, which represents the model native grid data."
"There is only one variable in this dictionary of datasets, `tos`, which is the \"Sea Surface Temperature\". We can extract this dataset by passing in that key:"
]
},
{
Expand All @@ -152,7 +165,7 @@
},
"outputs": [],
"source": [
"ds = tos_tree[\"gn\"].to_dataset()\n",
"ds = tos_tree[\"tos\"]\n",
"ds"
]
},
Expand Down Expand Up @@ -373,16 +386,13 @@
" activity_id=\"CMIP\",\n",
" experiment_id=\"historical\",\n",
" institution_id=institution_id,\n",
" grid_label=grid,\n",
" variable_id=[\"tos\"],\n",
" member_id='r11i1p1f1',\n",
" table_id=\"Omon\",\n",
" )\n",
" try:\n",
" tos_ds = cat.to_datatree()[grid].to_dataset()\n",
" except KeyError:\n",
" tos_ds = cat.to_dataset_dict()[\"tos\"]\n",
"\n",
" return tos_ds"
" return cat.to_dataset_dict()[\"tos\"]"
]
},
{
Expand Down