Skip to main content

Maintenance PyTest Coverage Status PyPI Conda Documentation DOI

smmregrid

A compact python regridder using sparse matrix multiplication

The regridder uses CDO as a backend for weights computation, and then uses efficiently sparse matrix multiplication with dask to provide xarray lazy output. It supports all grids supported by CDO.

Please note that this tool is not thought as "another interpolation tool", but rather a method to apply pre-computed weights within the python environment. The speedup against CDO is estimated to be about ~1.5 to ~5 times, slightly lower if then files are written to the disk. 2D and 3D data are supported on all the grids supported by CDO, and special treatment can be assigned to vertical coordinates with changing mask (e.g. ocean 3D datasets). It works smoothly on both xarray.Dataset and xarray.DataArray. Attributes are kept and target grids can be both file on disk or CDO-compliant grids (e.g. r180x90, n128, etc).

The tool works for python versions >=3.8. It is safer to run it through conda/mamba. Install with:

mamba create -n smmregrid "python>=3.8" cdo eccodes numba
mamba activate smmregrid
pip install smmregrid

Alternatively, you can clone the repo and use the environment file available

git clone https://github.com/jhardenberg/smmregrid.git
cd smmregrid
mamba env create -f environment.yml
mamba activate smmregrid
pip install -e .

As a disclaimer, this repository represents a modification of the regridding routines developed in climtas by Scott Wales, which already implements efficiently this idea and has no other significant dependencies.

Cautionary notes:

  • It does not work correctly if the Xarray.Dataset includes fields with time-varying missing points
  • It works only with interpolation methods/grids supported by CDO
  • It does not support ESMF weigths.

Metadata

Release files for smmregrid 0.1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for smmregrid 0.1.6
File Size Uploaded
smmregrid-0.1.6.tar.gz 32.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for smmregrid 0.1.6
File Interpreter ABI Platform
smmregrid-0.1.6-py3-none-any.whl Python 3 none any Details

Total release size: 67.5 kB

Release files / smmregrid-0.1.6.tar.gz

Download URL smmregrid-0.1.6.tar.gz
Size 32.5 kB
Tags Source
SHA-256 checksum
How to use checksums
bffd83c4fdffe04d41165cc7e13e19c9bc8e6ce5f33836414137d64d991cf27b
BLAKE2b-256 checksum
How to use checksums
d4b8f1bfbe4c577728518bbf028e517c86a802444321b66138fa2a06cb160296
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / smmregrid-0.1.6-py3-none-any.whl

Download URL smmregrid-0.1.6-py3-none-any.whl
Size 35.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3ed404ff42b7d3b17051eb661fca862ef1260a269345bba9906b9b609eb409c8
BLAKE2b-256 checksum
How to use checksums
f4761345c61cded91d39d48de6c24d2fa50e13873fb899ae51799ec8d40a5dd6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release history Release notifications | RSS feed

This release

0.1.6 This release

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page