Skip to end of metadata
Go to start of metadata

Please test this Python3 BETA interface carefully and provide us with feedback.

With ecCodes 2.10.0, we prepared a beta version of the long awaited Python 3 interface to the ecCodes API. While the migration to Python 3 of many other packages has been done, ecCodes had proved more challenging. The main challenge has been that the underlying file I/O has radically changed with Python 3, therefore we needed to rewrite some of the underlying code. This required careful testing to ensure no regression in functionality (including the Python 2 installations). We try to minimise the impact to users and their programs, but some minor changes required by Python 3 itself are needed.

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.

Known issues

We are aware of issues if GRIB/BUFR files are reopened in the same programs, and we are working on ways to fix it.

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