skillfed

cfgrib

Python interface to map GRIB files to the NetCDF Common Data Model following the CF Convention using ecCodes.

cfgrib v0.9.15.1 929.2K downloads/30d#4,706 on PyPI459
Permissive license Apache License Version 2.0 Active released

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 cfgrib

uv

uv add cfgrib

poetry

poetry add cfgrib

Installing 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

Development Status :: 4 - BetaIntended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPy

Tags

grib file reader pythongrib to netcdf conversionmeteorological data formateccodes python interfacecf conventions gribweather data pythongrib decoder
meteorological-datagrib-format

More Information Analysis packages