Regridding based on sparse matrix multiplication
Project description
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, and with ESMF, which is not yet supported) 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
Built Distribution
Hashes for smmregrid-0.0.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1bacfd70f3ba4eaf89b971c5369226cce249d68c2320fa41f2ae8fbf8c212616 |
|
MD5 | bc2129a13a13084cea25a474a271fdc0 |
|
BLAKE2b-256 | be1ca3ab521b108573d21fb157b7a219e5cba0a09d5b740e406b05854db4c2e1 |