How to read and analyze grib2 data using Python in Windows?

1,157 views
Skip to first unread message

morstan

unread,
Feb 22, 2016, 2:51:29 AM2/22/16
to Iris
I have installed Iris 1.9.2 using Anaconda with Python 3.4 on Windows7, when i try to open a sample grib2 data obtained from http://rda.ucar.edu/datasets/ds083.3/ using the following sample code from Iris examples:

"""
Example of a polar stereographic plot
=====================================
Demonstrates plotting data that are defined on a polar stereographic
projection.
"""
import matplotlib.pyplot as plt
import iris
import iris.plot as iplt
import iris.quickplot as qplt

def main():
    file_path = iris.sample_data_path('D:/Python/NCEP_ds083_3_grib2data/gdas1.fnl0p25.2016012400.f00.grib2')
    cube = iris.load_cube(file_path)
    qplt.contourf(cube)
    ax = plt.gca()
    ax.coastlines()
    ax.gridlines()
    iplt.show()

if __name__ == '__main__':
    main()

It gives the following error:
    raise RuntimeError('Unable to load GRIB file - the ECMWF '
RuntimeError: Unable to load GRIB file - the ECMWF `gribapi` package is not installed.

I google it and found that gribapi package is not supported for windows, so is there any other options in dealing with grib2 data in Windows? Thank you.

Andrew Dawson

unread,
Feb 22, 2016, 3:51:17 AM2/22/16
to Iris
Unfortunately the ECMWF gribapi software doesn't work on Windows, as you found out, which means that currently iris cannot support loading or saving grib2 on Windows. I'm not aware of any Python libraries that handle grib2 on Windows, I believe pygrib requires Cygwin (a POSIX system on top of Windows, not native), and pynio looks like it is Linux/osx only.
Reply all
Reply to author
Forward
0 new messages