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

roll back docs changes, add missing dependency for example.ipynb #1925

Merged
merged 1 commit into from
Sep 16, 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
2 changes: 0 additions & 2 deletions docs/notebooks/analogs.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
"source": [
"sim = open_dataset(\n",
" \"SpatialAnalogs/CanESM2_ScenGen_Chibougamau_2041-2070.nc\",\n",
" branch=\"v2023.12.14\",\n",
" decode_timedelta=False,\n",
")\n",
"sim"
Expand All @@ -74,7 +73,6 @@
"source": [
"obs = open_dataset(\n",
" \"SpatialAnalogs/NRCAN_SECan_1981-2010.nc\",\n",
" branch=\"v2023.12.14\",\n",
" decode_timedelta=False,\n",
")\n",
"obs"
Expand Down
2 changes: 1 addition & 1 deletion docs/notebooks/extendxclim.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@
"source": [
"from xclim.testing import open_dataset\n",
"\n",
"ds = open_dataset(\"ERA5/daily_surface_cancities_1990-1993.nc\", branch=\"v2023.12.14\")\n",
"ds = open_dataset(\"ERA5/daily_surface_cancities_1990-1993.nc\")\n",
"with xr.set_options(keep_attrs=True):\n",
" ds2 = ds.assign(\n",
" pr_per=xc.core.calendar.percentile_doy(ds.pr, window=5, per=75).isel(\n",
Expand Down
28 changes: 8 additions & 20 deletions docs/notebooks/sdba-advanced.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -436,10 +436,10 @@
"\n",
"group = sdba.Grouper(\"time.dayofyear\", window=31)\n",
"\n",
"dref = convert_calendar(\n",
" open_dataset(\"sdba/ahccd_1950-2013.nc\", branch=\"v2023.12.14\"), \"noleap\"\n",
").sel(time=slice(\"1981\", \"2010\"))\n",
"dsim = open_dataset(\"sdba/CanESM2_1950-2100.nc\", branch=\"v2023.12.14\")\n",
"dref = convert_calendar(open_dataset(\"sdba/ahccd_1950-2013.nc\"), \"noleap\").sel(\n",
" time=slice(\"1981\", \"2010\")\n",
")\n",
"dsim = open_dataset(\"sdba/CanESM2_1950-2100.nc\")\n",
"\n",
"dref = dref.assign(\n",
" tasmax=convert_units_to(dref.tasmax, \"K\"),\n",
Expand Down Expand Up @@ -755,20 +755,10 @@
"from xclim.testing import open_dataset\n",
"\n",
"# load test data\n",
"hist = (\n",
" open_dataset(\"sdba/CanESM2_1950-2100.nc\", branch=\"v2023.12.14\")\n",
" .sel(time=slice(\"1950\", \"1980\"))\n",
" .tasmax\n",
")\n",
"ref = (\n",
" open_dataset(\"sdba/nrcan_1950-2013.nc\", branch=\"v2023.12.14\")\n",
" .sel(time=slice(\"1950\", \"1980\"))\n",
" .tasmax\n",
")\n",
"hist = open_dataset(\"sdba/CanESM2_1950-2100.nc\").sel(time=slice(\"1950\", \"1980\")).tasmax\n",
"ref = open_dataset(\"sdba/nrcan_1950-2013.nc\").sel(time=slice(\"1950\", \"1980\")).tasmax\n",
"sim = (\n",
" open_dataset(\"sdba/CanESM2_1950-2100.nc\", branch=\"v2023.12.14\")\n",
" .sel(time=slice(\"1980\", \"2010\"))\n",
" .tasmax\n",
" open_dataset(\"sdba/CanESM2_1950-2100.nc\").sel(time=slice(\"1980\", \"2010\")).tasmax\n",
") # biased\n",
"\n",
"# learn the bias in historical simulation compared to reference\n",
Expand All @@ -779,9 +769,7 @@
"# correct the bias in the future\n",
"scen = QM.adjust(sim, extrapolation=\"constant\", interp=\"nearest\")\n",
"ref_future = (\n",
" open_dataset(\"sdba/nrcan_1950-2013.nc\", branch=\"v2023.12.14\")\n",
" .sel(time=slice(\"1980\", \"2010\"))\n",
" .tasmax\n",
" open_dataset(\"sdba/nrcan_1950-2013.nc\").sel(time=slice(\"1980\", \"2010\")).tasmax\n",
") # truth\n",
"\n",
"plt.figure(figsize=(15, 5))\n",
Expand Down
10 changes: 4 additions & 6 deletions docs/notebooks/sdba.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -459,9 +459,9 @@
"from xclim.core.units import convert_units_to\n",
"from xclim.testing import open_dataset\n",
"\n",
"dref = open_dataset(\n",
" \"sdba/ahccd_1950-2013.nc\", branch=\"v2023.12.14\", drop_variables=[\"lat\", \"lon\"]\n",
").sel(time=slice(\"1981\", \"2010\"))\n",
"dref = open_dataset(\"sdba/ahccd_1950-2013.nc\", drop_variables=[\"lat\", \"lon\"]).sel(\n",
" time=slice(\"1981\", \"2010\")\n",
")\n",
"\n",
"# Fix the standard name of the `pr` variable.\n",
"# This allows the convert_units_to below to infer the correct CF transformation (precip rate to flux)\n",
Expand All @@ -472,9 +472,7 @@
" tasmax=convert_units_to(dref.tasmax, \"K\"),\n",
" pr=convert_units_to(dref.pr, \"kg m-2 s-1\"),\n",
")\n",
"dsim = open_dataset(\n",
" \"sdba/CanESM2_1950-2100.nc\", branch=\"v2023.12.14\", drop_variables=[\"lat\", \"lon\"]\n",
")\n",
"dsim = open_dataset(\"sdba/CanESM2_1950-2100.nc\", drop_variables=[\"lat\", \"lon\"])\n",
"\n",
"dhist = dsim.sel(time=slice(\"1981\", \"2010\"))\n",
"dsim = dsim.sel(time=slice(\"2041\", \"2070\"))\n",
Expand Down
2 changes: 1 addition & 1 deletion docs/notebooks/units.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
"metadata": {},
"outputs": [],
"source": [
"ds = open_dataset(\"ERA5/daily_surface_cancities_1990-1993.nc\", branch=\"v2023.12.14\")\n",
"ds = open_dataset(\"ERA5/daily_surface_cancities_1990-1993.nc\")\n",
"ds.pr.attrs"
]
},
Expand Down
1 change: 1 addition & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ dependencies:
- nbsphinx
- nbval >=0.11.0
- nc-time-axis >=1.4.1
- netcdf4 # Required for some Jupyter notebooks
- notebook
- pandas-stubs >=2.2
- pooch >=1.8.0
Expand Down
1 change: 0 additions & 1 deletion tests/test_testing_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ def file_md5_checksum(f_name):
hash_md5.update(f.read())
return hash_md5.hexdigest()


@pytest.mark.requires_internet
def test_open_testdata(
self,
Expand Down