I did not find a solution to my problem so I try to post something about it. If there is an answer somewhere that I did not find I am sorry.
Well, I am using Python 3.10 and Spyder.
I want to work with a GRIB file and I have some difficulties with one of its parameter.
Here is my code :
GRIB_File_Path = r"/Path to my GRIB file/GRIB file name.grb"
gribfile = pygrib.open(GRIB_File_Path)
for grb in gribfile:
print(grb)type here
The output is :
1:10 metre U wind component:m s**-1 (instant):regular_ll:heightAboveGround:level 10:fcst time 0 hrs:from 202404291200
2:10 metre U wind component:m s**-1 (instant):regular_ll:heightAboveGround:level 10:fcst time 1 hrs:from 202404291200
3:10 metre U wind component:m s**-1 (instant):regular_ll:heightAboveGround:level 10:fcst time 2 hrs:from 202404291200
4:10 metre U wind component:m s**-1 (instant):regular_ll:heightAboveGround:level 10:fcst time 3 hrs:from 202404291200
5:10 metre U wind component:m s**-1 (instant):regular_ll:heightAboveGround:level 10:fcst time 4 hrs:from 202404291200
6:10 metre U wind component:m s**-1 (instant):regular_ll:heightAboveGround:level 10:fcst time 5 hrs:from 202404291200
7:10 metre U wind component:m s**-1 (instant):regular_ll:heightAboveGround:level 10:fcst time 6 hrs:from 202404291200
8:10 metre U wind component:m s**-1 (instant):regular_ll:heightAboveGround:level 10:fcst time 7 hrs:from 202404291200
9:10 metre U wind component:m s**-1 (instant):regular_ll:heightAboveGround:level 10:fcst time 8 hrs:from 202404291200
10:10 metre U wind component:m s**-1 (instant):regular_ll:heightAboveGround:level 10:fcst time 9 hrs:from 202404291200
11:10 metre U wind component:m s**-1 (instant):regular_ll:heightAboveGround:level 10:fcst time 10 hrs:from 202404291200
12:10 metre U wind component:m s**-1 (instant):regular_ll:heightAboveGround:level 10:fcst time 11 hrs:from 202404291200
13:10 metre U wind component:m s**-1 (instant):regular_ll:heightAboveGround:level 10:fcst time 12 hrs:from 202404291200
14:10 metre U wind component:m s**-1 (instant):regular_ll:heightAboveGround:level 10:fcst time 13 hrs:from 202404291200
15:10 metre U wind component:m s**-1 (instant):regular_ll:heightAboveGround:level 10:fcst time 14 hrs:from 202404291200
16:10 metre U wind component:m s**-1 (instant):regular_ll:heightAboveGround:level 10:fcst time 15 hrs:from 202404291200
17:10 metre U wind component:m s**-1 (instant):regular_ll:heightAboveGround:level 10:fcst time 16 hrs:from 202404291200
18:10 metre U wind component:m s**-1 (instant):regular_ll:heightAboveGround:level 10:fcst time 17 hrs:from 202404291200
19:10 metre U wind component:m s**-1 (instant):regular_ll:heightAboveGround:level 10:fcst time 18 hrs:from 202404291200
20:10 metre U wind component:m s**-1 (instant):regular_ll:heightAboveGround:level 10:fcst time 19 hrs:from 202404291200
21:10 metre U wind component:m s**-1 (instant):regular_ll:heightAboveGround:level 10:fcst time 20 hrs:from 202404291200
22:10 metre U wind component:m s**-1 (instant):regular_ll:heightAboveGround:level 10:fcst time 21 hrs:from 202404291200
23:10 metre U wind component:m s**-1 (instant):regular_ll:heightAboveGround:level 10:fcst time 22 hrs:from 202404291200
24:10 metre U wind component:m s**-1 (instant):regular_ll:heightAboveGround:level 10:fcst time 23 hrs:from 202404291200
25:10 metre U wind component:m s**-1 (instant):regular_ll:heightAboveGround:level 10:fcst time 24 hrs:from 202404291200
26:10 metre U wind component:m s**-1 (instant):regular_ll:heightAboveGround:level 10:fcst time 25 hrs:from 202404291200
27:10 metre U wind component:m s**-1 (instant):regular_ll:heightAboveGround:level 10:fcst time 26 hrs:from 202404291200
28:10 metre U wind component:m s**-1 (instant):regular_ll:heightAboveGround:level 10:fcst time 27 hrs:from 202404291200
29:10 metre U wind component:m s**-1 (instant):regular_ll:heightAboveGround:level 10:fcst time 28 hrs:from 202404291200
30:10 metre U wind component:m s**-1 (instant):regular_ll:heightAboveGround:level 10:fcst time 29 hrs:from 202404291200
31:10 metre U wind component:m s**-1 (instant):regular_ll:heightAboveGround:level 10:fcst time 30 hrs:from 202404291200
32:10 metre U wind component:m s**-1 (instant):regular_ll:heightAboveGround:level 10:fcst time 31 hrs:from 202404291200
33:10 metre U wind component:m s**-1 (instant):regular_ll:heightAboveGround:level 10:fcst time 32 hrs:from 202404291200
34:10 metre U wind component:m s**-1 (instant):regular_ll:heightAboveGround:level 10:fcst time 33 hrs:from 202404291200
35:10 metre U wind component:m s**-1 (instant):regular_ll:heightAboveGround:level 10:fcst time 34 hrs:from 202404291200
36:10 metre U wind component:m s**-1 (instant):regular_ll:heightAboveGround:level 10:fcst time 35 hrs:from 202404291200
37:10 metre U wind component:m s**-1 (instant):regular_ll:heightAboveGround:level 10:fcst time 36 hrs:from 202404291200
38:10 metre V wind component:m s**-1 (instant):regular_ll:heightAboveGround:level 10:fcst time 0 hrs:from 202404291200
39:10 metre V wind component:m s**-1 (instant):regular_ll:heightAboveGround:level 10:fcst time 1 hrs:from 202404291200
40:10 metre V wind component:m s**-1 (instant):regular_ll:heightAboveGround:level 10:fcst time 2 hrs:from 202404291200
41:10 metre V wind component:m s**-1 (instant):regular_ll:heightAboveGround:level 10:fcst time 3 hrs:from 202404291200
42:10 metre V wind component:m s**-1 (instant):regular_ll:heightAboveGround:level 10:fcst time 4 hrs:from 202404291200
43:10 metre V wind component:m s**-1 (instant):regular_ll:heightAboveGround:level 10:fcst time 5 hrs:from 202404291200
44:10 metre V wind component:m s**-1 (instant):regular_ll:heightAboveGround:level 10:fcst time 6 hrs:from 202404291200
45:10 metre V wind component:m s**-1 (instant):regular_ll:heightAboveGround:level 10:fcst time 7 hrs:from 202404291200
46:10 metre V wind component:m s**-1 (instant):regular_ll:heightAboveGround:level 10:fcst time 8 hrs:from 202404291200
47:10 metre V wind component:m s**-1 (instant):regular_ll:heightAboveGround:level 10:fcst time 9 hrs:from 202404291200
48:10 metre V wind component:m s**-1 (instant):regular_ll:heightAboveGround:level 10:fcst time 10 hrs:from 202404291200
49:10 metre V wind component:m s**-1 (instant):regular_ll:heightAboveGround:level 10:fcst time 11 hrs:from 202404291200
50:10 metre V wind component:m s**-1 (instant):regular_ll:heightAboveGround:level 10:fcst time 12 hrs:from 202404291200
51:10 metre V wind component:m s**-1 (instant):regular_ll:heightAboveGround:level 10:fcst time 13 hrs:from 202404291200
52:10 metre V wind component:m s**-1 (instant):regular_ll:heightAboveGround:level 10:fcst time 14 hrs:from 202404291200
53:10 metre V wind component:m s**-1 (instant):regular_ll:heightAboveGround:level 10:fcst time 15 hrs:from 202404291200
54:10 metre V wind component:m s**-1 (instant):regular_ll:heightAboveGround:level 10:fcst time 16 hrs:from 202404291200
55:10 metre V wind component:m s**-1 (instant):regular_ll:heightAboveGround:level 10:fcst time 17 hrs:from 202404291200
56:10 metre V wind component:m s**-1 (instant):regular_ll:heightAboveGround:level 10:fcst time 18 hrs:from 202404291200
57:10 metre V wind component:m s**-1 (instant):regular_ll:heightAboveGround:level 10:fcst time 19 hrs:from 202404291200
58:10 metre V wind component:m s**-1 (instant):regular_ll:heightAboveGround:level 10:fcst time 20 hrs:from 202404291200
59:10 metre V wind component:m s**-1 (instant):regular_ll:heightAboveGround:level 10:fcst time 21 hrs:from 202404291200
60:10 metre V wind component:m s**-1 (instant):regular_ll:heightAboveGround:level 10:fcst time 22 hrs:from 202404291200
61:10 metre V wind component:m s**-1 (instant):regular_ll:heightAboveGround:level 10:fcst time 23 hrs:from 202404291200
62:10 metre V wind component:m s**-1 (instant):regular_ll:heightAboveGround:level 10:fcst time 24 hrs:from 202404291200
63:10 metre V wind component:m s**-1 (instant):regular_ll:heightAboveGround:level 10:fcst time 25 hrs:from 202404291200
64:10 metre V wind component:m s**-1 (instant):regular_ll:heightAboveGround:level 10:fcst time 26 hrs:from 202404291200
65:10 metre V wind component:m s**-1 (instant):regular_ll:heightAboveGround:level 10:fcst time 27 hrs:from 202404291200
66:10 metre V wind component:m s**-1 (instant):regular_ll:heightAboveGround:level 10:fcst time 28 hrs:from 202404291200
67:10 metre V wind component:m s**-1 (instant):regular_ll:heightAboveGround:level 10:fcst time 29 hrs:from 202404291200
68:10 metre V wind component:m s**-1 (instant):regular_ll:heightAboveGround:level 10:fcst time 30 hrs:from 202404291200
69:10 metre V wind component:m s**-1 (instant):regular_ll:heightAboveGround:level 10:fcst time 31 hrs:from 202404291200
70:10 metre V wind component:m s**-1 (instant):regular_ll:heightAboveGround:level 10:fcst time 32 hrs:from 202404291200
71:10 metre V wind component:m s**-1 (instant):regular_ll:heightAboveGround:level 10:fcst time 33 hrs:from 202404291200
72:10 metre V wind component:m s**-1 (instant):regular_ll:heightAboveGround:level 10:fcst time 34 hrs:from 202404291200
73:10 metre V wind component:m s**-1 (instant):regular_ll:heightAboveGround:level 10:fcst time 35 hrs:from 202404291200
74:10 metre V wind component:m s**-1 (instant):regular_ll:heightAboveGround:level 10:fcst time 36 hrs:from 202404291200
75:180:180 (instant):regular_ll:heightAboveGround:level 10:fcst time 1 hrs:from 202404291200
76:180:180 (instant):regular_ll:heightAboveGround:level 10:fcst time 2 hrs:from 202404291200
77:180:180 (instant):regular_ll:heightAboveGround:level 10:fcst time 3 hrs:from 202404291200
78:180:180 (instant):regular_ll:heightAboveGround:level 10:fcst time 4 hrs:from 202404291200
79:180:180 (instant):regular_ll:heightAboveGround:level 10:fcst time 5 hrs:from 202404291200
80:180:180 (instant):regular_ll:heightAboveGround:level 10:fcst time 6 hrs:from 202404291200
81:180:180 (instant):regular_ll:heightAboveGround:level 10:fcst time 7 hrs:from 202404291200
82:180:180 (instant):regular_ll:heightAboveGround:level 10:fcst time 8 hrs:from 202404291200
83:180:180 (instant):regular_ll:heightAboveGround:level 10:fcst time 9 hrs:from 202404291200
84:180:180 (instant):regular_ll:heightAboveGround:level 10:fcst time 10 hrs:from 202404291200
85:180:180 (instant):regular_ll:heightAboveGround:level 10:fcst time 11 hrs:from 202404291200
86:180:180 (instant):regular_ll:heightAboveGround:level 10:fcst time 12 hrs:from 202404291200
87:180:180 (instant):regular_ll:heightAboveGround:level 10:fcst time 13 hrs:from 202404291200
88:180:180 (instant):regular_ll:heightAboveGround:level 10:fcst time 14 hrs:from 202404291200
89:180:180 (instant):regular_ll:heightAboveGround:level 10:fcst time 15 hrs:from 202404291200
90:180:180 (instant):regular_ll:heightAboveGround:level 10:fcst time 16 hrs:from 202404291200
91:180:180 (instant):regular_ll:heightAboveGround:level 10:fcst time 17 hrs:from 202404291200
92:180:180 (instant):regular_ll:heightAboveGround:level 10:fcst time 18 hrs:from 202404291200
93:180:180 (instant):regular_ll:heightAboveGround:level 10:fcst time 19 hrs:from 202404291200
94:180:180 (instant):regular_ll:heightAboveGround:level 10:fcst time 20 hrs:from 202404291200
95:180:180 (instant):regular_ll:heightAboveGround:level 10:fcst time 21 hrs:from 202404291200
96:180:180 (instant):regular_ll:heightAboveGround:level 10:fcst time 22 hrs:from 202404291200
97:180:180 (instant):regular_ll:heightAboveGround:level 10:fcst time 23 hrs:from 202404291200
98:180:180 (instant):regular_ll:heightAboveGround:level 10:fcst time 24 hrs:from 202404291200
99:180:180 (instant):regular_ll:heightAboveGround:level 10:fcst time 25 hrs:from 202404291200
100:180:180 (instant):regular_ll:heightAboveGround:level 10:fcst time 26 hrs:from 202404291200
101:180:180 (instant):regular_ll:heightAboveGround:level 10:fcst time 27 hrs:from 202404291200
102:180:180 (instant):regular_ll:heightAboveGround:level 10:fcst time 28 hrs:from 202404291200
103:180:180 (instant):regular_ll:heightAboveGround:level 10:fcst time 29 hrs:from 202404291200
104:180:180 (instant):regular_ll:heightAboveGround:level 10:fcst time 30 hrs:from 202404291200
105:180:180 (instant):regular_ll:heightAboveGround:level 10:fcst time 31 hrs:from 202404291200
106:180:180 (instant):regular_ll:heightAboveGround:level 10:fcst time 32 hrs:from 202404291200
107:180:180 (instant):regular_ll:heightAboveGround:level 10:fcst time 33 hrs:from 202404291200
108:180:180 (instant):regular_ll:heightAboveGround:level 10:fcst time 34 hrs:from 202404291200
109:180:180 (instant):regular_ll:heightAboveGround:level 10:fcst time 35 hrs:from 202404291200
110:180:180 (instant):regular_ll:heightAboveGround:level 10:fcst time 36 hrs:from 202404291200
I want to access to the parameter 180, so my code is :
180_Parameter = gribfile.select(name='180')[0]
The output is :
Parameter = gribfile.select(name='180')[0]
File src/pygrib/_pygrib.pyx:575 in pygrib._pygrib.open.select
ValueError: no matches found
So I tried :
Parameter_Name = gribfile[90].parameterName
print(Parameter_Name)
The output is :
180
So I do not understand what I am doing wrong. If someone has an idea I would be happy to listen !
PtitBiscuitRaci is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.