Skip to end of metadata
Go to start of metadata

Please test the new Python3 interface carefully and provide us with feedback.


With ecCodes 2.13.0, there is a new Python3 interface based on CFFI (rather than SWIG). This interface is separated into its own package which is available on PyPI (https://pypi.org/project/eccodes-python)
Thanks to B-Open for their contribution.
Note: For Python2 there is no change, we are still using SWIG and the interface is bundled in the ecCodes tarball.

Installation

The Python module depends on the ecCodes library that must be installed on the system and accessible as a shared library.

To install the Python3 bindings, first install ecCodes as usual and then:

$ pip3 install eccodes-python

Binary I/O

When opening any BUFR or GRIB files please ensure this happens in binary mode. For example, to open a GRIB file for reading:

f = open('myfields.grib', 'rb')

And for writing:

f = open('myfields.grib', 'wb')


This change in your programs will also work in Python 2, so you can keep the same code regardless of the Python version used. All the examples on the documentation have been updated to reflect this change.

Alternatives

We have also been working on cfgrib, a higher level Python 3 interface to read GRIB data into xarray. Note that the current status of the package is BETA, so it is not currently suitable for production or operational workloads.

The cfgrib package is also used in the Metview's Python Interface, where the power and flexibility of Metview meet all the possibilities of Python 3.


  • No labels