Metadata-Version: 2.1
Name: xarray-regrid
Version: 0.2.0
Summary: Regridding tools using xarray and flox.
Project-URL: Documentation, https://github.com/EXCITED-CO2/xarray-regrid#readme
Project-URL: Issues, https://github.com/EXCITED-CO2/xarray-regrid/issues
Project-URL: Source, https://github.com/EXCITED-CO2/xarray-regrid
Author-email: Bart Schilperoort <b.schilperoort@esciencecenter.nl>
License-Expression: Apache-2.0
License-File: LICENSE
Classifier: Development Status :: 4 - Beta
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Requires-Python: >=3.10
Requires-Dist: flox
Requires-Dist: numpy
Requires-Dist: scipy
Requires-Dist: xarray
Provides-Extra: benchmarking
Requires-Dist: dask[distributed]; extra == 'benchmarking'
Requires-Dist: matplotlib; extra == 'benchmarking'
Provides-Extra: dev
Requires-Dist: black[jupyter]; extra == 'dev'
Requires-Dist: bump2version; extra == 'dev'
Requires-Dist: hatch; extra == 'dev'
Requires-Dist: mypy; extra == 'dev'
Requires-Dist: pandas-stubs; extra == 'dev'
Requires-Dist: pytest; extra == 'dev'
Requires-Dist: pytest-cov; extra == 'dev'
Requires-Dist: ruff; extra == 'dev'
Description-Content-Type: text/markdown

# xarray-regrid: Regridding utilities for xarray.

<img align="right" width="100" alt="Logo" src="./docs/assets/logo.png">

With xarray-regrid it is possible to regrid between two rectilinear grids. The following methods are supported:
 - Linear
 - Nearest-neighbor
 - Conservative
 - Cubic
 - "Most common value" (zonal statistics)

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.

## Installation

```console
pip install xarray-regrid
```

## Usage
The xarray-regrid routines are accessed using the "regrid" accessor on an xarray Dataset:
```py
import xarray_regrid

ds = xr.open_dataset("input_data.nc")
ds_grid = xr.open_dataset("target_grid.nc")

ds.regrid.linear(ds_grid)
```

For examples, see the benchmark notebooks and the demo notebooks.

## Benchmarks
The benchmark notebooks contain comparisons to more standard methods (CDO, xESMF).

To be able to run the notebooks, a conda environment is required (due to ESMF and CDO).
You can install this environment using the `environment.yml` file in this repository.
[Micromamba](https://mamba.readthedocs.io/en/latest/user_guide/micromamba.html) is a lightweight version of the much faster "mamba" conda alternative.

```sh
micromamba create -n environment_name -f environment.yml
```
