ecmwf / cfgrib

A Python interface to map GRIB files to the NetCDF Common Data Model following the CF Convention using ecCodes

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to read the correct time series from NCEP .grib2

DaiDai-Dad opened this issue · comments

What happened?

I download a grib2 file from NCEP(https://nomads.ncep.noaa.gov/gribfilter.php?ds=gdas_0p25)
and I want get the total precipitation data (html checkbox:APCP, shortName:tp)

I used Panoply to analysis the structure of the file and found that here are 2 times in it:
1: 1025 18:00-1026 03:00
2: 1026 00:00-1026 03:00

I want the 1st

here is my code:
fp = 'atmos@202310260200+009.grib2' flt = {'shortName':'tp'} d1 = xr.open_dataset(fp, engine='cfgrib', backend_kwargs={'indexpath':'', 'filter_by_keys': flt})

but I get the 2nd time series

What are the steps to reproduce the bug?

when I use this:
cfgrib.open_datasets(fp, backend_kwargs={'indexpath':''})
I also got the 2nd time series

when I use pygrib module, it can give me both 2 time series.

Version

python3.9.7, xarray2022.11.0, cfGrib0.9.10.4, ecCodes v2.27.0

Platform (OS and architecture)

Both Win and Linux have tried

Relevant log output

No response

Accompanying data

No response

Organisation

No response

I have already solved this problem:
adding stepRange: '0-9' to filter_keys
It is strongly recommended to list common filters in readme