Skip to main content

MINT - Mimetic INTerpolation on the Sphere

Cirrus-CI # contributors latest release Commits since last release


Overview

This project contains code to regrid edge centred fields from a source to a destination grid. The grid is stored as a collection of grid cells, which have four vertices (i.e. the cells are quadrilaterals). The edge field is stored as integrals of a vector field along each edge. The vertex coordinates are stored in longitude-latitude space.

The regridding method is mimetic in the sense that Stokes's theorem is satisfied to near machine precision. In particular, the loop integrals of an interpolated vector field deriving from a gradient is zero.

Prerequisites

To build the MINT Python module:

  • C++ compiler with C++11 support
  • Cython
  • NetCDF library
  • NumPy
  • VTK

We recommend installing the above packages using conda.

To build the MINT C++ library and the tools:

  • C++ compiler with C++11 support
  • Fortran compiler (e.g., gfortran 6.4)
  • NetCDF library
  • Doxygen
  • VTK

How to Build the MINT Python Module

The MINT Python interface requires VTK, netCDF and the tbb libraries to be installed. This is most easily done in a conda environment:

conda env create --file requirements/mint.yml
conda activate mint-dev

In the root MINT directory then type:

pip install --no-deps --editable .

Check that you can import the mint module:

python -c "import mint"

To run the tests type:

pytest

How to Build the MINT C++ Library

Perform the following in order to call MINT from Fortran, C or C++:

mkdir build
cd build
cmake ..
make -j 8

You can specify the compiler with:

FC=mpif90 CXX=mpicxx cmake ..; make -j 8

You can check that the build was successful by typing:

make test

Binary Tools

The above CMake build will compile a number of tools. To run the tools, set MINT_SRC_DIR to the location of the MINT source directory (e.g. export MINT_SRC_DIR=..).

  1. Compute the interpolation weights from a lat-lon grid to the cubed sphere:
./tools/regrid_edges -s $MINT_SRC_DIR/data/latlon4x2.nc:latlon -S 0 \
                     -d $MINT_SRC_DIR/data/cs_4.nc:physics -D 1 \
                     -w weights.nc
  1. Regrid field edge_integrated_velocity from lat-lon to cubed-sphere by loading the previously generated weights:
./tools/regrid_edges -s $MINT_SRC_DIR/data/latlon4x2.nc:latlon -S 0 \
                     -d $MINT_SRC_DIR/data/cs_4.nc:physics -D 1 \
                     -v edge_integrated_velocity -W weights.nc -o edge_integrated_velocity.vtk
  1. Compute the weights and regrid in one step:
./tools/regrid_edges -s $MINT_SRC_DIR/data/latlon4x2.nc:latlon -S 0 \
                     -d $MINT_SRC_DIR/data/cs_4.nc:physics -D 1 \
                     -v edge_integrated_velocity -W -o edge_integrated_velocity.vtk
  1. Regrid a time dependent field with elevation:
./tools/regrid_edges -s $MINT_SRC_DIR/data/lonlatzt_8x4x3x2.nc:mesh2d -S 0 \
                    -d $MINT_SRC_DIR/data/c24_u_integrated.nc:physics -D 1 \
                    -v u@$MINT_SRC_DIR/data/lonlatzt_8x4x3x2.nc \
                    -O regridedges_xyzt.nc -o regridedges_xyzt.vtk

API Documentation

This is useful if you would like to call MINT from C, Python or Fortran:

https://pletzer.github.io/mint/html/

Conservation Error

The plot below shows the error of mimetic regridding error obtained by computing the closed line integral for each cell. alt Error of mimetic regridding

Metadata

Release files for python-mint 1.15.4

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

Source distribution (sdist)

Source distribution for python-mint 1.15.4
File Size Uploaded Provenance Actions
python-mint-1.15.4.tar.gz 86.9 kB Without provenance Details for python-mint-1.15.4.tar.gz

Release files / python-mint-1.15.4.tar.gz

Download URL python-mint-1.15.4.tar.gz
Size 86.9 kB
Tags Source
SHA-256 checksum
How to use checksums
57ae186ee2ba1b328e310226ab91869394c56d1ec42616b70eea3f1f0d0a3a89
BLAKE2b-256 checksum
How to use checksums
4521385157524f0f970218470c0ad399ad38ce564eb024ae351797388b85084e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.8.10

Security for python-mint 1.15.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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