cfgrib
Python interface to map GRIB files to the NetCDF Common Data Model following the CF Convention using ecCodes.
What it is and what it does
cfgrib is a Python interface that translates GRIB meteorological data files into datasets following the NetCDF Common Data Model and CF Conventions. It wraps the ECMWF ecCodes library to decode GRIB 1 and 2 files and expose their contents as labeled, multi-dimensional arrays with coordinates and attributes. The package reads data lazily and efficiently, supporting both memory-constrained and larger-than-memory workflows through integration with dask. It also provides low-level access to arbitrary GRIB keys via backend options, coordinate translation to custom data models, and a command-line utility for converting GRIB to NetCDF.
Development status is Beta for reading; writing support is Alpha/Broken. The main constraint is that eccodes (a compiled C library) must be installed separately on your system. The package depends on attrs, click, eccodes, and numpy.
Use it for:
- Decode ERA5 or other GRIB-formatted weather reanalysis data for climate analysis.
- Merge multiple GRIB files into a single dataset for batch processing.
- Process larger-than-memory meteorological datasets with distributed computation.
- Convert GRIB files to NetCDF format via the command-line utility.
- Read custom GRIB keys and translate coordinates to domain-specific naming conventions.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
cfgrib maps GRIB meteorological data files to the NetCDF Common Data Model following CF Conventions, exposing them as labeled multi-dimensional datasets via an engine interface.
Yes. cfgrib is actively maintained, has no known vulnerabilities, and solves a specific problem: reading GRIB meteorological files. Install friction is low (pure Python wheel), and the Apache License Version 2.0 is permissive. The main prerequisite—eccodes binary library—is well-documented and available via conda-forge. Suitable for weather data analysis, climate research, and meteorological data pipelines.
Install
cfgrib on PyPI
pip
pip install cfgribuv
uv add cfgribpoetry
poetry add cfgribInstalling cfgrib
Before you install
Low friction: pure Python wheel with four runtime dependencies (attrs, click, eccodes, numpy). Actively maintained with recent commits and no known vulnerabilities. Requires eccodes binary library installed separately; the package provides a selfcheck command to verify system setup.
License in practice
Apache License Version 2.0 (permissive): you may use, modify, and distribute cfgrib freely in commercial and private projects, provided you include a copy of the license and do not hold the authors liable.
Quickstart
pip install cfgrib
import cfgrib
ds = cfgrib.open_dataset('file.grib')
print(ds)
The eccodes binary library must be installed on your system; cfgrib is a Python wrapper around it. Run `python -m cfgrib selfcheck` to verify your setup.
Verify before relying
- Whether coordinate system and gridType handling limitations affect your specific GRIB files.
- Performance characteristics for larger-than-memory datasets in your deployment environment.
- Completeness of GRIB 1 and 2 support for heterogeneous files beyond the documented Beta status.
- Compatibility with the engine interface for integration with external data tools.
Package facts
| License | Apache License Version 2.0 (permissive) |
| Python support | supports the current Python release (>=3.7) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 4 — attrs, click, eccodes, numpy |
| Maintenance | actively maintained — 318 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 929,155/month — #4,706 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: cfgrib-0.9.15.1-py3-none-any.whl
Keywords: eccodes, grib, xarray
Tags
More Information Analysis packages
A drop-in replacement for Python's standard…
permissive · top 100 on PyPI
pyarrowpyarrow provides Python bindings to Apache…
permissive · top 100 on PyPI
networkxNetworkX provides data structures and…
permissive · top 1,000 on PyPI
snowflake-connector-pythonConnects Python applications to Snowflake data…
permissive · top 1,000 on PyPI
contourpyContourPy calculates contours of 2D…
permissive · top 1,000 on PyPI
snowflake-snowpark-pythonSnowpark Python provides APIs to query and…
permissive · top 1,000 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
pdbufrpdbufr reads BUFR (Binary Universal Form for…
permissive · top 15,000 on PyPI
pygribReads and writes GRIB meteorological data files…
permissive · top 15,000 on PyPI
earthkit-dataearthkit-data provides a unified Python…
permissive · top 15,000 on PyPI
netCDF4netcdf4 provides a Python interface to read,…
permissive · top 5,000 on PyPI
liac-arffReads and writes ARFF (Attribute-Relation File…
permissive · top 15,000 on PyPI
herbie-dataHerbie downloads numerical weather prediction…
permissive · top 15,000 on PyPI
cf-xarraycf-xarray adds a `.cf` accessor to xarray…
permissive · top 15,000 on PyPI
h5netcdfh5netcdf reads and writes netCDF4 files using…
permissive · top 5,000 on PyPI