Skip to main content

grib2io

License: MIT

Python 3.8 Python 3.9 Python 3.10 Python 3.11 Python 3.12 Python 3.13 Python 3.14

Build Linux Build macOS

PyPI PyPI - Downloads

Anaconda-Server Badge Anaconda-Server Badge Anaconda-Server Badge

Binder

Introduction

grib2io provides a Python interface to the NCEP GRIB2 C library for reading and writing GRIB2 files. The World Meteorological Organization (WMO) GRIdded Binary, Edition 2 (GRIB2) is a table-driven, binary data format designed for transmitting large volumes of gridded meteorological and atmospheric data.

grib2io is the successor to ncepgrib2 which was a module within pygrib. As of pygrib v2.1, development of ncepgrib2 was dropped in favor of continued development of the pygrib module which provides an interface to the ECMWF ecCodes library. grib2io aims to provide a fast, efficient, and easy-to-use interface to the NCEP g2c library. One way to accomplish this is to leverage the NCEP GRIB2 Tables which are included in grib2io. With these tables included and functions interact with them, grib2io provides a translation of GRIB2's integer coded metadata to human-readable language.

Optionally (but recommended), grib2io supports spatial interpolation via its internal Cython extension module, iplib, which provides an interface to the Fortran-based NCEPLIBS-ip. Grid to grid and grid to station points are supported with OpenMP threading, provided that NCEPLIBS-ip was built with OpenMP support.

Documentation

Required Software

  • Python 3.8, 3.9, 3.10, 3.11, 3.12, 3.13, 3.14
  • NCEPLIBS-g2c 1.7.0+
  • setuptools 34.0+
  • Cython 3.0+
  • NumPy 1.22+
  • pyproj 1.9.6+
  • C compiler: GNU, Intel, and Apple Clang have been tested.

Required External Libraries

NCEPLIBS-g2c

The NCEPLIBS-g2c library is required for grib2io. You will have to build and install this yourself, but this is not difficult. For macOS users, NCEPLIBS-g2c can be installed via this Homebrew Tap. If you use the *conda ecosystems, then you can install via conda install -c conda-forge nceplibs-g2c.

Optional External Libraries

NCEPLIBS-ip (v5.1.0 or newer)

The NCEPLIBS-ip Fortran library provides interpolation support. You will have to build and install this yourself, but this is not difficult. For macOS users, NCEPLIBS-ip can be installed via this Homebrew Tap. If you use the *conda ecosystems, then you can install via conda install -c conda-forge nceplibs-ip.

Install

Once again, this assumes that NCEPLIBS-g2c has been installed. If NCEPLIBS-g2c has been installed into a "common" installation path, then it will be found, otherwise define environment variable G2C_DIR with the installation path.

  • From PyPI via pip:
pip install grib2io
conda install -c conda-forge grib2io
  • From source:
pip install .

Source builds use CMake via scikit-build-core. You can control interpolation support directly from pip:

# Build without NCEPLIBS-ip (interpolation disabled)
pip install . --config-settings=cmake.define.GRIB2IO_WITH_IP=OFF

# Build with interpolation when libip is available (default)
pip install . --config-settings=cmake.define.GRIB2IO_WITH_IP=ON

Build Troubleshooting

If source builds cannot find libraries, set explicit include/lib paths:

export G2C_INCDIR=<path>/include
export G2C_LIBDIR=<path>/lib
export IP_INCDIR=<path>/include_d
export IP_LIBDIR=<path>/lib
pip install .

If you do not need interpolation support, disable it at build time:

pip install . --config-settings=cmake.define.GRIB2IO_WITH_IP=OFF

Development

grib2io is the de facto Python interface to the NCEPLIBS-g2c library. Therefore, its development and evolution will primarily focus on serving that purpose and supporting its core users—mainly meteorologists, physical scientists, and software developers working within NOAA’s National Weather Service (NWS), the National Centers for Environmental Prediction (NCEP), and other NOAA and U.S. Government organizations.

Disclaimer

This repository is a scientific product and is not official communication of the National Oceanic and Atmospheric Administration, or the United States Department of Commerce. All NOAA GitHub project code is provided on an 'as is' basis and the user assumes responsibility for its use. Any claims against the Department of Commerce or Department of Commerce bureaus stemming from the use of this GitHub project will be governed by all applicable Federal law. Any reference to specific commercial products, processes, or services by service mark, trademark, manufacturer, or otherwise, does not constitute or imply their endorsement, recommendation or favoring by the Department of Commerce. The Department of Commerce seal and logo, or the seal and logo of a DOC bureau, shall not be used in any manner to imply endorsement of any commercial product or activity by DOC or the United States Government.

Generative AI tools are used to assist with developing this code. The code has been reviewed, edited, and validated by NWS staff.

Metadata

Release files for grib2io 2.8.2

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

Source distribution (sdist)

Source distribution for grib2io 2.8.2
File Size Uploaded
grib2io-2.8.2.tar.gz 1.5 MB Details

Release files / grib2io-2.8.2.tar.gz

Download URL grib2io-2.8.2.tar.gz
Size 1.5 MB
Tags Source
SHA-256 checksum
How to use checksums
a571fa692fcf81c706c4a60156221a74c50de873ab3377845c9306a12ade049e
BLAKE2b-256 checksum
How to use checksums
2fe7754810b5f3be4cc9350011e7e608dd4d416d5357ec46b789c653afc8eb50
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.13

Release history Release notifications | RSS feed

This release

2.8.2 This release

1 release file

2.8.1

1 release file

2.8.0

1 release file

2.7.0

1 release file

2.6.0

1 release file

2.5.4

1 release file

2.5.3

1 release file

2.5.2

1 release file

2.5.1

1 release file

2.5.0

1 release file

2.4.0

1 release file

2.3.0

1 release file

2.2.5

1 release file

2.2.4

1 release file

2.2.3

1 release file

2.2.2

1 release file

2.2.1

1 release file

2.2.0

1 release file

2.1.4

1 release file

2.1.3

1 release file

2.1.2

1 release file

2.1.1

1 release file

2.1.0

1 release file

2.0.2

1 release file

2.0.1

1 release file

2.0.0

1 release file

2.0.0b2

1 release file

1.1.0

1 release file

1.0.3

1 release file

1.0.2

1 release file

1.0.1

1 release file

1.0.0

1 release file

0.9.3

1 release file

0.9.2

1 release file

0.9.1

1 release file

0.9.0

1 release file

0.8.0

1 release file

0.3.0

1 release file

0.2.0

1 release file

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