{"id":27029,"library":"gridtools-cpp","title":"GridTools C++","description":"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.","status":"active","version":"2.3.9","language":"python","source_language":"en","source_url":"https://github.com/GridTools/gridtools","tags":["high-performance-computing","stencil","grid","weather","climate","c++"],"install":[{"cmd":"pip install gridtools-cpp","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Used for array operations and data exchange","package":"numpy","optional":false},{"reason":"Required for C++ backend compilation","package":"boost","optional":true}],"imports":[{"wrong":"import gridtools","symbol":"get_cmake_dir","correct":"from gridtools_cpp import get_cmake_dir"},{"symbol":"get_include_dir","correct":"from gridtools_cpp import get_include_dir"},{"symbol":"pathlib","correct":"from gridtools_cpp import pathlib"}],"quickstart":{"code":"import gridtools\nimport numpy as np\n\n# Define a simple stencil: compute average of neighbors\ndef stencil(in_field, out_field):\n    # GridTools expects Fortran-layout arrays\n    in_field = np.asfortranarray(in_field)\n    out_field = np.asfortranarray(out_field)\n    \n    # Example using the gridtools library (mock)\n    # Real usage involves building a stencil object and applying it\n    out_field[1:-1, 1:-1] = (in_field[:-2, 1:-1] + in_field[2:, 1:-1] +\n                              in_field[1:-1, :-2] + in_field[1:-1, 2:]) / 4.0\n    return out_field\n\n# Create test data\nnx, ny = 10, 10\nin_field = np.random.rand(nx, ny)\nout_field = np.zeros((nx, ny))\n\nresult = stencil(in_field, out_field)\nprint(result)\n","lang":"python","description":"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."},"warnings":[{"fix":"Use 'import gridtools' instead.","message":"The Python package name is 'gridtools' (no underscore) despite the PyPI package being 'gridtools-cpp'. Attempting to import 'gridtools_cpp' will fail.","severity":"gotcha","affected_versions":"all"},{"fix":"Convert arrays using np.asfortranarray() before passing to GridTools functions.","message":"GridTools expects Fortran-contiguous (column-major) arrays. Passing C-contiguous arrays may result in incorrect results or performance degradation.","severity":"gotcha","affected_versions":"all"},{"fix":"Update imports to use 'gridtools' and refer to current documentation.","message":"The older version 1.x used a different API with 'gridtools_cpp' module. Many online examples still reference the old import path.","severity":"deprecated","affected_versions":"<=1.x"}],"env_vars":null,"search_vec":"'2.3.9':27 'applic':24 'bsd':31 'c':2,9,51 'cadenc':34 'climat':23,50 'comput':16,46 'current':25 'everi':40 'grid':19,48 'gridtool':1,8 'high':13,44 'high-perform':12 'high-performance-comput':43 'irregular':36 'librari':10 'licens':32 'minor':38 'month':42 'perform':14,45 'provid':11 'python':4 'releas':28,33 'stencil':15,47 'structur':18 'updat':39 'version':26 'weather':21,49 'wrapper':5","created_at":"2026-05-01T17:44:07.799156+00:00","updated_at":"2026-05-01T17:44:07.799156+00:00","problems":null,"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":"https://gridtools.github.io","github":"https://github.com/GridTools/gridtools","docs":null,"changelog":null,"pypi":"https://pypi.org/project/gridtools-cpp/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["data","http-networking"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-07-03","last_verified":"2026-07-03","next_check":"2026-08-02","install_tag":null}}