Skip to content

Add conda-forge badge, install note #59

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 11, 2025
Merged
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
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/)

Expand All @@ -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]
Expand All @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions src/xarray_regrid/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down