Skip to main content

Regridding based on sparse matrix multiplication

Project description

Maintenance PyTest Coverage Status PyPI version Documentation DOI

smmregrid

A compact regridder using sparse matrix multiplication

This repository represents a modification of the regridding routines in climtas by Scott Wales, which already implements efficiently this idea and has no other significant dependencies. The regridder uses efficiently sparse matrix multiplication with dask + some manipulation of the coordinates.

Please note that this tool is not thought as "another interpolation tool", but rather a method to apply pre-computed weights (with CDO, which is currently tested) within the python environment. The speedup 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, both xarray.Dataset and xarray.DataArray can be used. Masks are treated in a simple way but are correctly transfered. Attributes are kept.

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

mamba env create -f environment.yml

then activate the environment:

mamba activate smmregrid

and install smmregrid in editable mode:

pip install -e .

Alternatively - if you have in your environment/machine the required dependencies, mostly CDO - you can install smmregrid directly via pypi with:

pip install smmregrid

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.

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

smmregrid-0.1.2.tar.gz (29.4 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.2-py3-none-any.whl (32.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for smmregrid-0.1.2.tar.gz
Algorithm Hash digest
SHA256 c8355da74bb0d66d41d3425f065d86355ab6d8b95ac94d6f0c5af6e551da2bc6
MD5 61808e69f2ca4b9384bdf1d85d7d109c
BLAKE2b-256 441152595c32e87d738a6f3856ca0622241fd35a31bcb37c000d65e25a1a299f

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for smmregrid-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 424d90a67395d0e3d68e03bfd3a094c85fa0642709df683bf4535ae0d2d79861
MD5 db6b56c2d36db93c3b15bd063993a912
BLAKE2b-256 d973dd0f0f57a9d198e980bcfd376b0cd102b36aebff62f3b07db4cbf0b09e9e

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 Pingdom Monitoring Sentry Error logging StatusPage Status page