gribfile='gfs20191010.0p25' #file containing 384 hours of forecast data for variable Geopotential Height
grbs=pygrib.open(gribfile)
grb1=grbs.select(name='Geopotential Height')[0:24]
day1 = grb1.values
When I run the above code I get the following error:
AttributeError: 'list' object has no attribute 'values'
The .values key will work when only selecting the first item in the list as shown below:
grb1 = grbs.select(name='Geopotential Height')[0]
But not when I do
grb1 = grbs.select(name='Geopotential Height')[0:24]
I understand that for the .values key the format is dict.values, but I cannot figure out how to retrieve the data within the first 24 list items. My goal is to take in the first 24 files for the selected variable (Geopotential Height) as a numpy array, but in order to do this I need to be able to extract the information contained in each file using .values.
I have been following documentation for pygrib found at: https://jswhit.github.io/pygrib/docs/