Compare commits
22 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
66c2059622 | ||
|
|
6e553d61be | ||
|
|
ffa3ac90cb | ||
|
|
68a87599ce | ||
|
|
c40c2b8108 | ||
|
|
7aca2e8d68 | ||
|
|
b4a8abb2fc | ||
|
|
4a8ca0c05d | ||
|
|
28752f8893 | ||
|
|
f24a6d1c9b | ||
|
|
362dcc1ead | ||
|
|
0d92610f0c | ||
|
|
e61d64d3e4 | ||
|
|
e75d5c9d07 | ||
|
|
3bebaa049c | ||
|
|
ad60aec436 | ||
|
|
dd372c6ddb | ||
|
|
f0dca5ea32 | ||
|
|
8294269fad | ||
|
|
ea961bf619 | ||
|
|
099f6f89e8 | ||
|
|
72b1741aac |
10
.gitignore
vendored
10
.gitignore
vendored
@@ -19,3 +19,13 @@
|
||||
/xarray-data-dbd07bb91a7112db0fd2f912c146999f9d436b0e.tar.gz
|
||||
/xarray-2022.6.0.tar.gz
|
||||
/xarray-data-86974d54ce83a130303fe8caa629e60deb3cb6e5.tar.gz
|
||||
/xarray-2023.1.0.tar.gz
|
||||
/xarray-2023.4.2.tar.gz
|
||||
/xarray-data-7d8290e0be9d2a8f4b4381641f20a97db6eaea3d.tar.gz
|
||||
/xarray-2023.7.0.tar.gz
|
||||
/xarray-2023.8.0.tar.gz
|
||||
/xarray-2023.9.0.tar.gz
|
||||
/xarray-2024.6.0.tar.gz
|
||||
/xarray-2024.7.0.tar.gz
|
||||
/xarray-2024.10.0.tar.gz
|
||||
/xarray-2025.1.1.tar.gz
|
||||
|
||||
18
.packit.yaml
Normal file
18
.packit.yaml
Normal file
@@ -0,0 +1,18 @@
|
||||
# See the documentation for more information:
|
||||
# https://packit.dev/docs/configuration/
|
||||
---
|
||||
jobs:
|
||||
- job: pull_from_upstream
|
||||
trigger: release
|
||||
dist_git_branches:
|
||||
rawhide:
|
||||
fast_forward_merge_into:
|
||||
- fedora-branched
|
||||
- job: koji_build
|
||||
trigger: commit
|
||||
dist_git_branches:
|
||||
- fedora-all
|
||||
- job: bodhi_update
|
||||
trigger: commit
|
||||
dist_git_branches:
|
||||
- fedora-all
|
||||
53
0001-Avoid-unsafe-casts-from-float-to-unsigned-int.patch
Normal file
53
0001-Avoid-unsafe-casts-from-float-to-unsigned-int.patch
Normal file
@@ -0,0 +1,53 @@
|
||||
From 33ab61521498550eda98d7aebc141635f9f218d7 Mon Sep 17 00:00:00 2001
|
||||
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
|
||||
Date: Sun, 19 Jan 2025 04:47:23 -0500
|
||||
Subject: [PATCH] Avoid unsafe casts from float to unsigned int
|
||||
|
||||
Fixes #9815
|
||||
|
||||
Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
|
||||
---
|
||||
xarray/coding/variables.py | 5 ++++-
|
||||
xarray/core/duck_array_ops.py | 10 ++++++++++
|
||||
2 files changed, 14 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/xarray/coding/variables.py b/xarray/coding/variables.py
|
||||
index 83112628..b036fd5d 100644
|
||||
--- a/xarray/coding/variables.py
|
||||
+++ b/xarray/coding/variables.py
|
||||
@@ -426,7 +426,10 @@ class CFMaskCoder(VariableCoder):
|
||||
if fill_value is not None and has_unsigned:
|
||||
pop_to(encoding, attrs, "_Unsigned")
|
||||
# XXX: Is this actually needed? Doesn't the backend handle this?
|
||||
- data = duck_array_ops.astype(duck_array_ops.around(data), dtype)
|
||||
+ signed_dtype = np.dtype(f"i{dtype.itemsize}")
|
||||
+ data = duck_array_ops.view(
|
||||
+ duck_array_ops.astype(duck_array_ops.around(data), signed_dtype), dtype
|
||||
+ )
|
||||
attrs["_FillValue"] = fill_value
|
||||
|
||||
return Variable(dims, data, attrs, encoding, fastpath=True)
|
||||
diff --git a/xarray/core/duck_array_ops.py b/xarray/core/duck_array_ops.py
|
||||
index c3f15980..1cec78cb 100644
|
||||
--- a/xarray/core/duck_array_ops.py
|
||||
+++ b/xarray/core/duck_array_ops.py
|
||||
@@ -236,6 +236,16 @@ def astype(data, dtype, **kwargs):
|
||||
return data.astype(dtype, **kwargs)
|
||||
|
||||
|
||||
+def view(data, *args, **kwargs):
|
||||
+ if hasattr(data, "__array_namespace__"):
|
||||
+ xp = get_array_namespace(data)
|
||||
+ if xp == np:
|
||||
+ # numpy currently doesn't have a view:
|
||||
+ return data.view(*args, **kwargs)
|
||||
+ return xp.view(data, *args, **kwargs)
|
||||
+ return data.view(*args, **kwargs)
|
||||
+
|
||||
+
|
||||
def asarray(data, xp=np, dtype=None):
|
||||
converted = data if is_duck_array(data) else xp.asarray(data)
|
||||
|
||||
--
|
||||
2.49.0
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
From 338e50f33a7d286f592a64278349f380f108340c Mon Sep 17 00:00:00 2001
|
||||
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
|
||||
Date: Fri, 15 Mar 2019 22:31:18 -0400
|
||||
Subject: [PATCH 1/3] DOC: Don't download RGB.byte.tif during build.
|
||||
|
||||
Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
|
||||
---
|
||||
doc/gallery/plot_rasterio.py | 2 +-
|
||||
doc/gallery/plot_rasterio_rgb.py | 2 +-
|
||||
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/doc/gallery/plot_rasterio.py b/doc/gallery/plot_rasterio.py
|
||||
index 853923a3..bc8b4421 100644
|
||||
--- a/doc/gallery/plot_rasterio.py
|
||||
+++ b/doc/gallery/plot_rasterio.py
|
||||
@@ -23,7 +23,7 @@ from pyproj import Transformer
|
||||
import xarray as xr
|
||||
|
||||
# Read the data
|
||||
-url = "https://github.com/rasterio/rasterio/raw/master/tests/data/RGB.byte.tif"
|
||||
+url = "RGB.byte.tif"
|
||||
da = xr.open_rasterio(url)
|
||||
|
||||
# Compute the lon/lat coordinates with pyproj
|
||||
diff --git a/doc/gallery/plot_rasterio_rgb.py b/doc/gallery/plot_rasterio_rgb.py
|
||||
index 912224ac..f2a7b2db 100644
|
||||
--- a/doc/gallery/plot_rasterio_rgb.py
|
||||
+++ b/doc/gallery/plot_rasterio_rgb.py
|
||||
@@ -18,7 +18,7 @@ import matplotlib.pyplot as plt
|
||||
import xarray as xr
|
||||
|
||||
# Read the data
|
||||
-url = "https://github.com/rasterio/rasterio/raw/master/tests/data/RGB.byte.tif"
|
||||
+url = "RGB.byte.tif"
|
||||
da = xr.open_rasterio(url)
|
||||
|
||||
# The data is in UTM projection. We have to set it manually until
|
||||
--
|
||||
2.36.1
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
From 09bf051c792f195465c7330b57be204605b88d2c Mon Sep 17 00:00:00 2001
|
||||
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
|
||||
Date: Fri, 15 Mar 2019 22:48:25 -0400
|
||||
Subject: [PATCH 2/3] DOC: Skip examples using unpackaged dependencies.
|
||||
|
||||
Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
|
||||
---
|
||||
doc/user-guide/io.rst | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/doc/user-guide/io.rst b/doc/user-guide/io.rst
|
||||
index beab5fc0..1109e578 100644
|
||||
--- a/doc/user-guide/io.rst
|
||||
+++ b/doc/user-guide/io.rst
|
||||
@@ -857,6 +857,7 @@ installed, xarray can convert a ``DataArray`` into a ``Cube`` using
|
||||
:py:meth:`DataArray.to_iris`:
|
||||
|
||||
.. ipython:: python
|
||||
+ :verbatim:
|
||||
|
||||
da = xr.DataArray(
|
||||
np.random.rand(4, 5),
|
||||
@@ -871,6 +872,7 @@ Conversely, we can create a new ``DataArray`` object from a ``Cube`` using
|
||||
:py:meth:`DataArray.from_iris`:
|
||||
|
||||
.. ipython:: python
|
||||
+ :verbatim:
|
||||
|
||||
da_cube = xr.DataArray.from_iris(cube)
|
||||
da_cube
|
||||
--
|
||||
2.36.1
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
From a0c1d288ae09cbe8055b4531dffe285aa8b549b4 Mon Sep 17 00:00:00 2001
|
||||
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
|
||||
Date: Sat, 16 Mar 2019 02:59:15 -0400
|
||||
Subject: [PATCH 3/3] DOC: Don't print out conda/pip environment.
|
||||
|
||||
Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
|
||||
---
|
||||
doc/conf.py | 8 --------
|
||||
1 file changed, 8 deletions(-)
|
||||
|
||||
diff --git a/doc/conf.py b/doc/conf.py
|
||||
index 7e28953b..49bfdaca 100644
|
||||
--- a/doc/conf.py
|
||||
+++ b/doc/conf.py
|
||||
@@ -16,7 +16,6 @@ import datetime
|
||||
import inspect
|
||||
import os
|
||||
import pathlib
|
||||
-import subprocess
|
||||
import sys
|
||||
from contextlib import suppress
|
||||
from textwrap import dedent, indent
|
||||
@@ -35,13 +34,6 @@ allowed_failures = set()
|
||||
print("python exec:", sys.executable)
|
||||
print("sys.path:", sys.path)
|
||||
|
||||
-if "CONDA_DEFAULT_ENV" in os.environ or "conda" in sys.executable:
|
||||
- print("conda environment:")
|
||||
- subprocess.run([os.environ.get("CONDA_EXE", "conda"), "list"])
|
||||
-else:
|
||||
- print("pip environment:")
|
||||
- subprocess.run([sys.executable, "-m", "pip", "list"])
|
||||
-
|
||||
print(f"xarray: {xarray.__version__}, {xarray.__file__}")
|
||||
|
||||
with suppress(ImportError):
|
||||
--
|
||||
2.36.1
|
||||
|
||||
@@ -1,38 +1,28 @@
|
||||
%global srcname xarray
|
||||
%global data_commit 86974d54ce83a130303fe8caa629e60deb3cb6e5
|
||||
|
||||
%bcond_with docs
|
||||
|
||||
Name: python-%{srcname}
|
||||
Version: 2022.6.0
|
||||
Version: 2025.1.2
|
||||
Release: %autorelease
|
||||
Summary: N-D labeled arrays and datasets in Python
|
||||
|
||||
License: ASL 2.0
|
||||
License: Apache-2.0
|
||||
URL: https://github.com/pydata/xarray
|
||||
Source0: %pypi_source %{srcname}
|
||||
# Data for examples only.
|
||||
Source1: https://github.com/pydata/xarray-data/archive/%{data_commit}/xarray-data-%{data_commit}.tar.gz
|
||||
Source2: https://github.com/rasterio/rasterio/raw/1.2.10/tests/data/RGB.byte.tif
|
||||
# All Fedora specific.
|
||||
Patch0001: 0001-DOC-Don-t-download-RGB.byte.tif-during-build.patch
|
||||
Patch0002: 0002-DOC-Skip-examples-using-unpackaged-dependencies.patch
|
||||
Patch0003: 0003-DOC-Don-t-print-out-conda-pip-environment.patch
|
||||
Source: %pypi_source %{srcname}
|
||||
|
||||
# https://github.com/pydata/xarray/pull/9964
|
||||
Patch: 0001-Avoid-unsafe-casts-from-float-to-unsigned-int.patch
|
||||
|
||||
BuildArch: noarch
|
||||
|
||||
BuildRequires: python3-devel
|
||||
BuildRequires: python3dist(bottleneck)
|
||||
BuildRequires: python3dist(cftime) >= 1.2
|
||||
BuildRequires: python3dist(dask[array]) >= 2.30
|
||||
BuildRequires: python3dist(dask[dataframe]) >= 2.30
|
||||
BuildRequires: python3dist(netcdf4) >= 1.5
|
||||
BuildRequires: python3dist(dask[array]) >= 2023.9
|
||||
BuildRequires: python3dist(dask[dataframe]) >= 2023.9
|
||||
BuildRequires: python3dist(pint) >= 0.16
|
||||
BuildRequires: python3dist(pytest) >= 2.7.1
|
||||
BuildRequires: python3dist(pytest-xdist)
|
||||
BuildRequires: python3dist(rasterio) >= 1.1
|
||||
BuildRequires: python3dist(seaborn) >= 0.11
|
||||
BuildRequires: python3dist(zarr) >= 2.5
|
||||
|
||||
%global _description %{expand: \
|
||||
Xarray (formerly xray) is an open source project and Python package that
|
||||
@@ -47,68 +37,29 @@ for advanced analytics and visualization with these data structures.
|
||||
|
||||
Xarray was inspired by and borrows heavily from pandas, the popular data
|
||||
analysis package focused on labelled tabular data. It is particularly
|
||||
tailored to working with netCDF files, which were the source of xarray's
|
||||
tailored to working with netCDF files, which were the source of xarray’s
|
||||
data model, and integrates tightly with dask for parallel computing.}
|
||||
|
||||
%description %{_description}
|
||||
|
||||
|
||||
%package -n python3-%{srcname}
|
||||
Summary: %{summary}
|
||||
|
||||
%description -n python3-%{srcname} %{_description}
|
||||
|
||||
|
||||
%if %{with docs}
|
||||
%package -n python-%{srcname}-doc
|
||||
Summary: xarray documentation
|
||||
|
||||
BuildRequires: python3dist(cartopy)
|
||||
BuildRequires: natural-earth-map-data-110m
|
||||
BuildRequires: natural-earth-map-data-10m
|
||||
BuildRequires: python3-ipython-sphinx
|
||||
BuildRequires: python3dist(jupyter-client)
|
||||
BuildRequires: python3dist(matplotlib) >= 3.3
|
||||
BuildRequires: python3dist(sphinx)
|
||||
BuildRequires: python3dist(sphinx-gallery)
|
||||
BuildRequires: python3dist(sphinx-rtd-theme)
|
||||
|
||||
%description -n python-%{srcname}-doc
|
||||
Documentation for xarray
|
||||
%endif
|
||||
|
||||
%pyproject_extras_subpkg -n python3-%{srcname} io
|
||||
|
||||
%prep
|
||||
%autosetup -n %{srcname}-%{version} -p1
|
||||
|
||||
%if %{with docs}
|
||||
# Provide example datasets for building docs.
|
||||
tar xf %SOURCE1 --transform='s~^\(%{srcname}-data-%{data_commit}/\)~\1.xarray_tutorial_data/~'
|
||||
cp -p %SOURCE2 ./doc/gallery/
|
||||
%endif
|
||||
|
||||
|
||||
%generate_buildrequires
|
||||
%pyproject_buildrequires -r
|
||||
|
||||
%pyproject_buildrequires -x io
|
||||
|
||||
%build
|
||||
%pyproject_wheel
|
||||
|
||||
%if %{with docs}
|
||||
# generate html docs
|
||||
pushd doc
|
||||
PYTHONPATH=${PWD}/.. HOME=${PWD}/../%{srcname}-data-%{data_commit} make html
|
||||
# remove the sphinx-build leftovers
|
||||
rm -rf _build/html/.{doctrees,buildinfo}
|
||||
popd
|
||||
%endif
|
||||
|
||||
|
||||
%install
|
||||
%pyproject_install
|
||||
%pyproject_save_files %{srcname}
|
||||
|
||||
%pyproject_save_files -l %{srcname}
|
||||
|
||||
%check
|
||||
rm -rf xarray
|
||||
@@ -116,21 +67,15 @@ rm -rf xarray
|
||||
pytest_args=(
|
||||
-n auto
|
||||
-m "not network"
|
||||
# this test somehow crashes python interpreter entirely, was xfail upstream till recently
|
||||
-k 'not test_save_mfdataset_compute_false_roundtrip'
|
||||
)
|
||||
|
||||
%{pytest} -ra "${pytest_args[@]}" --pyargs xarray
|
||||
|
||||
|
||||
%files -n python3-%{srcname} -f %{pyproject_files}
|
||||
%license LICENSE licenses/DASK_LICENSE licenses/NUMPY_LICENSE licenses/PANDAS_LICENSE licenses/PYTHON_LICENSE licenses/SEABORN_LICENSE
|
||||
%license licenses/*
|
||||
%doc README.md
|
||||
|
||||
%if %{with docs}
|
||||
%files -n python-%{srcname}-doc
|
||||
%doc doc/_build/html
|
||||
%license LICENSE licenses/DASK_LICENSE licenses/NUMPY_LICENSE licenses/PANDAS_LICENSE licenses/PYTHON_LICENSE licenses/SEABORN_LICENSE
|
||||
%endif
|
||||
|
||||
|
||||
%changelog
|
||||
%autochangelog
|
||||
|
||||
4
sources
4
sources
@@ -1,3 +1 @@
|
||||
SHA512 (xarray-2022.6.0.tar.gz) = 415bd84246d6d2b8aebf316ac9ef82ca7afeacce718349b75479c0aa693e2866dfe236e6dcaf41cae68afd7a99408f5027c938e6b7f447f5323e076b804f5165
|
||||
SHA512 (xarray-data-86974d54ce83a130303fe8caa629e60deb3cb6e5.tar.gz) = c7cddd4de81908110f65fac9df63b68ade0d37b9983b2bf7a6d5021e419d5b7e23e6bee316be4f802a7fbd70952bb5e3eead91d544c8b8bd6ffb2747d3fca64f
|
||||
SHA512 (RGB.byte.tif) = 34aa1b196f6c5880530d42ec8a25193bc79db803a8427adc9b115373d222b9f4318a04f06c8b37118df7e09d96b9c470ecec543c604af18861f11b786ed6fbfd
|
||||
SHA512 (xarray-2025.1.1.tar.gz) = a0cde2c8e38887878bcde25fd3ea6ee436b522ca73f52359d2c8ac1993447472d7cd5e5d4b11016ec48d1b86dba08e9207caf00b2b43ab896c777395e51f7943
|
||||
|
||||
Reference in New Issue
Block a user