pygrib
pygrib copied to clipboard
possible bug accessing grib parameters
I tried the following in a python notebook:
import pygrib
grbs = pygrib.open('Current_db_2021110500_00.grb2')
file = grbs[1]
print(file)
1:Eastward sea water velocity:m s**-1 (instant):regular_ll:depthBelowSea:level 2 m:fcst time 15 mins:from 202111050000
print(file['stepUnits'])
0
print(grbs[1]['stepUnits'])
1
If I first save the single layer in a variable, print it once and access then the 'stepUnits'
I get 0, which is correct for my grib file. If I acess the 'stepUnits'
directly, I get 1, which is wrong.
This doesn't make sense to me - and I can't reproduce it with the sample files I have. Can you post your grib file? (if it's small enough you can just gzip it and attach it to this issue)