From 3748b16090d8abc02f32f535ca7c278f048969f1 Mon Sep 17 00:00:00 2001 From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com> Date: Mon, 16 Sep 2024 14:09:07 -0400 Subject: [PATCH] roll back docs changes, add missing dependency for example.ipynb --- docs/notebooks/analogs.ipynb | 2 -- docs/notebooks/extendxclim.ipynb | 2 +- docs/notebooks/sdba-advanced.ipynb | 28 ++++++++-------------------- docs/notebooks/sdba.ipynb | 10 ++++------ docs/notebooks/units.ipynb | 2 +- environment.yml | 1 + tests/test_testing_utils.py | 1 - 7 files changed, 15 insertions(+), 31 deletions(-) diff --git a/docs/notebooks/analogs.ipynb b/docs/notebooks/analogs.ipynb index 30ee5da60..06603902b 100644 --- a/docs/notebooks/analogs.ipynb +++ b/docs/notebooks/analogs.ipynb @@ -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" @@ -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" diff --git a/docs/notebooks/extendxclim.ipynb b/docs/notebooks/extendxclim.ipynb index c91c2cedb..8293e3ba5 100644 --- a/docs/notebooks/extendxclim.ipynb +++ b/docs/notebooks/extendxclim.ipynb @@ -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", diff --git a/docs/notebooks/sdba-advanced.ipynb b/docs/notebooks/sdba-advanced.ipynb index 3a55f56d4..0e7b32e32 100644 --- a/docs/notebooks/sdba-advanced.ipynb +++ b/docs/notebooks/sdba-advanced.ipynb @@ -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", @@ -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", @@ -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", diff --git a/docs/notebooks/sdba.ipynb b/docs/notebooks/sdba.ipynb index a7dcc887f..037c58247 100644 --- a/docs/notebooks/sdba.ipynb +++ b/docs/notebooks/sdba.ipynb @@ -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", @@ -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", diff --git a/docs/notebooks/units.ipynb b/docs/notebooks/units.ipynb index c4e107db9..9b0ea7ed6 100644 --- a/docs/notebooks/units.ipynb +++ b/docs/notebooks/units.ipynb @@ -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" ] }, diff --git a/environment.yml b/environment.yml index 9a7c4ea35..b6573e620 100644 --- a/environment.yml +++ b/environment.yml @@ -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 diff --git a/tests/test_testing_utils.py b/tests/test_testing_utils.py index 9b65a2f2c..6fb5d2dd1 100644 --- a/tests/test_testing_utils.py +++ b/tests/test_testing_utils.py @@ -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,