pygrib
Python module for reading/writing GRIB files
What it is and what it does
pygrib is a Python wrapper around the ECMWF ECCODES library for reading and writing GRIB meteorological data files. GRIB is the standard format for storing weather and climate model output, satellite observations, and other gridded atmospheric data. The package provides a high-level interface to parse GRIB files and access their contents as Python objects, making it straightforward to integrate meteorological data into scientific workflows.
The package supports reading GRIB files fully and has limited write capabilities—you can modify the contents of an existing GRIB file but cannot create one from scratch. It depends on numpy, pyproj, and packaging, and requires the ECCODES C library to be present on your system. Wheels are available for Python 3.10–3.14 on macOS and Linux, though you will need to ensure ECCODES is installed separately or available via your package manager.
Use it for:
- Load weather model output (e.g., from NOAA or ECMWF) for analysis or visualization in scientific Python workflows.
- Extract specific meteorological variables (temperature, pressure, wind) from GRIB files for data processing.
- Modify metadata or values in existing GRIB files for reprocessing or redistribution.
- Integrate gridded climate or weather data into machine learning or statistical analysis pipelines.
- Convert GRIB data to other formats (e.g., NetCDF) by reading and transforming with numpy and pyproj.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Reads and writes GRIB meteorological data files via a Python interface to the ECMWF ECCODES C library, with limited write support for modifying existing files.
Yes, if you work with meteorological or climate data in GRIB format and have access to the ECCODES library. The package is actively maintained, permissively licensed, and has no known vulnerabilities. Install friction is moderate due to the C dependency, but pre-built wheels and conda packages ease deployment on standard platforms. Not suitable if you need to create GRIB files from scratch or lack system-level ECCODES installation.
Install
pygrib on PyPI
pip
pip install pygribuv
uv add pygribpoetry
poetry add pygribInstalling pygrib
Before you install
Medium install friction due to a compiled C dependency (ECCODES library). The package provides pre-built wheels for Python 3.10–3.14 on macOS and Linux, reducing friction for common platforms. Maintenance is active with a recent release (292 days ago) and ongoing repository activity.
License in practice
Dual-licensed under MIT and (Apache-2.0 OR BSD-2-Clause), all permissive. No restrictions on commercial or proprietary use.
Quickstart
pip install pygrib
import pygrib
grbs = pygrib.open('file.grib')
for grb in grbs:
print(grb)
Requires the ECCODES C library installed on your system; pip will search common locations ($CONDA_PREFIX, /usr, /usr/local, /opt/local) or use $ECCODES_DIR if set.
Verify before relying
- Whether pre-built wheels include ECCODES or if system installation is always required
- Performance characteristics when reading large GRIB files
- Extent of write capabilities beyond modifying existing files
Package facts
| License | MIT AND (Apache-2.0 OR BSD-2-Clause) (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | 3 — packaging, pyproj, numpy |
| Maintenance | actively maintained — 292 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 437,312/month — #6,670 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pygrib-2.1.8-cp310-cp310-macosx_15_0_arm64.whl; pygrib-2.1.8-cp310-cp310-macosx_15_0_x86_64.whl; pygrib-2.1.8-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.whl; pygrib-2.1.8-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl; pygrib-2.1.8-cp311-cp311-macosx_15_0_arm64.whl; pygrib-2.1.8-cp311-cp311-macosx_15_0_x86_64.whl; pygrib-2.1.8-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.whl; pygrib-2.1.8-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl; pygrib-2.1.8-cp312-cp312-macosx_15_0_arm64.whl; pygrib-2.1.8-cp312-cp312-macosx_15_0_x86_64.whl; pygrib-2.1.8-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl; pygrib-2.1.8-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl; pygrib-2.1.8-cp313-cp313-macosx_15_0_arm64.whl; pygrib-2.1.8-cp313-cp313-macosx_15_0_x86_64.whl; pygrib-2.1.8-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.whl; pygrib-2.1.8-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl; pygrib-2.1.8-cp314-cp314-macosx_15_0_arm64.whl; pygrib-2.1.8-cp314-cp314-macosx_15_0_x86_64.whl; pygrib-2.1.8-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.whl; pygrib-2.1.8-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
eccodesReads and writes GRIB and BUFR meteorological…
permissive · top 5,000 on PyPI
eccodeslibeccodeslib provides Python bindings to decode…
unclear · top 5,000 on PyPI
cfgribcfgrib maps GRIB meteorological data files to…
permissive · top 5,000 on PyPI
pdbufrpdbufr reads BUFR (Binary Universal Form for…
permissive · top 15,000 on PyPI
earthkit-dataearthkit-data provides a unified Python…
permissive · top 15,000 on PyPI
herbie-dataHerbie downloads numerical weather prediction…
permissive · top 15,000 on PyPI
earthkit-meteoComputes meteorological quantities (potential…
permissive · top 15,000 on PyPI
ecmwf-api-clientPython client for accessing ECMWF's IFS…
permissive · top 15,000 on PyPI
MetPyMetPy provides tools for reading, visualizing,…
permissive · top 15,000 on PyPI
cdsapicdsapi is a Python client for the Copernicus…
permissive · top 15,000 on PyPI