Skip to content

Commit

Permalink
explicit nimbus function
Browse files Browse the repository at this point in the history
  • Loading branch information
RondeauG committed Nov 19, 2024
1 parent 5c40c98 commit 71f6dda
Showing 1 changed file with 29 additions and 4 deletions.
33 changes: 29 additions & 4 deletions docs/notebooks/4_ensembles.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,41 @@
"This tutorial will explore ensemble reduction (also known as ensemble selection) using `xscen`. This will use pre-computed annual mean temperatures from `xclim.testing`."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# from xclim.testing.utils import nimbus\n",
"from pathlib import Path\n",
"from urllib.parse import urljoin\n",
"\n",
"import pooch\n",
"from xclim.testing.utils import load_registry\n",
"\n",
"\n",
"def nimbus():\n",
" repo = \"https://raw.githubusercontent.com/Ouranosinc/xclim-testdata\"\n",
" branch = \"v2024.8.23\"\n",
" remote = urljoin(urljoin(repo, branch), \"data\")\n",
" return pooch.create(\n",
" path=Path(pooch.os_cache(\"xclim-testdata\")),\n",
" base_url=remote,\n",
" version=branch,\n",
" version_dev=branch,\n",
" allow_updates=True,\n",
" registry=load_registry(branch=branch, repo=repo),\n",
" )"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import xarray as xr\n",
"from xclim.testing.utils import nimbus\n",
"\n",
"import xscen as xs\n",
"\n",
Expand All @@ -54,9 +81,7 @@
"}\n",
"\n",
"for d in datasets:\n",
" file = nimbus(\n",
" repo=\"https://raw.githubusercontent.com/Ouranosinc/xclim-testdata\"\n",
" ).fetch(datasets[d])\n",
" file = nimbus().fetch(datasets[d])\n",
" ds = xr.open_dataset(file).isel(lon=slice(0, 4), lat=slice(0, 4))\n",
" ds = xs.climatological_op(\n",
" ds,\n",
Expand Down

0 comments on commit 71f6dda

Please sign in to comment.