From b5b15ab62ff50557c73da6a5467465df785ece2c Mon Sep 17 00:00:00 2001 From: Bart Schilperoort Date: Wed, 9 Apr 2025 08:50:24 +0200 Subject: [PATCH 1/2] Add conda-forge badge, install note --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d86dbf8..08e752b 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,7 @@ All regridding methods can operate lazily on [Dask arrays](https://docs.xarray.d Note that "Most common value" is designed to regrid categorical data to a coarse resolution. For regridding categorical data to a finer resolution, please use "nearest-neighbor" regridder. [![PyPI](https://img.shields.io/pypi/v/xarray-regrid.svg?style=flat)](https://pypi.python.org/pypi/xarray-regrid/) +[![conda-forge](https://anaconda.org/conda-forge/xarray-regrid/badges/version.svg)](https://anaconda.org/conda-forge/xarray-regrid) [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.10203304.svg)](https://doi.org/10.5281/zenodo.10203304) [![Docs](https://readthedocs.org/projects/xarray-regrid/badge/?version=latest&style=flat)](https://xarray-regrid.readthedocs.org/) @@ -29,6 +30,8 @@ For a minimal install: pip install xarray-regrid ``` +*Note: xarray-regrid is also [available on conda-forge](https://anaconda.org/conda-forge/xarray-regrid).* + To improve performance in certain cases: ```console pip install xarray-regrid[accel] @@ -39,7 +42,7 @@ which includes optional extras such as: - `sparse`: for performing conservative regridding using sparse weight matrices - `opt-einsum`: optimized einsum routines used in conservative regridding - Benchmarking varies across different hardware specifications, but the inclusion of these extras can often provide significant speedups. +Benchmarking varies across different hardware specifications, but the inclusion of these extras can often provide significant speedups. ## Usage The xarray-regrid routines are accessed using the "regrid" accessor on an xarray Dataset: From bd28a6a29840634ffdfac5dc437b7aaf2d8f0142 Mon Sep 17 00:00:00 2001 From: Bart Schilperoort Date: Fri, 11 Apr 2025 10:07:17 +0200 Subject: [PATCH 2/2] Avoid making mypy unhappy --- src/xarray_regrid/utils.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/xarray_regrid/utils.py b/src/xarray_regrid/utils.py index 59a6e8f..88bbab5 100644 --- a/src/xarray_regrid/utils.py +++ b/src/xarray_regrid/utils.py @@ -311,7 +311,7 @@ def format_lat( # TODO: with cos(90) = 0 weighting, these weights might be 0? polar_lat = 90 - dy = obj.coords[lat_coord].diff(lat_coord).max().values.item() + dy: Any = obj.coords[lat_coord].diff(lat_coord).max().values.item() # Only pad if global but don't have edge values directly at poles # NOTE: could use xr.pad here instead of xr.concat, but none of the @@ -369,8 +369,8 @@ def format_lon( # Only pad if domain is global in lon source_lon = obj.coords[lon_coord] target_lon = target.coords[lon_coord] - dx_s = source_lon.diff(lon_coord).max().values.item() - dx_t = target_lon.diff(lon_coord).max().values.item() + dx_s: Any = source_lon.diff(lon_coord).max().values.item() + dx_t: Any = target_lon.diff(lon_coord).max().values.item() is_global_lon = source_lon.max().values - source_lon.min().values >= 360 - dx_s if is_global_lon: