1
0
forked from pool/python-xarray

Accepting request 895529 from home:mcepl:branches:devel:languages:python:numeric

- Add local_dataset.patch allowing the use of the cached datasets
  (gh#pydata/xarray#5377).
- Add scipy-interpolate.patch adding a missing import
  scipy.interpolate to test_interp.py (gh#pydata/xarray#5375).
- Add test_resample_loffset.patch to fix test_resample_loffset
  test (gh#pydata/xarray#5364).

OBS-URL: https://build.opensuse.org/request/show/895529
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-xarray?expand=0&rev=53
This commit is contained in:
Sebastian Wagner 2021-05-27 06:19:25 +00:00 committed by Git OBS Bridge
parent 18833ec076
commit 15f5c83eeb
5 changed files with 68 additions and 0 deletions

18
local_dataset.patch Normal file
View File

@ -0,0 +1,18 @@
---
xarray/tutorial.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
--- a/xarray/tutorial.py
+++ b/xarray/tutorial.py
@@ -139,7 +139,10 @@ def open_dataset(
url = f"{base_url}/raw/{version}/{path.name}"
# retrieve the file
- filepath = pooch.retrieve(url=url, known_hash=None, path=cache_dir)
+ fname = pathlib.Path(cache_dir, path).expanduser()
+ if not fname.exists():
+ fname = None
+ filepath = pooch.retrieve(url=url, fname=fname, known_hash=None, path=cache_dir)
ds = _open_dataset(filepath, engine=engine, **kws)
if not cache:
ds = ds.load()

View File

@ -1,3 +1,13 @@
-------------------------------------------------------------------
Tue May 25 17:25:46 UTC 2021 - Matej Cepl <mcepl@suse.com>
- Add local_dataset.patch allowing the use of the cached datasets
(gh#pydata/xarray#5377).
- Add scipy-interpolate.patch adding a missing import
scipy.interpolate to test_interp.py (gh#pydata/xarray#5375).
- Add test_resample_loffset.patch to fix test_resample_loffset
test (gh#pydata/xarray#5364).
-------------------------------------------------------------------
Thu May 20 11:58:50 UTC 2021 - Sebastian Wagner <sebix+novell.com@sebix.at>

View File

@ -27,6 +27,15 @@ Summary: N-D labeled arrays and datasets in Python
License: Apache-2.0
URL: https://github.com/pydata/xarray
Source: https://files.pythonhosted.org/packages/source/x/xarray/xarray-%{version}.tar.gz
# PATCH-FEATURE-UPSTREAM local_dataset.patch gh#pydata/xarray#5377 mcepl@suse.com
# fix xr.tutorial.open_dataset to work with the preloaded cache.
Patch0: local_dataset.patch
# PATCH-FIX-UPSTREAM scipy-interpolate.patch gh#pydata/xarray#5375 mcepl@suse.com
# Add missing import scipy.interpolate
Patch1: scipy-interpolate.patch
# PATCH-FIX-UPSTREAM test_resample_loffset.patch gh#pydata/xarray#5364 mcepl@suse.com
# use assert_allclose in test_resample_loffset test
Patch2: test_resample_loffset.patch
BuildRequires: %{python_module numpy >= 1.15}
BuildRequires: %{python_module numpy-devel >= 1.14}
BuildRequires: %{python_module pandas >= 0.25}
@ -63,6 +72,7 @@ Suggests: python-cfgrib
#/SECTION
# SECTION tests
BuildRequires: %{python_module dask-dataframe}
BuildRequires: %{python_module pooch}
BuildRequires: %{python_module pytest-xdist}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module scipy}
@ -80,6 +90,7 @@ The dataset is an in-memory representation of a netCDF file.
%prep
%autosetup -p1 -n xarray-%{version}
chmod -x xarray/util/print_versions.py
%build

14
scipy-interpolate.patch Normal file
View File

@ -0,0 +1,14 @@
---
xarray/tests/test_interp.py | 1 +
1 file changed, 1 insertion(+)
--- a/xarray/tests/test_interp.py
+++ b/xarray/tests/test_interp.py
@@ -20,6 +20,7 @@ from .test_dataset import create_test_da
try:
import scipy
+ import scipy.interpolate
except ImportError:
pass

View File

@ -0,0 +1,15 @@
---
xarray/tests/test_dataset.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/xarray/tests/test_dataset.py
+++ b/xarray/tests/test_dataset.py
@@ -3988,7 +3988,7 @@ class TestDataset:
expected_ = ds.bar.to_series().resample("24H").mean()
expected_.index += to_offset("-12H")
expected = DataArray.from_series(expected_)
- assert_identical(actual, expected)
+ assert_allclose(actual, expected)
def test_resample_by_mean_discarding_attrs(self):
times = pd.date_range("2000-01-01", freq="6H", periods=10)