Skip to content
Open
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
6 changes: 3 additions & 3 deletions .github/workflows/build_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ jobs:
fail-fast: false
matrix:
os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
python-version: ['3.10', '3.11', '3.12']
python-version: ['3.12', '3.13', '3.14', '3.15']
env:
MPLBACKEND: Agg # https://github.com/orgs/community/discussions/26434
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v7
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python-version }}
- name: Python info
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ jobs:
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v3
- uses: actions/checkout@v7
- name: Set up Python 3.12
uses: actions/setup-python@v7
with:
python-version: "3.10"
python-version: "3.12"
- name: Python info
shell: bash -l {0}
run: |
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,19 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v7
- name: Set up Python
uses: actions/setup-python@v3
uses: actions/setup-python@v7
with:
python-version: '3.10'
python-version: '3.12'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # v1.14.3
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/).

## Unreleased

Changed:
- Supported Python versions are now 3.12, 3.13, 3.14 and 3.15. Python 3.10 and 3.11 are no longer supported.
- Updated GitHub Actions to their latest versions.

## 0.4.2 (2026-01-28)

New contributors:
Expand Down
2 changes: 1 addition & 1 deletion docs/.readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: 2
build:
os: ubuntu-22.04
tools:
python: "3.11"
python: "3.12"

sphinx:
configuration: docs/conf.py
Expand Down
14 changes: 8 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ name = "xarray-regrid"
dynamic = ["version"]
description = 'Regridding tools using xarray and flox.'
readme = "README.md"
requires-python = ">=3.10"
requires-python = ">=3.12"
license = "Apache-2.0"
keywords = []
authors = [
Expand All @@ -16,8 +16,10 @@ authors = [
classifiers = [
"Development Status :: 4 - Beta",
"Programming Language :: Python",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Programming Language :: Python :: 3.15",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
]
Expand Down Expand Up @@ -95,7 +97,7 @@ features = ["docs"]
build = ["(cd docs && make html)"]

[tool.ruff]
target-version = "py310"
target-version = "py312"
line-length = 88
exclude = [
"docs",
Expand Down Expand Up @@ -134,7 +136,7 @@ ignore = [
# Ignore checks for possible passwords
"S105", "S106", "S107",
# Ignore complexity
"C901", "PLR0911", "PLR0912", "PLR0913", "PLR0915",
"C901", "PLR0911", "PLR0912", "PLR0913", "PLR0915", "PLR0917",
# Ignore magic values (false positives)
"PLR2004",
# Causes conflicts with formatter
Expand Down Expand Up @@ -175,7 +177,7 @@ exclude_lines = [
]

[tool.mypy]
python_version = "3.10"
python_version = "3.12"
plugins = "numpy.typing.mypy_plugin"
disallow_untyped_defs = true
disallow_any_unimported = true
Expand Down
2 changes: 1 addition & 1 deletion src/xarray_regrid/methods/conservative.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ def lat_weight(latitude: np.ndarray, latitude_res: float) -> np.ndarray:
dlat: float = np.radians(latitude_res)
lat = np.radians(latitude)
h = np.sin(lat + dlat / 2) - np.sin(lat - dlat / 2)
return h * dlat / (np.pi * 4) # type: ignore
return h * dlat / (np.pi * 4)


def format_weights(
Expand Down
8 changes: 4 additions & 4 deletions src/xarray_regrid/methods/flox_reduce.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def statistic_reduce(
time_dim: str | None,
method: str,
skipna: bool = False,
fill_value: None | Any = None,
fill_value: Any | None = None,
) -> xr.DataArray: ...


Expand All @@ -33,7 +33,7 @@ def statistic_reduce(
time_dim: str | None,
method: str,
skipna: bool = False,
fill_value: None | Any = None,
fill_value: Any | None = None,
) -> xr.Dataset: ...


Expand All @@ -43,7 +43,7 @@ def statistic_reduce(
time_dim: str | None,
method: str,
skipna: bool = False,
fill_value: None | Any = None,
fill_value: Any | None = None,
) -> xr.DataArray | xr.Dataset:
"""Upsampling of data using statistical methods (e.g. the mean or variance).

Expand Down Expand Up @@ -124,7 +124,7 @@ def compute_mode(
target_ds: xr.Dataset,
values: np.ndarray,
time_dim: str | None,
fill_value: None | Any = None,
fill_value: Any | None = None,
anti_mode: bool = False,
) -> xr.DataArray:
"""Upsample the input data using a "most common label" (mode) approach.
Expand Down
14 changes: 7 additions & 7 deletions src/xarray_regrid/regrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def most_common(
ds_target_grid: xr.Dataset,
values: np.ndarray,
time_dim: str | None = "time",
fill_value: None | Any = None,
fill_value: Any | None = None,
) -> xr.DataArray:
"""Regrid by taking the most common value within the new grid cells.

Expand Down Expand Up @@ -165,8 +165,8 @@ def most_common(
if isinstance(self._obj, xr.Dataset):
msg = (
"The 'most common value' regridder is not implemented for\n",
"xarray.Dataset, as it requires specifying the expected labels.\n"
"Please select only a single variable (as DataArray),\n"
"xarray.Dataset, as it requires specifying the expected labels.\n",
"Please select only a single variable (as DataArray),\n",
" and regrid it separately.",
)
raise ValueError(msg)
Expand All @@ -187,7 +187,7 @@ def least_common(
ds_target_grid: xr.Dataset,
values: np.ndarray,
time_dim: str | None = "time",
fill_value: None | Any = None,
fill_value: Any | None = None,
) -> xr.DataArray:
"""Regrid by taking the least common value within the new grid cells.

Expand Down Expand Up @@ -217,8 +217,8 @@ def least_common(
if isinstance(self._obj, xr.Dataset):
msg = (
"The 'least common value' regridder is not implemented for\n",
"xarray.Dataset, as it requires specifying the expected labels.\n"
"Please select only a single variable (as DataArray),\n"
"xarray.Dataset, as it requires specifying the expected labels.\n",
"Please select only a single variable (as DataArray),\n",
" and regrid it separately.",
)
raise ValueError(msg)
Expand All @@ -240,7 +240,7 @@ def stat(
method: str,
time_dim: str | None = "time",
skipna: bool = False,
fill_value: None | Any = None,
fill_value: Any | None = None,
) -> xr.DataArray | xr.Dataset:
"""Upsampling of data using statistical methods (e.g. the mean or variance).

Expand Down
6 changes: 6 additions & 0 deletions tests/test_regrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,12 @@ def test_conservative_nan_aggregation_over_dims():
np.testing.assert_allclose(result[0].mean().item(), data[0].mean().item())


@pytest.mark.xfail(
xr.__version__ == "2026.9.0",
reason="Bug in xarray 2026.9.0: coarsen reductions reject `skipna`.",
raises=TypeError,
strict=True,
)
@pytest.mark.parametrize("nan_threshold", [0, 1])
def test_conservative_nan_thresholds_against_coarsen(nan_threshold):
"""Compare nan_threshold regridding to behavior of xarray coarsen, where coarsen
Expand Down
Loading