Sync from SUSE:SLFO:Main python-xarray revision b8f0f40ce5432645e4d1940043cf846c

This commit is contained in:
Adrian Schröter 2024-05-03 23:32:49 +02:00
commit 359598ed1f
6 changed files with 3201 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

20
local_dataset.patch Normal file
View File

@ -0,0 +1,20 @@
---
xarray/tutorial.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
Index: xarray-2023.8.0/xarray/tutorial.py
===================================================================
--- xarray-2023.8.0.orig/xarray/tutorial.py
+++ xarray-2023.8.0/xarray/tutorial.py
@@ -157,7 +157,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()

2989
python-xarray.changes Normal file

File diff suppressed because it is too large Load Diff

128
python-xarray.spec Normal file
View File

@ -0,0 +1,128 @@
#
# spec file for package python-xarray
#
# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%{?sle15_python_module_pythons}
Name: python-xarray
Version: 2023.8.0
Release: 0
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 xarray-pr8139-pandas-fill_value.patch gh#pydata/xarray#8125, gh#pydata/xarray#8139
Patch1: https://github.com/pydata/xarray/pull/8139.patch#/xarray-pr8139-pandas-fill_value.patch
BuildRequires: %{python_module base >= 3.9}
BuildRequires: %{python_module numpy-devel >= 1.20}
BuildRequires: %{python_module packaging >= 21.3}
BuildRequires: %{python_module pandas >= 1.3}
BuildRequires: %{python_module pip}
BuildRequires: %{python_module setuptools_scm}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module wheel}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: python-numpy >= 1.22
Requires: python-packaging >= 21.3
Requires: python-pandas >= 1.4
Provides: python-xray = %{version}
Obsoletes: python-xray < %{version}
BuildArch: noarch
# SECTION extras accel
Recommends: python-scipy
Recommends: python-bottleneck
Recommends: python-flox
Recommends: python-numbagg
# /SECTION
# SECTION extras parallalel
Suggests: python-dask-complete
# /SECTION
# SECTION extras viz
Suggests: python-matplotlib
Suggests: python-seaborn
Suggests: python-nc-time-axis
#/SECTION
# SECTION extras io
Suggests: python-netCDF4
Suggests: python-h5netcdf
Suggests: (python-pydap if python-base < 3.10)
Suggests: python-zarr
Suggests: python-fsspec
Suggests: python-cftime
Suggests: python-rasterio
Suggests: python-cfgrib
Suggests: python-pooch
#/SECTION
# SECTION tests
BuildRequires: %{python_module Bottleneck}
BuildRequires: %{python_module dask-dataframe}
BuildRequires: %{python_module dask-diagnostics}
BuildRequires: %{python_module h5netcdf}
BuildRequires: %{python_module matplotlib}
BuildRequires: %{python_module netCDF4}
BuildRequires: %{python_module pooch}
BuildRequires: %{python_module pytest-xdist}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module scipy}
BuildRequires: %{python_module zarr}
# /SECTION
%python_subpackages
%description
xarray (formerly xray) is a python-pandas-like and pandas-compatible
toolkit for analytics on multi-dimensional arrays. It provides
N-dimensional variants of the python-pandas labeled data structures,
rather than the tabular data that pandas uses.
The Common Data Model for self-describing scientific data is used.
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
%pyproject_wheel
%install
%pyproject_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%check
# obs file open race conditions?
donttest="(test_open_mfdataset_manyfiles and (h5netcdf or netCDF4))"
if [ $(getconf LONG_BIT) -eq 32 ]; then
# https://github.com/pydata/xarray/issues/5341
# https://github.com/pydata/xarray/issues/5375
# still precision problems in 2022.11.0
donttest="$donttest or (test_interpolate_chunk_advanced and linear)"
# tests for 64bit types
donttest="$donttest or TestZarrDictStore or TestZarrDirectoryStore or TestZarrWriteEmpty"
fi
%pytest -n auto -rsEf -k "not ($donttest)" xarray
%files %{python_files}
%doc README.md
%license LICENSE licenses/
%{python_sitelib}/xarray
%{python_sitelib}/xarray-%{version}.dist-info
%changelog

BIN
xarray-2023.8.0.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,38 @@
From 3e48312c41cb26bbd4dc83ae286444f1469b7aa2 Mon Sep 17 00:00:00 2001
From: Maximilian Roos <m@maxroos.com>
Date: Fri, 1 Sep 2023 19:41:41 -0700
Subject: [PATCH] Fix pandas interpolate(fill_value=) error
Pandas no longer has a `fill_value` parameter for `interpolate`.
Weirdly I wasn't getting this locally, on pandas 2.1.0, only in CI on https://github.com/pydata/xarray/actions/runs/6054400455/job/16431747966?pr=8138.
Removing it passes locally, let's see whether this works in CI
---
xarray/tests/test_missing.py | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/xarray/tests/test_missing.py b/xarray/tests/test_missing.py
index a6b6b1f80c..c303659116 100644
--- a/xarray/tests/test_missing.py
+++ b/xarray/tests/test_missing.py
@@ -104,7 +104,8 @@ def test_interpolate_pd_compat():
for dim in ["time", "x"]:
actual = da.interpolate_na(method=method, dim=dim, fill_value=np.nan)
expected = df.interpolate(
- method=method, axis=da.get_axis_num(dim), fill_value=(np.nan, np.nan)
+ method=method,
+ axis=da.get_axis_num(dim),
)
# Note, Pandas does some odd things with the left/right fill_value
# for the linear methods. This next line inforces the xarray
@@ -140,7 +141,8 @@ def test_interpolate_pd_compat_non_uniform_index():
method="linear", dim=dim, use_coordinate=True, fill_value=np.nan
)
expected = df.interpolate(
- method=method, axis=da.get_axis_num(dim), fill_value=np.nan
+ method=method,
+ axis=da.get_axis_num(dim),
)
# Note, Pandas does some odd things with the left/right fill_value