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.

Download files

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

Source Distribution

smmregrid-0.1.6.tar.gz (32.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

smmregrid-0.1.6-py3-none-any.whl (35.0 kB view details)

Uploaded Python 3

File details

Details for the file smmregrid-0.1.6.tar.gz.

File metadata

  • Download URL: smmregrid-0.1.6.tar.gz
  • Upload date:
  • Size: 32.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for smmregrid-0.1.6.tar.gz
Algorithm Hash digest
SHA256 bffd83c4fdffe04d41165cc7e13e19c9bc8e6ce5f33836414137d64d991cf27b
MD5 e2475e1c623ad78e1121e31f143273dc
BLAKE2b-256 d4b8f1bfbe4c577728518bbf028e517c86a802444321b66138fa2a06cb160296

See more details on using hashes here.

File details

Details for the file smmregrid-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: smmregrid-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 35.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for smmregrid-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 3ed404ff42b7d3b17051eb661fca862ef1260a269345bba9906b9b609eb409c8
MD5 f3a59ece188c6a550750f40a29e07708
BLAKE2b-256 f4761345c61cded91d39d48de6c24d2fa50e13873fb899ae51799ec8d40a5dd6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page