ecmwf / cfgrib

A Python interface to map GRIB files to the NetCDF Common Data Model following the CF Convention using ecCodes
Apache License 2.0
407 stars 77 forks source link

Ignoring index file #307

Closed wangys666 closed 2 years ago

wangys666 commented 2 years ago

Hello. When use cfgrib to open GFS grib files, mulitple warnings shows like: Ignoring index file 'gfs.t12z.pgrb2.0p25.f005.923a8.idx' incompatible with GRIB file.

After warnings, the code still works. A issue mentioned the same problem before, upgraded cfgrib version to 0.9.10 can solve that problem, but don't work for me.

my package version:

cfgrib =0.9.10.1 eccodes=2.26.0 xarray =2022.6.0

my code like:

f = cfgrib.open_datasets(file,
                             backend_kwargs={'filter_by_keys': {'typeOfLevel': 'heightAboveGround'}})
iainrussell commented 2 years ago

Hi @wangys666,

You should be able to delete these .idx files and then the warnings should disappear. If your files do not have so many fields, you can disable the indexing feature by adding 'indexpath': '' to your backend_kwargs.

Best regards, Iain

wangys666 commented 2 years ago

Hi Iain, thanks for the reply. Deteling .idx files didn't let the wanings disapear. But I add 'indexpath': ${idx file GFS provided}, to backend_kwargs, and the warnings disappeared. Thank you!

Hi @wangys666,

You should be able to delete these .idx files and then the warnings should disappear. If your files do not have so many fields, you can disable the indexing feature by adding 'indexpath': '' to your backend_kwargs.

Best regards, Iain

iainrussell commented 2 years ago

You're welcome, glad you got it working!