Registry / data / gridtools-cpp

gridtools-cpp

JSON →
library2.3.9pypypi✓ verified 30d ago

A Python wrapper for the GridTools C++ library, providing high-performance stencil computations on structured grids for weather and climate applications. Current version 2.3.9, released under a BSD license. Release cadence is irregular, with minor updates every few months.

datahttp-networking
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

from gridtools_cpp import get_cmake_dir
from gridtools_cpp import get_include_dir
from gridtools_cpp import pathlib

Basic usage of GridTools Python interface. Note that actual high-performance stencils require compiling C++ kernels via the GridTools library; this Python wrapper exposes that functionality.

import gridtools import numpy as np # Define a simple stencil: compute average of neighbors def stencil(in_field, out_field): # GridTools expects Fortran-layout arrays in_field = np.asfortranarray(in_field) out_field = np.asfortranarray(out_field) # Example using the gridtools library (mock) # Real usage involves building a stencil object and applying it out_field[1:-1, 1:-1] = (in_field[:-2, 1:-1] + in_field[2:, 1:-1] + in_field[1:-1, :-2] + in_field[1:-1, 2:]) / 4.0 return out_field # Create test data nx, ny = 10, 10 in_field = np.random.rand(nx, ny) out_field = np.zeros((nx, ny)) result = stencil(in_field, out_field) print(result)
Debug
Known footguns
gotchaThe Python package name is 'gridtools' (no underscore) despite the PyPI package being 'gridtools-cpp'. Attempting to import 'gridtools_cpp' will fail.
gotchaGridTools expects Fortran-contiguous (column-major) arrays. Passing C-contiguous arrays may result in incorrect results or performance degradation.
deprecatedThe older version 1.x used a different API with 'gridtools_cpp' module. Many online examples still reference the old import path.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
15 hits · last 30 days
ahrefsbot
4
gptbot
3
amazonbot
3
claudebot
3
bingbot
1
Resources