pygrib icon indicating copy to clipboard operation
pygrib copied to clipboard

'unknown' data name when installing pygrib with pip

Open PouPass opened this issue 2 years ago • 4 comments

I faced the following issue while using pygrib 2.1.4 installed using pip.

File "src/pygrib/_pygrib.pyx", line 538, in pygrib._pygrib.open.select
ValueError: no matches found

The grib file i used is from ECMWF and contain '2m Temperature' and 'Total precipitation' data.

Ubuntu 22.04.2 LTS, Python==3.8.13 in a conda environement.

Using pip

pip install pygrib

Test case :

import pygrib

grb = pygrib.open('resources/forecast.grib')

for entry in grb.read(10):
	print(entry.name)

Output :

unknown
2 metre temperature
unknown
2 metre temperature
unknown
2 metre temperature
unknown
2 metre temperature
unknown
2 metre temperature

Using conda

conda install pygrib -c conda-forge

Test case :

import pygrib

grb = pygrib.open('resources/forecast.grib')

for entry in grb.read(10):
	print(entry.name)

Output :

Total precipitation
2 metre temperature
Total precipitation
2 metre temperature
Total precipitation
2 metre temperature
Total precipitation
2 metre temperature
Total precipitation
2 metre temperature

PouPass avatar Apr 04 '23 09:04 PouPass

Same issue in #125 and #182 ?

PouPass avatar Apr 04 '23 09:04 PouPass

Some grib records don't have a name attribute, apparently. This is not the fault of pygrib.

jswhit avatar Jul 15 '23 17:07 jswhit

This issue is related to a different behavior of pygrib when installed using pip or conda. I used the same grib file for my tests and the grib records attribute name are returned correctly when pygrib is installed with conda and returned as unknown when pygrib is installed with pip.

PouPass avatar Jul 17 '23 14:07 PouPass

probably conda is using a newer version of eccodes

jswhit avatar Nov 13 '23 01:11 jswhit