Skip to main content

Regridding tools using xarray and flox.

Project description

xarray-regrid: Regridding utilities for xarray.

Logo

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

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

micromamba create -n environment_name -f environment.yml

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.2.0.tar.gz (1.1 MB view details)

Uploaded Source

Built Distribution

xarray_regrid-0.2.0-py3-none-any.whl (14.9 kB view details)

Uploaded Python 3

File details

Details for the file xarray_regrid-0.2.0.tar.gz.

File metadata

  • Download URL: xarray_regrid-0.2.0.tar.gz
  • Upload date:
  • Size: 1.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for xarray_regrid-0.2.0.tar.gz
Algorithm Hash digest
SHA256 28a13a3ecf4015d916f21c08d046c86e10e091f09a3a276174928b8d2acb7ca9
MD5 90876dd4dc3a5a81c6ae8be4f5782306
BLAKE2b-256 f9fa3e808e4968025b3ebfe359e5cb9711bbcb4bc1e29e6f04a2c7562d4ecfdb

See more details on using hashes here.

File details

Details for the file xarray_regrid-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for xarray_regrid-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f4c66b6afa50faad5851d6254e6a6b5262bfc49d1b20e43a4f0362cde432fdec
MD5 8d28436924ba6b8f556b8e0aad7b883a
BLAKE2b-256 ad25b7465aeeee20c1c3e7eac9a6e90ec02ac5ccaf13957ef7577d404154da5c

See more details on using hashes here.

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