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
Built Distribution
File details
Details for the file xarray_regrid-0.1.0.tar.gz
.
File metadata
- Download URL: xarray_regrid-0.1.0.tar.gz
- Upload date:
- Size: 866.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.17
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e8512d9262def98a56d08e4334a8980c621c42079c1a763e05e91752e24ca38f |
|
MD5 | d7992f8f587d82ae607dd23734e2326f |
|
BLAKE2b-256 | 84b8a7d6e881a46e424f504bea6321a91ef3dc36148e2fba14ae758c4bbf373d |
File details
Details for the file xarray_regrid-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: xarray_regrid-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.17
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a3dea0c32967ce251fbc5f1247764185c90088239c54ee7d63e31a66b1cc70ef |
|
MD5 | d44e841e74d34e7fe9a43add380319d9 |
|
BLAKE2b-256 | a6e55f1ffde39dd58def511c1eb483d451bb6c9a96f16823b309708850135cda |