pygrib icon indicating copy to clipboard operation
pygrib copied to clipboard

Unable to open a ICON grib file

Open winash12 opened this issue 3 years ago • 4 comments

I am using ICON which is a icosahedral unstructured grid. I am using pygrib to read the file in the following way

`import pygrib import numpy as np

file = './igfff00000000'

grbs = pygrib.open(file)

for g in grbs: lats,lons = g.latlons() print(lats) print(lons) sys.exit()

and when I run this code I get this error message

<frozen importlib._bootstrap>:219: UserWarning: Warning: ecCodes 2.19.1 or higher is recommended. You are running 2.18.0. Traceback (most recent call last): File "test.py", line 13, in <module> lats,lons = g.latlons() File "pygrib/_pygrib.pyx", line 1491, in pygrib._pygrib.gribmessage.latlons ValueError: unsupported grid unstructured_grid

Where am I going wrong ?

winash12 avatar Mar 31 '21 11:03 winash12

the latlons method is failing to create lat and lon values since there is no support for icosahedral grids in pygrib yet. Can you gzip the file (or a subset of the file if it is too big) here so I can take a look?

jswhit avatar Mar 31 '21 12:03 jswhit

@jswhit It's 95 M . Can I put it somewhere on a file server and you can download it from there ?

winash12 avatar Mar 31 '21 12:03 winash12

https://gofile.io/d/r0I6EN

winash12 avatar Mar 31 '21 12:03 winash12

OK, got it. I was hoping there was some information in the file that could be used to generate the lat/lon values from the grid definition. Unfortunately, the only grid information given is 'general unstructured grid', and that's hardly enough to go on. I am afraid there is no way to make the latlons method work for this grid.

jswhit avatar Mar 31 '21 14:03 jswhit