Skip to main content

Regridding tools using xarray and flox.

Project description

xarray-regrid

Regridding utilities for xarray.

Note: currently only rectilinear grids are supported.

For now xarray-regrid is mostly a wrapper around ds.interp, however, conservative regridding is not possible with interp, and will need a custom solution.

Installation

pip install xarray-regrid

Usage

The xarray-regrid routines are accessed using the "regrid" accessor on an xarray Dataset:

import xarray_regrid

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

ds.regrid.regrid(ds_grid, method="linear")

Currently implemented are the methods linear, nearest and cubic.

For examples, see the benchmark 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 is a lightweight version of the much faster "mamba" conda alternative.

Planned features

  • Support conservative regridding

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xarray_regrid-0.1.0.tar.gz (866.0 kB view hashes)

Uploaded Source

Built Distribution

xarray_regrid-0.1.0-py3-none-any.whl (9.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page