Pygrib and Basemap

Main goals of this lecture:

  1. Open a grib file and make a simple plot
  2. Make a cross section plot
  3. Read multiple grib files and extract a specific point to a timeseries

1. Open a grib file and make a simple plot


In [1]:
import pygrib
from matplotlib import pyplot as plt
import numpy as np
%matplotlib inline

In [2]:
grbs = pygrib.open('data/gfs.t00z.pgrb2.0p25.f006')

The file can be iterated to show all of the grib messages. In each message there are informations like name, units, type of level, level, valid date and forecast date


In [3]:
for grb in grbs:
    print grb


1:U component of wind:m s**-1 (instant):regular_ll:unknown:level 0 220:fcst time 6 hrs:from 201702060000
2:V component of wind:m s**-1 (instant):regular_ll:unknown:level 0 220:fcst time 6 hrs:from 201702060000
3:224:224 (instant):regular_ll:unknown:level 0 220:fcst time 6 hrs:from 201702060000
4:Wind speed (gust):m s**-1 (instant):regular_ll:surface:level 0:fcst time 6 hrs:from 201702060000
5:Geopotential Height:gpm (instant):regular_ll:isobaricInhPa:level 100 Pa:fcst time 6 hrs:from 201702060000
6:Temperature:K (instant):regular_ll:isobaricInhPa:level 100 Pa:fcst time 6 hrs:from 201702060000
7:Relative humidity:% (instant):regular_ll:isobaricInhPa:level 100 Pa:fcst time 6 hrs:from 201702060000
8:U component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 100 Pa:fcst time 6 hrs:from 201702060000
9:V component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 100 Pa:fcst time 6 hrs:from 201702060000
10:Ozone mixing ratio:kg kg**-1 (instant):regular_ll:isobaricInhPa:level 100 Pa:fcst time 6 hrs:from 201702060000
11:Geopotential Height:gpm (instant):regular_ll:isobaricInhPa:level 200 Pa:fcst time 6 hrs:from 201702060000
12:Temperature:K (instant):regular_ll:isobaricInhPa:level 200 Pa:fcst time 6 hrs:from 201702060000
13:Relative humidity:% (instant):regular_ll:isobaricInhPa:level 200 Pa:fcst time 6 hrs:from 201702060000
14:U component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 200 Pa:fcst time 6 hrs:from 201702060000
15:V component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 200 Pa:fcst time 6 hrs:from 201702060000
16:Ozone mixing ratio:kg kg**-1 (instant):regular_ll:isobaricInhPa:level 200 Pa:fcst time 6 hrs:from 201702060000
17:Geopotential Height:gpm (instant):regular_ll:isobaricInhPa:level 300 Pa:fcst time 6 hrs:from 201702060000
18:Temperature:K (instant):regular_ll:isobaricInhPa:level 300 Pa:fcst time 6 hrs:from 201702060000
19:Relative humidity:% (instant):regular_ll:isobaricInhPa:level 300 Pa:fcst time 6 hrs:from 201702060000
20:U component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 300 Pa:fcst time 6 hrs:from 201702060000
21:V component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 300 Pa:fcst time 6 hrs:from 201702060000
22:Ozone mixing ratio:kg kg**-1 (instant):regular_ll:isobaricInhPa:level 300 Pa:fcst time 6 hrs:from 201702060000
23:Geopotential Height:gpm (instant):regular_ll:isobaricInhPa:level 500 Pa:fcst time 6 hrs:from 201702060000
24:Temperature:K (instant):regular_ll:isobaricInhPa:level 500 Pa:fcst time 6 hrs:from 201702060000
25:Relative humidity:% (instant):regular_ll:isobaricInhPa:level 500 Pa:fcst time 6 hrs:from 201702060000
26:U component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 500 Pa:fcst time 6 hrs:from 201702060000
27:V component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 500 Pa:fcst time 6 hrs:from 201702060000
28:Ozone mixing ratio:kg kg**-1 (instant):regular_ll:isobaricInhPa:level 500 Pa:fcst time 6 hrs:from 201702060000
29:Geopotential Height:gpm (instant):regular_ll:isobaricInhPa:level 700 Pa:fcst time 6 hrs:from 201702060000
30:Temperature:K (instant):regular_ll:isobaricInhPa:level 700 Pa:fcst time 6 hrs:from 201702060000
31:Relative humidity:% (instant):regular_ll:isobaricInhPa:level 700 Pa:fcst time 6 hrs:from 201702060000
32:U component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 700 Pa:fcst time 6 hrs:from 201702060000
33:V component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 700 Pa:fcst time 6 hrs:from 201702060000
34:Ozone mixing ratio:kg kg**-1 (instant):regular_ll:isobaricInhPa:level 700 Pa:fcst time 6 hrs:from 201702060000
35:Geopotential Height:gpm (instant):regular_ll:isobaricInhPa:level 1000 Pa:fcst time 6 hrs:from 201702060000
36:Temperature:K (instant):regular_ll:isobaricInhPa:level 1000 Pa:fcst time 6 hrs:from 201702060000
37:Relative humidity:% (instant):regular_ll:isobaricInhPa:level 1000 Pa:fcst time 6 hrs:from 201702060000
38:U component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 1000 Pa:fcst time 6 hrs:from 201702060000
39:V component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 1000 Pa:fcst time 6 hrs:from 201702060000
40:Absolute vorticity:s**-1 (instant):regular_ll:isobaricInhPa:level 1000 Pa:fcst time 6 hrs:from 201702060000
41:Ozone mixing ratio:kg kg**-1 (instant):regular_ll:isobaricInhPa:level 1000 Pa:fcst time 6 hrs:from 201702060000
42:Geopotential Height:gpm (instant):regular_ll:isobaricInhPa:level 2000 Pa:fcst time 6 hrs:from 201702060000
43:Temperature:K (instant):regular_ll:isobaricInhPa:level 2000 Pa:fcst time 6 hrs:from 201702060000
44:Relative humidity:% (instant):regular_ll:isobaricInhPa:level 2000 Pa:fcst time 6 hrs:from 201702060000
45:U component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 2000 Pa:fcst time 6 hrs:from 201702060000
46:V component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 2000 Pa:fcst time 6 hrs:from 201702060000
47:Absolute vorticity:s**-1 (instant):regular_ll:isobaricInhPa:level 2000 Pa:fcst time 6 hrs:from 201702060000
48:Ozone mixing ratio:kg kg**-1 (instant):regular_ll:isobaricInhPa:level 2000 Pa:fcst time 6 hrs:from 201702060000
49:Geopotential Height:gpm (instant):regular_ll:isobaricInhPa:level 3000 Pa:fcst time 6 hrs:from 201702060000
50:Temperature:K (instant):regular_ll:isobaricInhPa:level 3000 Pa:fcst time 6 hrs:from 201702060000
51:Relative humidity:% (instant):regular_ll:isobaricInhPa:level 3000 Pa:fcst time 6 hrs:from 201702060000
52:U component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 3000 Pa:fcst time 6 hrs:from 201702060000
53:V component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 3000 Pa:fcst time 6 hrs:from 201702060000
54:Absolute vorticity:s**-1 (instant):regular_ll:isobaricInhPa:level 3000 Pa:fcst time 6 hrs:from 201702060000
55:Ozone mixing ratio:kg kg**-1 (instant):regular_ll:isobaricInhPa:level 3000 Pa:fcst time 6 hrs:from 201702060000
56:Geopotential Height:gpm (instant):regular_ll:isobaricInhPa:level 5000 Pa:fcst time 6 hrs:from 201702060000
57:Temperature:K (instant):regular_ll:isobaricInhPa:level 5000 Pa:fcst time 6 hrs:from 201702060000
58:Relative humidity:% (instant):regular_ll:isobaricInhPa:level 5000 Pa:fcst time 6 hrs:from 201702060000
59:U component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 5000 Pa:fcst time 6 hrs:from 201702060000
60:V component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 5000 Pa:fcst time 6 hrs:from 201702060000
61:Absolute vorticity:s**-1 (instant):regular_ll:isobaricInhPa:level 5000 Pa:fcst time 6 hrs:from 201702060000
62:Ozone mixing ratio:kg kg**-1 (instant):regular_ll:isobaricInhPa:level 5000 Pa:fcst time 6 hrs:from 201702060000
63:Geopotential Height:gpm (instant):regular_ll:isobaricInhPa:level 7000 Pa:fcst time 6 hrs:from 201702060000
64:Temperature:K (instant):regular_ll:isobaricInhPa:level 7000 Pa:fcst time 6 hrs:from 201702060000
65:Relative humidity:% (instant):regular_ll:isobaricInhPa:level 7000 Pa:fcst time 6 hrs:from 201702060000
66:U component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 7000 Pa:fcst time 6 hrs:from 201702060000
67:V component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 7000 Pa:fcst time 6 hrs:from 201702060000
68:Absolute vorticity:s**-1 (instant):regular_ll:isobaricInhPa:level 7000 Pa:fcst time 6 hrs:from 201702060000
69:Ozone mixing ratio:kg kg**-1 (instant):regular_ll:isobaricInhPa:level 7000 Pa:fcst time 6 hrs:from 201702060000
70:Geopotential Height:gpm (instant):regular_ll:isobaricInhPa:level 10000 Pa:fcst time 6 hrs:from 201702060000
71:Temperature:K (instant):regular_ll:isobaricInhPa:level 10000 Pa:fcst time 6 hrs:from 201702060000
72:Relative humidity:% (instant):regular_ll:isobaricInhPa:level 10000 Pa:fcst time 6 hrs:from 201702060000
73:Vertical velocity:Pa s**-1 (instant):regular_ll:isobaricInhPa:level 10000 Pa:fcst time 6 hrs:from 201702060000
74:U component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 10000 Pa:fcst time 6 hrs:from 201702060000
75:V component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 10000 Pa:fcst time 6 hrs:from 201702060000
76:Absolute vorticity:s**-1 (instant):regular_ll:isobaricInhPa:level 10000 Pa:fcst time 6 hrs:from 201702060000
77:Cloud mixing ratio:kg kg**-1 (instant):regular_ll:isobaricInhPa:level 10000 Pa:fcst time 6 hrs:from 201702060000
78:234:234 (instant):regular_ll:isobaricInhPa:level 10000 Pa:fcst time 6 hrs:from 201702060000
79:Ozone mixing ratio:kg kg**-1 (instant):regular_ll:isobaricInhPa:level 10000 Pa:fcst time 6 hrs:from 201702060000
80:Geopotential Height:gpm (instant):regular_ll:isobaricInhPa:level 15000 Pa:fcst time 6 hrs:from 201702060000
81:Temperature:K (instant):regular_ll:isobaricInhPa:level 15000 Pa:fcst time 6 hrs:from 201702060000
82:Relative humidity:% (instant):regular_ll:isobaricInhPa:level 15000 Pa:fcst time 6 hrs:from 201702060000
83:Vertical velocity:Pa s**-1 (instant):regular_ll:isobaricInhPa:level 15000 Pa:fcst time 6 hrs:from 201702060000
84:U component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 15000 Pa:fcst time 6 hrs:from 201702060000
85:V component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 15000 Pa:fcst time 6 hrs:from 201702060000
86:Absolute vorticity:s**-1 (instant):regular_ll:isobaricInhPa:level 15000 Pa:fcst time 6 hrs:from 201702060000
87:Cloud mixing ratio:kg kg**-1 (instant):regular_ll:isobaricInhPa:level 15000 Pa:fcst time 6 hrs:from 201702060000
88:234:234 (instant):regular_ll:isobaricInhPa:level 15000 Pa:fcst time 6 hrs:from 201702060000
89:Ozone mixing ratio:kg kg**-1 (instant):regular_ll:isobaricInhPa:level 15000 Pa:fcst time 6 hrs:from 201702060000
90:Geopotential Height:gpm (instant):regular_ll:isobaricInhPa:level 20000 Pa:fcst time 6 hrs:from 201702060000
91:Temperature:K (instant):regular_ll:isobaricInhPa:level 20000 Pa:fcst time 6 hrs:from 201702060000
92:Relative humidity:% (instant):regular_ll:isobaricInhPa:level 20000 Pa:fcst time 6 hrs:from 201702060000
93:Vertical velocity:Pa s**-1 (instant):regular_ll:isobaricInhPa:level 20000 Pa:fcst time 6 hrs:from 201702060000
94:U component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 20000 Pa:fcst time 6 hrs:from 201702060000
95:V component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 20000 Pa:fcst time 6 hrs:from 201702060000
96:Absolute vorticity:s**-1 (instant):regular_ll:isobaricInhPa:level 20000 Pa:fcst time 6 hrs:from 201702060000
97:Cloud mixing ratio:kg kg**-1 (instant):regular_ll:isobaricInhPa:level 20000 Pa:fcst time 6 hrs:from 201702060000
98:234:234 (instant):regular_ll:isobaricInhPa:level 20000 Pa:fcst time 6 hrs:from 201702060000
99:Ozone mixing ratio:kg kg**-1 (instant):regular_ll:isobaricInhPa:level 20000 Pa:fcst time 6 hrs:from 201702060000
100:Geopotential Height:gpm (instant):regular_ll:isobaricInhPa:level 25000 Pa:fcst time 6 hrs:from 201702060000
101:Temperature:K (instant):regular_ll:isobaricInhPa:level 25000 Pa:fcst time 6 hrs:from 201702060000
102:Relative humidity:% (instant):regular_ll:isobaricInhPa:level 25000 Pa:fcst time 6 hrs:from 201702060000
103:Vertical velocity:Pa s**-1 (instant):regular_ll:isobaricInhPa:level 25000 Pa:fcst time 6 hrs:from 201702060000
104:U component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 25000 Pa:fcst time 6 hrs:from 201702060000
105:V component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 25000 Pa:fcst time 6 hrs:from 201702060000
106:Absolute vorticity:s**-1 (instant):regular_ll:isobaricInhPa:level 25000 Pa:fcst time 6 hrs:from 201702060000
107:Cloud mixing ratio:kg kg**-1 (instant):regular_ll:isobaricInhPa:level 25000 Pa:fcst time 6 hrs:from 201702060000
108:234:234 (instant):regular_ll:isobaricInhPa:level 25000 Pa:fcst time 6 hrs:from 201702060000
109:Ozone mixing ratio:kg kg**-1 (instant):regular_ll:isobaricInhPa:level 25000 Pa:fcst time 6 hrs:from 201702060000
110:Geopotential Height:gpm (instant):regular_ll:isobaricInhPa:level 30000 Pa:fcst time 6 hrs:from 201702060000
111:Temperature:K (instant):regular_ll:isobaricInhPa:level 30000 Pa:fcst time 6 hrs:from 201702060000
112:Relative humidity:% (instant):regular_ll:isobaricInhPa:level 30000 Pa:fcst time 6 hrs:from 201702060000
113:Vertical velocity:Pa s**-1 (instant):regular_ll:isobaricInhPa:level 30000 Pa:fcst time 6 hrs:from 201702060000
114:U component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 30000 Pa:fcst time 6 hrs:from 201702060000
115:V component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 30000 Pa:fcst time 6 hrs:from 201702060000
116:Absolute vorticity:s**-1 (instant):regular_ll:isobaricInhPa:level 30000 Pa:fcst time 6 hrs:from 201702060000
117:Cloud mixing ratio:kg kg**-1 (instant):regular_ll:isobaricInhPa:level 30000 Pa:fcst time 6 hrs:from 201702060000
118:234:234 (instant):regular_ll:isobaricInhPa:level 30000 Pa:fcst time 6 hrs:from 201702060000
119:Ozone mixing ratio:kg kg**-1 (instant):regular_ll:isobaricInhPa:level 30000 Pa:fcst time 6 hrs:from 201702060000
120:Geopotential Height:gpm (instant):regular_ll:isobaricInhPa:level 35000 Pa:fcst time 6 hrs:from 201702060000
121:Temperature:K (instant):regular_ll:isobaricInhPa:level 35000 Pa:fcst time 6 hrs:from 201702060000
122:Relative humidity:% (instant):regular_ll:isobaricInhPa:level 35000 Pa:fcst time 6 hrs:from 201702060000
123:Vertical velocity:Pa s**-1 (instant):regular_ll:isobaricInhPa:level 35000 Pa:fcst time 6 hrs:from 201702060000
124:U component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 35000 Pa:fcst time 6 hrs:from 201702060000
125:V component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 35000 Pa:fcst time 6 hrs:from 201702060000
126:Absolute vorticity:s**-1 (instant):regular_ll:isobaricInhPa:level 35000 Pa:fcst time 6 hrs:from 201702060000
127:Cloud mixing ratio:kg kg**-1 (instant):regular_ll:isobaricInhPa:level 35000 Pa:fcst time 6 hrs:from 201702060000
128:234:234 (instant):regular_ll:isobaricInhPa:level 35000 Pa:fcst time 6 hrs:from 201702060000
129:Ozone mixing ratio:kg kg**-1 (instant):regular_ll:isobaricInhPa:level 35000 Pa:fcst time 6 hrs:from 201702060000
130:Geopotential Height:gpm (instant):regular_ll:isobaricInhPa:level 40000 Pa:fcst time 6 hrs:from 201702060000
131:Temperature:K (instant):regular_ll:isobaricInhPa:level 40000 Pa:fcst time 6 hrs:from 201702060000
132:Relative humidity:% (instant):regular_ll:isobaricInhPa:level 40000 Pa:fcst time 6 hrs:from 201702060000
133:Vertical velocity:Pa s**-1 (instant):regular_ll:isobaricInhPa:level 40000 Pa:fcst time 6 hrs:from 201702060000
134:U component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 40000 Pa:fcst time 6 hrs:from 201702060000
135:V component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 40000 Pa:fcst time 6 hrs:from 201702060000
136:Absolute vorticity:s**-1 (instant):regular_ll:isobaricInhPa:level 40000 Pa:fcst time 6 hrs:from 201702060000
137:Cloud mixing ratio:kg kg**-1 (instant):regular_ll:isobaricInhPa:level 40000 Pa:fcst time 6 hrs:from 201702060000
138:234:234 (instant):regular_ll:isobaricInhPa:level 40000 Pa:fcst time 6 hrs:from 201702060000
139:Ozone mixing ratio:kg kg**-1 (instant):regular_ll:isobaricInhPa:level 40000 Pa:fcst time 6 hrs:from 201702060000
140:Geopotential Height:gpm (instant):regular_ll:isobaricInhPa:level 45000 Pa:fcst time 6 hrs:from 201702060000
141:Temperature:K (instant):regular_ll:isobaricInhPa:level 45000 Pa:fcst time 6 hrs:from 201702060000
142:Relative humidity:% (instant):regular_ll:isobaricInhPa:level 45000 Pa:fcst time 6 hrs:from 201702060000
143:Vertical velocity:Pa s**-1 (instant):regular_ll:isobaricInhPa:level 45000 Pa:fcst time 6 hrs:from 201702060000
144:U component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 45000 Pa:fcst time 6 hrs:from 201702060000
145:V component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 45000 Pa:fcst time 6 hrs:from 201702060000
146:Absolute vorticity:s**-1 (instant):regular_ll:isobaricInhPa:level 45000 Pa:fcst time 6 hrs:from 201702060000
147:Cloud mixing ratio:kg kg**-1 (instant):regular_ll:isobaricInhPa:level 45000 Pa:fcst time 6 hrs:from 201702060000
148:234:234 (instant):regular_ll:isobaricInhPa:level 45000 Pa:fcst time 6 hrs:from 201702060000
149:Geopotential Height:gpm (instant):regular_ll:isobaricInhPa:level 50000 Pa:fcst time 6 hrs:from 201702060000
150:Temperature:K (instant):regular_ll:isobaricInhPa:level 50000 Pa:fcst time 6 hrs:from 201702060000
151:Relative humidity:% (instant):regular_ll:isobaricInhPa:level 50000 Pa:fcst time 6 hrs:from 201702060000
152:Vertical velocity:Pa s**-1 (instant):regular_ll:isobaricInhPa:level 50000 Pa:fcst time 6 hrs:from 201702060000
153:U component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 50000 Pa:fcst time 6 hrs:from 201702060000
154:V component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 50000 Pa:fcst time 6 hrs:from 201702060000
155:Absolute vorticity:s**-1 (instant):regular_ll:isobaricInhPa:level 50000 Pa:fcst time 6 hrs:from 201702060000
156:Cloud mixing ratio:kg kg**-1 (instant):regular_ll:isobaricInhPa:level 50000 Pa:fcst time 6 hrs:from 201702060000
157:234:234 (instant):regular_ll:isobaricInhPa:level 50000 Pa:fcst time 6 hrs:from 201702060000
158:Geopotential Height:gpm (instant):regular_ll:isobaricInhPa:level 55000 Pa:fcst time 6 hrs:from 201702060000
159:Temperature:K (instant):regular_ll:isobaricInhPa:level 55000 Pa:fcst time 6 hrs:from 201702060000
160:Relative humidity:% (instant):regular_ll:isobaricInhPa:level 55000 Pa:fcst time 6 hrs:from 201702060000
161:Vertical velocity:Pa s**-1 (instant):regular_ll:isobaricInhPa:level 55000 Pa:fcst time 6 hrs:from 201702060000
162:U component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 55000 Pa:fcst time 6 hrs:from 201702060000
163:V component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 55000 Pa:fcst time 6 hrs:from 201702060000
164:Absolute vorticity:s**-1 (instant):regular_ll:isobaricInhPa:level 55000 Pa:fcst time 6 hrs:from 201702060000
165:Cloud mixing ratio:kg kg**-1 (instant):regular_ll:isobaricInhPa:level 55000 Pa:fcst time 6 hrs:from 201702060000
166:234:234 (instant):regular_ll:isobaricInhPa:level 55000 Pa:fcst time 6 hrs:from 201702060000
167:Geopotential Height:gpm (instant):regular_ll:isobaricInhPa:level 60000 Pa:fcst time 6 hrs:from 201702060000
168:Temperature:K (instant):regular_ll:isobaricInhPa:level 60000 Pa:fcst time 6 hrs:from 201702060000
169:Relative humidity:% (instant):regular_ll:isobaricInhPa:level 60000 Pa:fcst time 6 hrs:from 201702060000
170:Vertical velocity:Pa s**-1 (instant):regular_ll:isobaricInhPa:level 60000 Pa:fcst time 6 hrs:from 201702060000
171:U component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 60000 Pa:fcst time 6 hrs:from 201702060000
172:V component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 60000 Pa:fcst time 6 hrs:from 201702060000
173:Absolute vorticity:s**-1 (instant):regular_ll:isobaricInhPa:level 60000 Pa:fcst time 6 hrs:from 201702060000
174:Cloud mixing ratio:kg kg**-1 (instant):regular_ll:isobaricInhPa:level 60000 Pa:fcst time 6 hrs:from 201702060000
175:234:234 (instant):regular_ll:isobaricInhPa:level 60000 Pa:fcst time 6 hrs:from 201702060000
176:Geopotential Height:gpm (instant):regular_ll:isobaricInhPa:level 65000 Pa:fcst time 6 hrs:from 201702060000
177:Temperature:K (instant):regular_ll:isobaricInhPa:level 65000 Pa:fcst time 6 hrs:from 201702060000
178:Relative humidity:% (instant):regular_ll:isobaricInhPa:level 65000 Pa:fcst time 6 hrs:from 201702060000
179:Vertical velocity:Pa s**-1 (instant):regular_ll:isobaricInhPa:level 65000 Pa:fcst time 6 hrs:from 201702060000
180:U component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 65000 Pa:fcst time 6 hrs:from 201702060000
181:V component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 65000 Pa:fcst time 6 hrs:from 201702060000
182:Absolute vorticity:s**-1 (instant):regular_ll:isobaricInhPa:level 65000 Pa:fcst time 6 hrs:from 201702060000
183:Cloud mixing ratio:kg kg**-1 (instant):regular_ll:isobaricInhPa:level 65000 Pa:fcst time 6 hrs:from 201702060000
184:234:234 (instant):regular_ll:isobaricInhPa:level 65000 Pa:fcst time 6 hrs:from 201702060000
185:Geopotential Height:gpm (instant):regular_ll:isobaricInhPa:level 70000 Pa:fcst time 6 hrs:from 201702060000
186:Temperature:K (instant):regular_ll:isobaricInhPa:level 70000 Pa:fcst time 6 hrs:from 201702060000
187:Relative humidity:% (instant):regular_ll:isobaricInhPa:level 70000 Pa:fcst time 6 hrs:from 201702060000
188:Vertical velocity:Pa s**-1 (instant):regular_ll:isobaricInhPa:level 70000 Pa:fcst time 6 hrs:from 201702060000
189:U component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 70000 Pa:fcst time 6 hrs:from 201702060000
190:V component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 70000 Pa:fcst time 6 hrs:from 201702060000
191:Absolute vorticity:s**-1 (instant):regular_ll:isobaricInhPa:level 70000 Pa:fcst time 6 hrs:from 201702060000
192:Cloud mixing ratio:kg kg**-1 (instant):regular_ll:isobaricInhPa:level 70000 Pa:fcst time 6 hrs:from 201702060000
193:234:234 (instant):regular_ll:isobaricInhPa:level 70000 Pa:fcst time 6 hrs:from 201702060000
194:Geopotential Height:gpm (instant):regular_ll:isobaricInhPa:level 75000 Pa:fcst time 6 hrs:from 201702060000
195:Temperature:K (instant):regular_ll:isobaricInhPa:level 75000 Pa:fcst time 6 hrs:from 201702060000
196:Relative humidity:% (instant):regular_ll:isobaricInhPa:level 75000 Pa:fcst time 6 hrs:from 201702060000
197:Vertical velocity:Pa s**-1 (instant):regular_ll:isobaricInhPa:level 75000 Pa:fcst time 6 hrs:from 201702060000
198:U component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 75000 Pa:fcst time 6 hrs:from 201702060000
199:V component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 75000 Pa:fcst time 6 hrs:from 201702060000
200:Absolute vorticity:s**-1 (instant):regular_ll:isobaricInhPa:level 75000 Pa:fcst time 6 hrs:from 201702060000
201:Cloud mixing ratio:kg kg**-1 (instant):regular_ll:isobaricInhPa:level 75000 Pa:fcst time 6 hrs:from 201702060000
202:234:234 (instant):regular_ll:isobaricInhPa:level 75000 Pa:fcst time 6 hrs:from 201702060000
203:Geopotential Height:gpm (instant):regular_ll:isobaricInhPa:level 80000 Pa:fcst time 6 hrs:from 201702060000
204:Temperature:K (instant):regular_ll:isobaricInhPa:level 80000 Pa:fcst time 6 hrs:from 201702060000
205:Relative humidity:% (instant):regular_ll:isobaricInhPa:level 80000 Pa:fcst time 6 hrs:from 201702060000
206:Vertical velocity:Pa s**-1 (instant):regular_ll:isobaricInhPa:level 80000 Pa:fcst time 6 hrs:from 201702060000
207:U component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 80000 Pa:fcst time 6 hrs:from 201702060000
208:V component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 80000 Pa:fcst time 6 hrs:from 201702060000
209:Absolute vorticity:s**-1 (instant):regular_ll:isobaricInhPa:level 80000 Pa:fcst time 6 hrs:from 201702060000
210:Cloud mixing ratio:kg kg**-1 (instant):regular_ll:isobaricInhPa:level 80000 Pa:fcst time 6 hrs:from 201702060000
211:234:234 (instant):regular_ll:isobaricInhPa:level 80000 Pa:fcst time 6 hrs:from 201702060000
212:Geopotential Height:gpm (instant):regular_ll:isobaricInhPa:level 85000 Pa:fcst time 6 hrs:from 201702060000
213:Temperature:K (instant):regular_ll:isobaricInhPa:level 85000 Pa:fcst time 6 hrs:from 201702060000
214:Relative humidity:% (instant):regular_ll:isobaricInhPa:level 85000 Pa:fcst time 6 hrs:from 201702060000
215:Vertical velocity:Pa s**-1 (instant):regular_ll:isobaricInhPa:level 85000 Pa:fcst time 6 hrs:from 201702060000
216:U component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 85000 Pa:fcst time 6 hrs:from 201702060000
217:V component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 85000 Pa:fcst time 6 hrs:from 201702060000
218:Absolute vorticity:s**-1 (instant):regular_ll:isobaricInhPa:level 85000 Pa:fcst time 6 hrs:from 201702060000
219:Cloud mixing ratio:kg kg**-1 (instant):regular_ll:isobaricInhPa:level 85000 Pa:fcst time 6 hrs:from 201702060000
220:234:234 (instant):regular_ll:isobaricInhPa:level 85000 Pa:fcst time 6 hrs:from 201702060000
221:Geopotential Height:gpm (instant):regular_ll:isobaricInhPa:level 90000 Pa:fcst time 6 hrs:from 201702060000
222:Temperature:K (instant):regular_ll:isobaricInhPa:level 90000 Pa:fcst time 6 hrs:from 201702060000
223:Relative humidity:% (instant):regular_ll:isobaricInhPa:level 90000 Pa:fcst time 6 hrs:from 201702060000
224:Vertical velocity:Pa s**-1 (instant):regular_ll:isobaricInhPa:level 90000 Pa:fcst time 6 hrs:from 201702060000
225:U component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 90000 Pa:fcst time 6 hrs:from 201702060000
226:V component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 90000 Pa:fcst time 6 hrs:from 201702060000
227:Absolute vorticity:s**-1 (instant):regular_ll:isobaricInhPa:level 90000 Pa:fcst time 6 hrs:from 201702060000
228:Cloud mixing ratio:kg kg**-1 (instant):regular_ll:isobaricInhPa:level 90000 Pa:fcst time 6 hrs:from 201702060000
229:234:234 (instant):regular_ll:isobaricInhPa:level 90000 Pa:fcst time 6 hrs:from 201702060000
230:Geopotential Height:gpm (instant):regular_ll:isobaricInhPa:level 92500 Pa:fcst time 6 hrs:from 201702060000
231:Temperature:K (instant):regular_ll:isobaricInhPa:level 92500 Pa:fcst time 6 hrs:from 201702060000
232:Relative humidity:% (instant):regular_ll:isobaricInhPa:level 92500 Pa:fcst time 6 hrs:from 201702060000
233:Vertical velocity:Pa s**-1 (instant):regular_ll:isobaricInhPa:level 92500 Pa:fcst time 6 hrs:from 201702060000
234:U component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 92500 Pa:fcst time 6 hrs:from 201702060000
235:V component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 92500 Pa:fcst time 6 hrs:from 201702060000
236:Absolute vorticity:s**-1 (instant):regular_ll:isobaricInhPa:level 92500 Pa:fcst time 6 hrs:from 201702060000
237:Cloud mixing ratio:kg kg**-1 (instant):regular_ll:isobaricInhPa:level 92500 Pa:fcst time 6 hrs:from 201702060000
238:Geopotential Height:gpm (instant):regular_ll:isobaricInhPa:level 95000 Pa:fcst time 6 hrs:from 201702060000
239:Temperature:K (instant):regular_ll:isobaricInhPa:level 95000 Pa:fcst time 6 hrs:from 201702060000
240:Relative humidity:% (instant):regular_ll:isobaricInhPa:level 95000 Pa:fcst time 6 hrs:from 201702060000
241:Vertical velocity:Pa s**-1 (instant):regular_ll:isobaricInhPa:level 95000 Pa:fcst time 6 hrs:from 201702060000
242:U component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 95000 Pa:fcst time 6 hrs:from 201702060000
243:V component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 95000 Pa:fcst time 6 hrs:from 201702060000
244:Absolute vorticity:s**-1 (instant):regular_ll:isobaricInhPa:level 95000 Pa:fcst time 6 hrs:from 201702060000
245:Cloud mixing ratio:kg kg**-1 (instant):regular_ll:isobaricInhPa:level 95000 Pa:fcst time 6 hrs:from 201702060000
246:234:234 (instant):regular_ll:isobaricInhPa:level 95000 Pa:fcst time 6 hrs:from 201702060000
247:2:2 (instant):regular_ll:surface:level 0:fcst time 6 hrs:from 201702060000
248:Geopotential Height:gpm (instant):regular_ll:isobaricInhPa:level 97500 Pa:fcst time 6 hrs:from 201702060000
249:Temperature:K (instant):regular_ll:isobaricInhPa:level 97500 Pa:fcst time 6 hrs:from 201702060000
250:Relative humidity:% (instant):regular_ll:isobaricInhPa:level 97500 Pa:fcst time 6 hrs:from 201702060000
251:Vertical velocity:Pa s**-1 (instant):regular_ll:isobaricInhPa:level 97500 Pa:fcst time 6 hrs:from 201702060000
252:U component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 97500 Pa:fcst time 6 hrs:from 201702060000
253:V component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 97500 Pa:fcst time 6 hrs:from 201702060000
254:Absolute vorticity:s**-1 (instant):regular_ll:isobaricInhPa:level 97500 Pa:fcst time 6 hrs:from 201702060000
255:Cloud mixing ratio:kg kg**-1 (instant):regular_ll:isobaricInhPa:level 97500 Pa:fcst time 6 hrs:from 201702060000
256:Temperature:K (instant):regular_ll:isobaricInhPa:level 100000 Pa:fcst time 6 hrs:from 201702060000
257:Relative humidity:% (instant):regular_ll:isobaricInhPa:level 100000 Pa:fcst time 6 hrs:from 201702060000
258:Vertical velocity:Pa s**-1 (instant):regular_ll:isobaricInhPa:level 100000 Pa:fcst time 6 hrs:from 201702060000
259:U component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 100000 Pa:fcst time 6 hrs:from 201702060000
260:V component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 100000 Pa:fcst time 6 hrs:from 201702060000
261:Absolute vorticity:s**-1 (instant):regular_ll:isobaricInhPa:level 100000 Pa:fcst time 6 hrs:from 201702060000
262:Cloud mixing ratio:kg kg**-1 (instant):regular_ll:isobaricInhPa:level 100000 Pa:fcst time 6 hrs:from 201702060000
263:234:234 (instant):regular_ll:isobaricInhPa:level 100000 Pa:fcst time 6 hrs:from 201702060000
264:MSLP (Eta model reduction):Pa (instant):regular_ll:meanSea:level 0:fcst time 6 hrs:from 201702060000
265:Geopotential Height:gpm (instant):regular_ll:isobaricInhPa:level 100000 Pa:fcst time 6 hrs:from 201702060000
266:Surface pressure:Pa (instant):regular_ll:surface:level 0:fcst time 6 hrs:from 201702060000
267:Orography:m (instant):regular_ll:surface:level 0:fcst time 6 hrs:from 201702060000
268:Temperature:K (instant):regular_ll:surface:level 0:fcst time 6 hrs:from 201702060000
269:Soil temperature:K (instant):regular_ll:depthBelowLandLayer:levels 0.0-0.1 m:fcst time 6 hrs:from 201702060000
270:Volumetric soil moisture content:Proportion (instant):regular_ll:depthBelowLandLayer:levels 0.0-0.1 m:fcst time 6 hrs:from 201702060000
271:Soil temperature:K (instant):regular_ll:depthBelowLandLayer:levels 0.1-0.4 m:fcst time 6 hrs:from 201702060000
272:Volumetric soil moisture content:Proportion (instant):regular_ll:depthBelowLandLayer:levels 0.1-0.4 m:fcst time 6 hrs:from 201702060000
273:Soil temperature:K (instant):regular_ll:depthBelowLandLayer:levels 0.4-1.0 m:fcst time 6 hrs:from 201702060000
274:Volumetric soil moisture content:Proportion (instant):regular_ll:depthBelowLandLayer:levels 0.4-1.0 m:fcst time 6 hrs:from 201702060000
275:Soil temperature:K (instant):regular_ll:depthBelowLandLayer:levels 1.0-2.0 m:fcst time 6 hrs:from 201702060000
276:Volumetric soil moisture content:Proportion (instant):regular_ll:depthBelowLandLayer:levels 1.0-2.0 m:fcst time 6 hrs:from 201702060000
277:Water equivalent of accumulated snow depth:kg m**-2 (instant):regular_ll:surface:level 0:fcst time 6 hrs:from 201702060000
278:Water equivalent of accumulated snow depth:kg m**-2 (instant):regular_ll:surface:level 0:fcst time 6 hrs:from 201702060000
279:Potential evaporation rate:W m**-2 (instant):regular_ll:surface:level 0:fcst time 6 hrs:from 201702060000
280:2 metre temperature:K (instant):regular_ll:heightAboveGround:level 2 m:fcst time 6 hrs:from 201702060000
281:Specific humidity:kg kg**-1 (instant):regular_ll:heightAboveGround:level 2 m:fcst time 6 hrs:from 201702060000
282:2 metre dewpoint temperature:K (instant):regular_ll:heightAboveGround:level 2 m:fcst time 6 hrs:from 201702060000
283:Relative humidity:% (instant):regular_ll:heightAboveGround:level 2 m:fcst time 6 hrs:from 201702060000
284:21:21 (instant):regular_ll:heightAboveGround:level 2 m:fcst time 6 hrs:from 201702060000
285:Maximum temperature:K (max):regular_ll:heightAboveGround:level 2 m:fcst time 0-6 hrs (max):from 201702060000
286:Minimum temperature:K (min):regular_ll:heightAboveGround:level 2 m:fcst time 0-6 hrs (min):from 201702060000
287:10 metre U wind component:m s**-1 (instant):regular_ll:heightAboveGround:level 10 m:fcst time 6 hrs:from 201702060000
288:10 metre V wind component:m s**-1 (instant):regular_ll:heightAboveGround:level 10 m:fcst time 6 hrs:from 201702060000
289:Percent frozen precipitation:% (instant):regular_ll:surface:level 0:fcst time 6 hrs:from 201702060000
290:Convective precipitation rate:kg m**-2 s**-1 (avg):regular_ll:surface:level 0:fcst time 0-6 hrs (avg):from 201702060000
291:Precipitation rate:kg m**-2 s**-1 (avg):regular_ll:surface:level 0:fcst time 0-6 hrs (avg):from 201702060000
292:Total Precipitation:kg m**-2 (accum):regular_ll:surface:level 0:fcst time 0-6 hrs (accum):from 201702060000
293:Convective precipitation (water):kg m**-2 (accum):regular_ll:surface:level 0:fcst time 0-6 hrs (accum):from 201702060000
294:Water runoff:kg m**-2 (accum):regular_ll:surface:level 0:fcst time 0-6 hrs (accum):from 201702060000
295:Categorical snow:(Code table 4.222) (avg):regular_ll:surface:level 0:fcst time 0-6 hrs (avg):from 201702060000
296:Categorical ice pellets:(Code table 4.222) (avg):regular_ll:surface:level 0:fcst time 0-6 hrs (avg):from 201702060000
297:Categorical freezing rain:(Code table 4.222) (avg):regular_ll:surface:level 0:fcst time 0-6 hrs (avg):from 201702060000
298:Categorical rain:(Code table 4.222) (avg):regular_ll:surface:level 0:fcst time 0-6 hrs (avg):from 201702060000
299:Latent heat net flux:W m**-2 (avg):regular_ll:surface:level 0:fcst time 0-6 hrs (avg):from 201702060000
300:Sensible heat net flux:W m**-2 (avg):regular_ll:surface:level 0:fcst time 0-6 hrs (avg):from 201702060000
301:Ground heat flux:W m**-2 (avg):regular_ll:surface:level 0:fcst time 0-6 hrs (avg):from 201702060000
302:Momentum flux, u component:N m**-2 (avg):regular_ll:surface:level 0:fcst time 0-6 hrs (avg):from 201702060000
303:Momentum flux, v component:N m**-2 (avg):regular_ll:surface:level 0:fcst time 0-6 hrs (avg):from 201702060000
304:Zonal flux of gravity wave stress:N m**-2 (avg):regular_ll:surface:level 0:fcst time 0-6 hrs (avg):from 201702060000
305:Meridional flux of gravity wave stress:N m**-2 (avg):regular_ll:surface:level 0:fcst time 0-6 hrs (avg):from 201702060000
306:Wilting Point:Fraction (instant):regular_ll:surface:level 0:fcst time 6 hrs:from 201702060000
307:Field Capacity:Fraction (instant):regular_ll:surface:level 0:fcst time 6 hrs:from 201702060000
308:201:201 (instant):regular_ll:surface:level 0:fcst time 6 hrs:from 201702060000
309:Surface lifted index:K (instant):regular_ll:surface:level 0:fcst time 6 hrs:from 201702060000
310:Convective available potential energy:J kg**-1 (instant):regular_ll:surface:level 0:fcst time 6 hrs:from 201702060000
311:Convective inhibition:J kg**-1 (instant):regular_ll:surface:level 0:fcst time 6 hrs:from 201702060000
312:Precipitable water:kg m**-2 (instant):regular_ll:unknown:level 0 200:fcst time 6 hrs:from 201702060000
313:Cloud water:kg m**-2 (instant):regular_ll:unknown:level 0 200:fcst time 6 hrs:from 201702060000
314:Relative humidity:% (instant):regular_ll:unknown:level 0 200:fcst time 6 hrs:from 201702060000
315:Total ozone:Dobson (instant):regular_ll:unknown:level 0 200:fcst time 6 hrs:from 201702060000
316:Total Cloud Cover:% (avg):regular_ll:unknown:level 0 214:fcst time 0-6 hrs (avg):from 201702060000
317:Total Cloud Cover:% (avg):regular_ll:unknown:level 0 224:fcst time 0-6 hrs (avg):from 201702060000
318:Total Cloud Cover:% (avg):regular_ll:unknown:level 0 234:fcst time 0-6 hrs (avg):from 201702060000
319:Total Cloud Cover:% (avg):regular_ll:unknown:level 0 10:fcst time 0-6 hrs (avg):from 201702060000
320:Pressure:Pa (instant):regular_ll:unknown:level 0 242:fcst time 6 hrs:from 201702060000
321:Pressure:Pa (avg):regular_ll:unknown:level 0 212:fcst time 0-6 hrs (avg):from 201702060000
322:Pressure:Pa (avg):regular_ll:unknown:level 0 222:fcst time 0-6 hrs (avg):from 201702060000
323:Pressure:Pa (avg):regular_ll:unknown:level 0 232:fcst time 0-6 hrs (avg):from 201702060000
324:Pressure:Pa (instant):regular_ll:unknown:level 0 243:fcst time 6 hrs:from 201702060000
325:Pressure:Pa (avg):regular_ll:unknown:level 0 213:fcst time 0-6 hrs (avg):from 201702060000
326:Pressure:Pa (avg):regular_ll:unknown:level 0 223:fcst time 0-6 hrs (avg):from 201702060000
327:Pressure:Pa (avg):regular_ll:unknown:level 0 233:fcst time 0-6 hrs (avg):from 201702060000
328:Temperature:K (avg):regular_ll:unknown:level 0 213:fcst time 0-6 hrs (avg):from 201702060000
329:Temperature:K (avg):regular_ll:unknown:level 0 223:fcst time 0-6 hrs (avg):from 201702060000
330:Temperature:K (avg):regular_ll:unknown:level 0 233:fcst time 0-6 hrs (avg):from 201702060000
331:Total Cloud Cover:% (instant):regular_ll:unknown:level 0 244:fcst time 6 hrs:from 201702060000
332:Total Cloud Cover:% (avg):regular_ll:unknown:level 0 211:fcst time 0-6 hrs (avg):from 201702060000
333:Cloud work function:J kg**-1 (avg):regular_ll:unknown:level 0 200:fcst time 0-6 hrs (avg):from 201702060000
334:Downward short-wave radiation flux:W m**-2 (avg):regular_ll:surface:level 0:fcst time 0-6 hrs (avg):from 201702060000
335:Downward long-wave radiation flux:W m**-2 (avg):regular_ll:surface:level 0:fcst time 0-6 hrs (avg):from 201702060000
336:Upward short-wave radiation flux:W m**-2 (avg):regular_ll:surface:level 0:fcst time 0-6 hrs (avg):from 201702060000
337:Upward long-wave radiation flux:W m**-2 (avg):regular_ll:surface:level 0:fcst time 0-6 hrs (avg):from 201702060000
338:Upward short-wave radiation flux:W m**-2 (avg):regular_ll:nominalTop:level 0:fcst time 0-6 hrs (avg):from 201702060000
339:Upward long-wave radiation flux:W m**-2 (avg):regular_ll:nominalTop:level 0:fcst time 0-6 hrs (avg):from 201702060000
340:Storm relative helicity:J kg**-1 (instant):regular_ll:heightAboveGroundLayer:levels 3000-0 m:fcst time 6 hrs:from 201702060000
341:U-component storm motion:m s**-1 (instant):regular_ll:heightAboveGroundLayer:levels 6000-0 m:fcst time 6 hrs:from 201702060000
342:V-component storm motion:m s**-1 (instant):regular_ll:heightAboveGroundLayer:levels 6000-0 m:fcst time 6 hrs:from 201702060000
343:Pressure:Pa (instant):regular_ll:tropopause:level 0:fcst time 6 hrs:from 201702060000
344:ICAO Standard Atmosphere reference height:m (instant):regular_ll:tropopause:level 0:fcst time 6 hrs:from 201702060000
345:Geopotential Height:gpm (instant):regular_ll:tropopause:level 0:fcst time 6 hrs:from 201702060000
346:Temperature:K (instant):regular_ll:tropopause:level 0:fcst time 6 hrs:from 201702060000
347:U component of wind:m s**-1 (instant):regular_ll:tropopause:level 0:fcst time 6 hrs:from 201702060000
348:V component of wind:m s**-1 (instant):regular_ll:tropopause:level 0:fcst time 6 hrs:from 201702060000
349:Vertical speed shear:s**-1 (instant):regular_ll:tropopause:level 0:fcst time 6 hrs:from 201702060000
350:Pressure:Pa (instant):regular_ll:maxWind:level 0:fcst time 6 hrs:from 201702060000
351:ICAO Standard Atmosphere reference height:m (instant):regular_ll:maxWind:level 0:fcst time 6 hrs:from 201702060000
352:Geopotential Height:gpm (instant):regular_ll:maxWind:level 0:fcst time 6 hrs:from 201702060000
353:U component of wind:m s**-1 (instant):regular_ll:maxWind:level 0:fcst time 6 hrs:from 201702060000
354:V component of wind:m s**-1 (instant):regular_ll:maxWind:level 0:fcst time 6 hrs:from 201702060000
355:Temperature:K (instant):regular_ll:maxWind:level 0:fcst time 6 hrs:from 201702060000
356:2 metre temperature:K (instant):regular_ll:heightAboveGround:level 80 m:fcst time 6 hrs:from 201702060000
357:Specific humidity:kg kg**-1 (instant):regular_ll:heightAboveGround:level 80 m:fcst time 6 hrs:from 201702060000
358:Pressure:Pa (instant):regular_ll:heightAboveGround:level 80 m:fcst time 6 hrs:from 201702060000
359:U component of wind:m s**-1 (instant):regular_ll:heightAboveGround:level 80 m:fcst time 6 hrs:from 201702060000
360:V component of wind:m s**-1 (instant):regular_ll:heightAboveGround:level 80 m:fcst time 6 hrs:from 201702060000
361:2 metre temperature:K (instant):regular_ll:heightAboveGround:level 100 m:fcst time 6 hrs:from 201702060000
362:U component of wind:m s**-1 (instant):regular_ll:heightAboveGround:level 100 m:fcst time 6 hrs:from 201702060000
363:V component of wind:m s**-1 (instant):regular_ll:heightAboveGround:level 100 m:fcst time 6 hrs:from 201702060000
364:Temperature:K (instant):regular_ll:heightAboveSea:level 1829 m:fcst time 6 hrs:from 201702060000
365:U component of wind:m s**-1 (instant):regular_ll:heightAboveSea:level 1829 m:fcst time 6 hrs:from 201702060000
366:V component of wind:m s**-1 (instant):regular_ll:heightAboveSea:level 1829 m:fcst time 6 hrs:from 201702060000
367:Temperature:K (instant):regular_ll:heightAboveSea:level 2743 m:fcst time 6 hrs:from 201702060000
368:U component of wind:m s**-1 (instant):regular_ll:heightAboveSea:level 2743 m:fcst time 6 hrs:from 201702060000
369:V component of wind:m s**-1 (instant):regular_ll:heightAboveSea:level 2743 m:fcst time 6 hrs:from 201702060000
370:Temperature:K (instant):regular_ll:heightAboveSea:level 3658 m:fcst time 6 hrs:from 201702060000
371:U component of wind:m s**-1 (instant):regular_ll:heightAboveSea:level 3658 m:fcst time 6 hrs:from 201702060000
372:V component of wind:m s**-1 (instant):regular_ll:heightAboveSea:level 3658 m:fcst time 6 hrs:from 201702060000
373:Geopotential Height:gpm (instant):regular_ll:isothermZero:level 0:fcst time 6 hrs:from 201702060000
374:Relative humidity:% (instant):regular_ll:isothermZero:level 0:fcst time 6 hrs:from 201702060000
375:Geopotential Height:gpm (instant):regular_ll:unknown:level 0 204:fcst time 6 hrs:from 201702060000
376:Relative humidity:% (instant):regular_ll:unknown:level 0 204:fcst time 6 hrs:from 201702060000
377:Temperature:K (instant):regular_ll:pressureFromGroundLayer:levels 3000-0 Pa:fcst time 6 hrs:from 201702060000
378:Relative humidity:% (instant):regular_ll:pressureFromGroundLayer:levels 3000-0 Pa:fcst time 6 hrs:from 201702060000
379:Specific humidity:kg kg**-1 (instant):regular_ll:pressureFromGroundLayer:levels 3000-0 Pa:fcst time 6 hrs:from 201702060000
380:U component of wind:m s**-1 (instant):regular_ll:pressureFromGroundLayer:levels 3000-0 Pa:fcst time 6 hrs:from 201702060000
381:V component of wind:m s**-1 (instant):regular_ll:pressureFromGroundLayer:levels 3000-0 Pa:fcst time 6 hrs:from 201702060000
382:Best (4-layer) lifted index:K (instant):regular_ll:surface:level 0:fcst time 6 hrs:from 201702060000
383:Convective available potential energy:J kg**-1 (instant):regular_ll:pressureFromGroundLayer:levels 18000-0 Pa:fcst time 6 hrs:from 201702060000
384:Convective inhibition:J kg**-1 (instant):regular_ll:pressureFromGroundLayer:levels 18000-0 Pa:fcst time 6 hrs:from 201702060000
385:Planetary boundary layer height:m (instant):regular_ll:surface:level 0:fcst time 6 hrs:from 201702060000
386:Relative humidity:% (instant):regular_ll:sigmaLayer:levels 0.33-1.0 sigma value:fcst time 6 hrs:from 201702060000
387:Relative humidity:% (instant):regular_ll:sigmaLayer:levels 0.44-1.0 sigma value:fcst time 6 hrs:from 201702060000
388:Relative humidity:% (instant):regular_ll:sigmaLayer:levels 0.72-0.94 sigma value:fcst time 6 hrs:from 201702060000
389:Relative humidity:% (instant):regular_ll:sigmaLayer:levels 0.44-0.72 sigma value:fcst time 6 hrs:from 201702060000
390:Temperature:K (instant):regular_ll:sigma:level 0.995 sigma value:fcst time 6 hrs:from 201702060000
391:Potential temperature:K (instant):regular_ll:sigma:level 0.995 sigma value:fcst time 6 hrs:from 201702060000
392:Relative humidity:% (instant):regular_ll:sigma:level 0.995 sigma value:fcst time 6 hrs:from 201702060000
393:U component of wind:m s**-1 (instant):regular_ll:sigma:level 0.995 sigma value:fcst time 6 hrs:from 201702060000
394:V component of wind:m s**-1 (instant):regular_ll:sigma:level 0.995 sigma value:fcst time 6 hrs:from 201702060000
395:Vertical velocity:Pa s**-1 (instant):regular_ll:sigma:level 0.995 sigma value:fcst time 6 hrs:from 201702060000
396:Convective available potential energy:J kg**-1 (instant):regular_ll:pressureFromGroundLayer:levels 25500-0 Pa:fcst time 6 hrs:from 201702060000
397:Convective inhibition:J kg**-1 (instant):regular_ll:pressureFromGroundLayer:levels 25500-0 Pa:fcst time 6 hrs:from 201702060000
398:Pressure of level from which parcel was lifted:Pa (instant):regular_ll:pressureFromGroundLayer:levels 25500-0 Pa:fcst time 6 hrs:from 201702060000
399:Land-sea mask:(0 - 1) (instant):regular_ll:surface:level 0:fcst time 6 hrs:from 201702060000
400:Ice cover:Proportion (instant):regular_ll:surface:level 0:fcst time 6 hrs:from 201702060000
401:Albedo:% (avg):regular_ll:surface:level 0:fcst time 0-6 hrs (avg):from 201702060000
402:U component of wind:m s**-1 (instant):regular_ll:potentialVorticity:level 2e-06 K m2 kg-1 s-1:fcst time 6 hrs:from 201702060000
403:V component of wind:m s**-1 (instant):regular_ll:potentialVorticity:level 2e-06 K m2 kg-1 s-1:fcst time 6 hrs:from 201702060000
404:Temperature:K (instant):regular_ll:potentialVorticity:level 2e-06 K m2 kg-1 s-1:fcst time 6 hrs:from 201702060000
405:Geopotential Height:gpm (instant):regular_ll:potentialVorticity:level 2e-06 K m2 kg-1 s-1:fcst time 6 hrs:from 201702060000
406:Pressure:Pa (instant):regular_ll:potentialVorticity:level 2e-06 K m2 kg-1 s-1:fcst time 6 hrs:from 201702060000
407:Vertical speed shear:s**-1 (instant):regular_ll:potentialVorticity:level 2e-06 K m2 kg-1 s-1:fcst time 6 hrs:from 201702060000
408:U component of wind:m s**-1 (instant):regular_ll:potentialVorticity:level 2.147485648 K m2 kg-1 s-1:fcst time 6 hrs:from 201702060000
409:V component of wind:m s**-1 (instant):regular_ll:potentialVorticity:level 2.147485648 K m2 kg-1 s-1:fcst time 6 hrs:from 201702060000
410:Temperature:K (instant):regular_ll:potentialVorticity:level 2.147485648 K m2 kg-1 s-1:fcst time 6 hrs:from 201702060000
411:Geopotential Height:gpm (instant):regular_ll:potentialVorticity:level 2.147485648 K m2 kg-1 s-1:fcst time 6 hrs:from 201702060000
412:Pressure:Pa (instant):regular_ll:potentialVorticity:level 2.147485648 K m2 kg-1 s-1:fcst time 6 hrs:from 201702060000
413:Vertical speed shear:s**-1 (instant):regular_ll:potentialVorticity:level 2.147485648 K m2 kg-1 s-1:fcst time 6 hrs:from 201702060000
414:Pressure reduced to MSL:Pa (instant):regular_ll:meanSea:level 0:fcst time 6 hrs:from 201702060000
415:5-wave geopotential height:gpm (instant):regular_ll:isobaricInhPa:level 50000 Pa:fcst time 6 hrs:from 201702060000

Each of those messages have a set of attributes, or keys, which can be used for searching


In [4]:
for key in grb.keys():
    print key


parametersVersion
definitionFilesVersion
truncateDegrees
offset
count
countTotal
unitsFactor
unitsBias
globalDomain
libraryVersion
kindOfProduct
GRIBEditionNumber
grib2divider
missingValue
ieeeFloats
section0Length
identifier
discipline
editionNumber
totalLength
sectionNumber
section1Length
numberOfSection
centre
subCentre
tablesVersion
masterDir
localTablesVersion
significanceOfReferenceTime
year
month
day
hour
minute
second
dataDate
julianDay
dataTime
productionStatusOfProcessedData
typeOfProcessedData
selectStepTemplateInterval
selectStepTemplateInstant
stepType
sectionNumber
grib2LocalSectionPresent
sectionNumber
gridDescriptionSectionPresent
section3Length
numberOfSection
sourceOfGridDefinition
numberOfDataPoints
numberOfOctectsForNumberOfPoints
interpretationOfNumberOfPoints
PLPresent
gridDefinitionTemplateNumber
shapeOfTheEarth
scaleFactorOfRadiusOfSphericalEarth
scaledValueOfRadiusOfSphericalEarth
scaleFactorOfEarthMajorAxis
scaledValueOfEarthMajorAxis
scaleFactorOfEarthMinorAxis
scaledValueOfEarthMinorAxis
radius
Ni
Nj
basicAngleOfTheInitialProductionDomain
mBasicAngle
angleMultiplier
mAngleMultiplier
subdivisionsOfBasicAngle
angleDivisor
latitudeOfFirstGridPoint
longitudeOfFirstGridPoint
resolutionAndComponentFlags
resolutionAndComponentFlags1
resolutionAndComponentFlags2
iDirectionIncrementGiven
jDirectionIncrementGiven
uvRelativeToGrid
resolutionAndComponentFlags6
resolutionAndComponentFlags7
resolutionAndComponentFlags8
ijDirectionIncrementGiven
latitudeOfLastGridPoint
longitudeOfLastGridPoint
iDirectionIncrement
jDirectionIncrement
scanningMode
iScansNegatively
jScansPositively
jPointsAreConsecutive
alternativeRowScanning
iScansPositively
scanningMode5
scanningMode6
scanningMode7
scanningMode8
g2grid
latitudeOfFirstGridPointInDegrees
longitudeOfFirstGridPointInDegrees
latitudeOfLastGridPointInDegrees
longitudeOfLastGridPointInDegrees
iDirectionIncrementInDegrees
jDirectionIncrementInDegrees
latLonValues
latitudes
longitudes
distinctLatitudes
distinctLongitudes
gridType
sectionNumber
section4Length
numberOfSection
NV
neitherPresent
productDefinitionTemplateNumber
parameterCategory
parameterNumber
parameterUnits
parameterName
typeOfGeneratingProcess
backgroundProcess
generatingProcessIdentifier
hoursAfterDataCutoff
minutesAfterDataCutoff
indicatorOfUnitOfTimeRange
stepUnits
forecastTime
startStep
endStep
stepRange
stepTypeInternal
validityDate
validityTime
typeOfFirstFixedSurface
unitsOfFirstFixedSurface
nameOfFirstFixedSurface
scaleFactorOfFirstFixedSurface
scaledValueOfFirstFixedSurface
typeOfSecondFixedSurface
unitsOfSecondFixedSurface
nameOfSecondFixedSurface
scaleFactorOfSecondFixedSurface
scaledValueOfSecondFixedSurface
pressureUnits
typeOfLevel
level
bottomLevel
topLevel
paramIdECMF
paramId
shortNameECMF
shortName
unitsECMF
units
nameECMF
name
ifsParam
PVPresent
sectionNumber
section5Length
numberOfSection
numberOfValues
dataRepresentationTemplateNumber
packingType
referenceValue
referenceValueError
binaryScaleFactor
decimalScaleFactor
bitsPerValue
typeOfOriginalFieldValues
groupSplittingMethodUsed
missingValueManagementUsed
primaryMissingValueSubstitute
secondaryMissingValueSubstitute
numberOfGroupsOfDataValues
referenceForGroupWidths
numberOfBitsUsedForTheGroupWidths
referenceForGroupLengths
lengthIncrementForTheGroupLengths
trueLengthOfLastGroup
numberOfBitsForScaledGroupLengths
orderOfSpatialDifferencing
numberOfOctetsExtraDescriptors
lengthOfHeaders
sectionNumber
section6Length
numberOfSection
bitMapIndicator
bitmapPresent
sectionNumber
section7Length
numberOfSection
codedValues
values
maximum
minimum
average
numberOfMissing
standardDeviation
skewness
kurtosis
isConstant
changeDecimalPrecision
decimalPrecision
setBitsPerValue
getNumberOfValues
scaleValuesBy
offsetValuesBy
productType
section8Length
analDate
validDate

Those keys can be used to filter variables. If I want the 10 metre above the ground wind, I can use the name key, the typeOfLevel and level. This will return a list of grib messages that have been found. Using the [0] selects the first element in that list


In [5]:
u10_grb = grbs.select(name='10 metre U wind component', typeOfLevel='heightAboveGround', level=10)[0]
v10_grb = grbs.select(name='10 metre V wind component', typeOfLevel='heightAboveGround', level=10)[0]
t2_grb = grbs.select(name='2 metre temperature', typeOfLevel='heightAboveGround', level=2)[0]

The key values can be used in my object to return a numpy array of data


In [6]:
u10 = u10_grb.values
v10 = v10_grb.values
t2 = t2_grb.values
print t2.shape, u10.shape, v10.shape


(721, 1440) (721, 1440) (721, 1440)

Using grib_message.latslons will return a 2D numpy array of latitudes and longitudes


In [7]:
lats, lons = u10_grb.latlons()
print lats.shape, lons.shape, lats.min(), lats.max(), lons.min(), lons.max()


(721, 1440) (721, 1440) -90.0 90.0 0.0 359.75

In [8]:
print lats
print lons


[[ 90.    90.    90.   ...,  90.    90.    90.  ]
 [ 89.75  89.75  89.75 ...,  89.75  89.75  89.75]
 [ 89.5   89.5   89.5  ...,  89.5   89.5   89.5 ]
 ..., 
 [-89.5  -89.5  -89.5  ..., -89.5  -89.5  -89.5 ]
 [-89.75 -89.75 -89.75 ..., -89.75 -89.75 -89.75]
 [-90.   -90.   -90.   ..., -90.   -90.   -90.  ]]
[[  0.00000000e+00   2.50000000e-01   5.00000000e-01 ...,   3.59250000e+02
    3.59500000e+02   3.59750000e+02]
 [  0.00000000e+00   2.50000000e-01   5.00000000e-01 ...,   3.59250000e+02
    3.59500000e+02   3.59750000e+02]
 [  0.00000000e+00   2.50000000e-01   5.00000000e-01 ...,   3.59250000e+02
    3.59500000e+02   3.59750000e+02]
 ..., 
 [  0.00000000e+00   2.50000000e-01   5.00000000e-01 ...,   3.59250000e+02
    3.59500000e+02   3.59750000e+02]
 [  0.00000000e+00   2.50000000e-01   5.00000000e-01 ...,   3.59250000e+02
    3.59500000e+02   3.59750000e+02]
 [  0.00000000e+00   2.50000000e-01   5.00000000e-01 ...,   3.59250000e+02
    3.59500000e+02   3.59750000e+02]]

To plot that data we can use Basemap http://matplotlib.org/basemap/users/index.html

" The matplotlib basemap toolkit is a library for plotting 2D data on maps in Python (...) Basemap is geared toward the needs of earth scientists, particular oceanographers and meteorologists (...) "


In [9]:
from mpl_toolkits.basemap import Basemap

A simple image can be plotted using the min and max values in the lats and lons variables. We can create a map object m defining the lower corner and uper corner longitude and latitude, llcrnrlon(lat) and urcrnrlon(lat). Then we can use the matplotlib functions to make the temperature and wind plot.


In [10]:
fig = plt.figure(figsize=(16,35))
m = Basemap(llcrnrlon=lons.min(), llcrnrlat=lats.min(), urcrnrlon=lons.max(), urcrnrlat=lats.max())

m.drawcoastlines()
m.drawcountries()

skip = 20

cs = m.contourf(lons, lats, t2)
qv = m.quiver(lons[::skip, ::skip], lats[::skip, ::skip], u10[::skip, ::skip], v10[::skip, ::skip])


/home/rafaelca/anaconda/lib/python2.7/site-packages/mpl_toolkits/basemap/__init__.py:3608: MatplotlibDeprecationWarning: The ishold function was deprecated in version 2.0.
  b = ax.ishold()
/home/rafaelca/anaconda/lib/python2.7/site-packages/mpl_toolkits/basemap/__init__.py:3677: MatplotlibDeprecationWarning: axes.hold is deprecated.
    See the API Changes document (http://matplotlib.org/api/api_changes.html)
    for more details.
  ax.hold(b)
/home/rafaelca/anaconda/lib/python2.7/site-packages/mpl_toolkits/basemap/__init__.py:3707: MatplotlibDeprecationWarning: The ishold function was deprecated in version 2.0.
  b = ax.ishold()
/home/rafaelca/anaconda/lib/python2.7/site-packages/mpl_toolkits/basemap/__init__.py:3716: MatplotlibDeprecationWarning: axes.hold is deprecated.
    See the API Changes document (http://matplotlib.org/api/api_changes.html)
    for more details.
  ax.hold(b)

There are many different projections to choose from in Basemap:

  • Azimuthal Equidistant Projection
  • Gnomonic Projection
  • Orthographic Projection
  • Geostationary Projection
  • Near-Sided Perspective Projection
  • Mollweide Projection
  • Hammer Projection
  • Robinson Projection
  • Eckert IV Projection
  • Kavrayskiy VII Projection
  • McBryde-Thomas Flat Polar Quartic
  • Sinusoidal Projection
  • Equidistant Cylindrical Projection
  • Cassini Projection
  • Mercator Projection
  • Transverse Mercator Projection
  • Oblique Mercator Projection
  • Polyconic Projection
  • Miller Cylindrical Projection
  • Gall Stereographic Projection
  • Cylindrial Equal-Area Projection
  • Lambert Conformal Projection
  • Lambert Azimuthal Equal Area Projection
  • Stereographic Projection
  • Equidistant Conic Projection
  • Albers Equal Area Projection
  • Polar Stereographic Projection
  • Polar Lambert Azimuthal Projection
  • Polar Azimuthal Equidistant Projection
  • van der Grinten Projection

In [11]:
fig = plt.figure(figsize=(20,20))

ax1 = fig.add_subplot(121)
ax1.set_title('Orthographic Projection')

m = Basemap(projection='ortho',lat_0=-15,lon_0=300, ax=ax1)

m.drawcoastlines()
m.drawcountries()

skip = 20

x, y = m(lons, lats)

cs = m.contourf(x, y, t2)
qv = m.quiver(x[::skip, ::skip], y[::skip, ::skip], u10[::skip, ::skip], v10[::skip, ::skip])

ax2 = fig.add_subplot(122)
ax2.set_title('Polar Azimuthal Equidistant Projection')

m = Basemap(projection='spaeqd',boundinglat=-10,lon_0=270, ax=ax2)

m.drawcoastlines()
m.drawcountries()

skip = 20

x, y = m(lons, lats)

cs = m.contourf(x, y, t2)
qv = m.quiver(x[::skip, ::skip], y[::skip, ::skip], u10[::skip, ::skip], v10[::skip, ::skip])


/home/rafaelca/anaconda/lib/python2.7/site-packages/mpl_toolkits/basemap/__init__.py:1623: MatplotlibDeprecationWarning: The get_axis_bgcolor function was deprecated in version 2.0. Use get_facecolor instead.
  fill_color = ax.get_axis_bgcolor()

As my data is sorted from 0 to 360 in longitude, you need to reorder them from -180 to 180. To do so we can create a functions called flip_grid that takes the variable that we want to reorder and my longitude 2D array. An if statment can be used to check if the variable is 2D or 3D.


In [12]:
def flip_grid(var, lons):
    fltr = lons[0] >= 180
    newlons = np.concatenate(((lons - 360)[:, fltr], lons[:, ~fltr]), axis=-1)
    if var.ndim == 2:
        newvar = np.concatenate((var[:, fltr], var[:, ~fltr]), axis=-1)
    elif var.ndim == 3:
        newvar = np.concatenate((var[:, :, fltr], var[:, :, ~fltr]), axis=-1)
        
    return newvar, newlons

The flip_grid function is used to reorder u10, v10 and t2 variables, and the data is ploted


In [13]:
u10, newlons = flip_grid(u10, lons)
v10, newlons = flip_grid(v10, lons)
t2, newlons = flip_grid(t2, lons)

In [14]:
fig = plt.figure(figsize=(16,35))
m = Basemap(llcrnrlon=newlons.min(), llcrnrlat=lats.min(), urcrnrlon=newlons.max(), urcrnrlat=lats.max())

m.drawcoastlines()
m.drawcountries()

skip = 20

cs = m.contourf(newlons, lats, t2)
qv = m.quiver(newlons[::skip, ::skip], lats[::skip, ::skip], u10[::skip, ::skip], v10[::skip, ::skip])


To make a more regional plot, we can set different boundary lattitudes and longitudes. Also, we are able to use most of the matplotlib tools to make a more sofisticated plot


In [15]:
fig = plt.figure(figsize=(12,25))
m = Basemap(llcrnrlon=-100, llcrnrlat=-60, urcrnrlon=-20, urcrnrlat=10, resolution='i')

parallels = np.arange(-90, 90, 10)
meridians = np.arange(0, 360, 10)

m.drawcoastlines()
m.drawcountries()
m.drawstates() # bad idea!!! >.<
m.drawmeridians(meridians, labels=[0, 0, 0, 1])
m.drawparallels(parallels, labels=[1, 0, 0, 0])

skip = 10

plt.title('Temp. a 2 metros e Vento a 10 metros: %s' % u10_grb.validDate)

cs = m.contourf(newlons, lats, t2 - 273.15, cmap='RdYlBu_r')
cbar = m.colorbar(cs)
cbar.set_label(r'Temperatura ($^{o}$C)')
qv = m.quiver(newlons[::skip, ::skip], lats[::skip, ::skip], u10[::skip, ::skip], v10[::skip, ::skip], scale=300)
qk = plt.quiverkey(qv, 0.9, 1.015, 20, '20 m/s', labelpos='W')


We can use the functions readshapefile to load a shapefile with a updated version of the political boundaries of the brazilian states. (For more examples on how to use it, check the following link: http://basemaptutorial.readthedocs.io/en/latest/shapefile.html )


In [16]:
fig = plt.figure(figsize=(12,25))
m = Basemap(llcrnrlon=-100, llcrnrlat=-60, urcrnrlon=-20, urcrnrlat=10, resolution='i')

parallels = np.arange(-90, 90, 10)
meridians = np.arange(0, 360, 10)

m.drawcoastlines()
m.drawcountries()
m.readshapefile('/home/rafaelca/estados_2010_shapefile/estados_2010', 'estado_2010') # much better now :D
m.drawmeridians(meridians, labels=[0, 0, 0, 1])
m.drawparallels(parallels, labels=[1, 0, 0, 0])

skip = 10

plt.title('Temp. a 2 metros e Vento a 10 metros: %s' % u10_grb.validDate)

cs = m.contourf(newlons, lats, t2 - 273.15, cmap='RdYlBu_r')
cbar = m.colorbar(cs)
cbar.set_label(r'Temperatura ($^{o}$C)')
qv = m.quiver(newlons[::skip, ::skip], lats[::skip, ::skip], u10[::skip, ::skip], v10[::skip, ::skip], scale=300)
qk = plt.quiverkey(qv, 0.9, 1.015, 20, '20 m/s', labelpos='W')


2. Make a cross section plot

To make a cross section of the zonal wind, for example, we need a list of the variable u for each isobaric level


In [17]:
list_of_messages = grbs.select(shortName='u', typeOfLevel='isobaricInhPa')
for message in list_of_messages:
    print message


8:U component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 100 Pa:fcst time 6 hrs:from 201702060000
14:U component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 200 Pa:fcst time 6 hrs:from 201702060000
20:U component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 300 Pa:fcst time 6 hrs:from 201702060000
26:U component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 500 Pa:fcst time 6 hrs:from 201702060000
32:U component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 700 Pa:fcst time 6 hrs:from 201702060000
38:U component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 1000 Pa:fcst time 6 hrs:from 201702060000
45:U component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 2000 Pa:fcst time 6 hrs:from 201702060000
52:U component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 3000 Pa:fcst time 6 hrs:from 201702060000
59:U component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 5000 Pa:fcst time 6 hrs:from 201702060000
66:U component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 7000 Pa:fcst time 6 hrs:from 201702060000
74:U component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 10000 Pa:fcst time 6 hrs:from 201702060000
84:U component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 15000 Pa:fcst time 6 hrs:from 201702060000
94:U component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 20000 Pa:fcst time 6 hrs:from 201702060000
104:U component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 25000 Pa:fcst time 6 hrs:from 201702060000
114:U component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 30000 Pa:fcst time 6 hrs:from 201702060000
124:U component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 35000 Pa:fcst time 6 hrs:from 201702060000
134:U component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 40000 Pa:fcst time 6 hrs:from 201702060000
144:U component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 45000 Pa:fcst time 6 hrs:from 201702060000
153:U component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 50000 Pa:fcst time 6 hrs:from 201702060000
162:U component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 55000 Pa:fcst time 6 hrs:from 201702060000
171:U component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 60000 Pa:fcst time 6 hrs:from 201702060000
180:U component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 65000 Pa:fcst time 6 hrs:from 201702060000
189:U component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 70000 Pa:fcst time 6 hrs:from 201702060000
198:U component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 75000 Pa:fcst time 6 hrs:from 201702060000
207:U component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 80000 Pa:fcst time 6 hrs:from 201702060000
216:U component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 85000 Pa:fcst time 6 hrs:from 201702060000
225:U component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 90000 Pa:fcst time 6 hrs:from 201702060000
234:U component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 92500 Pa:fcst time 6 hrs:from 201702060000
242:U component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 95000 Pa:fcst time 6 hrs:from 201702060000
252:U component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 97500 Pa:fcst time 6 hrs:from 201702060000
259:U component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 100000 Pa:fcst time 6 hrs:from 201702060000

A variable up is then initialized as an empty list so it can be filled with the 2D array of u for each of the isobaric levels. A second variable lev is also created to be filled with the isobaric levels


In [18]:
up = []
lev = []

for grb in list_of_messages:
    up.append(grb.values)
    lev.append(grb.level)
    
up = np.array(up)
lev = np.array(lev)

print lev, lev.shape, up.shape


[   1    2    3    5    7   10   20   30   50   70  100  150  200  250  300
  350  400  450  500  550  600  650  700  750  800  850  900  925  950  975
 1000] (31,) (31, 721, 1440)

Next, a function find_nearest is created to find the nearest grid point for a given location, based on the distance between points


In [19]:
def find_nearest(x, y, gridx, gridy):

    distance = (gridx - x)**2 + (gridy - y)**2
    idx = np.where(distance == distance.min())
    
    return [idx[0][0], idx[1][0]]

Using, for example, the latitude and longitude of São Paulo (lat = -23.650000 and lon = -46.616667)


In [20]:
idx = find_nearest(-46.616667, -23.650000, newlons, lats)

print newlons[idx[0], idx[1]], lats[idx[0], idx[1]]


-46.5 -23.75

Selecting the index idx[1], which means the longitude, we can make a plot for up[:, :, idx[1]] which is the zonal wind for all levels, all latitudes in longitude nearest to -46.616667


In [21]:
fig = plt.figure(figsize=(20,8))
ax = fig.add_subplot(111)

newlats, levs = np.meshgrid(lats[:, idx[1]], lev)

cs = ax.contourf(newlats, levs, up[:, :, idx[1]], cmap='PiYG')
cbar = plt.colorbar(cs)
ax.invert_yaxis()


3. Read multiple grib files and extract a specific point to a timeseries

To read multiple grib files we need to make a for loop to save the variables of interest in a numpy array. The following steps are followed below:

  • The variables to be saved are initialized as empty lists
  • The grib files are opened one by one
  • The variables are then selected and appended to the list
  • The variables are then tranformed to a numpy array

In [23]:
u10 = []
v10 = []
dates = []

import os
list_of_files = os.listdir('data')

for gribfile in sorted(list_of_files):
    if gribfile.startswith('gfs.t00z.pgrb2.0p25'):
        
        infile = os.path.join('data', gribfile)
        
        print 'Open file: %s' % infile
        grbs = pygrib.open(infile)
            
        u10_grb = grbs.select(name='10 metre U wind component', typeOfLevel='heightAboveGround', level=10)[0]
        v10_grb = grbs.select(name='10 metre V wind component', typeOfLevel='heightAboveGround', level=10)[0]

        u10.append(u10_grb.values)
        v10.append(v10_grb.values)
        
        dates.append(u10_grb.validDate)
        grbs.close()
        
lats, lons = u10_grb.latlons()
            
u10 = np.array(u10)
v10 = np.array(v10)


Open file: data/gfs.t00z.pgrb2.0p25.f003
Open file: data/gfs.t00z.pgrb2.0p25.f006
Open file: data/gfs.t00z.pgrb2.0p25.f009
Open file: data/gfs.t00z.pgrb2.0p25.f012
Open file: data/gfs.t00z.pgrb2.0p25.f015
Open file: data/gfs.t00z.pgrb2.0p25.f018
Open file: data/gfs.t00z.pgrb2.0p25.f021
Open file: data/gfs.t00z.pgrb2.0p25.f024
Open file: data/gfs.t00z.pgrb2.0p25.f027
Open file: data/gfs.t00z.pgrb2.0p25.f030
Open file: data/gfs.t00z.pgrb2.0p25.f033
Open file: data/gfs.t00z.pgrb2.0p25.f036
Open file: data/gfs.t00z.pgrb2.0p25.f039
Open file: data/gfs.t00z.pgrb2.0p25.f042
Open file: data/gfs.t00z.pgrb2.0p25.f045
Open file: data/gfs.t00z.pgrb2.0p25.f048
Open file: data/gfs.t00z.pgrb2.0p25.f051
Open file: data/gfs.t00z.pgrb2.0p25.f054
Open file: data/gfs.t00z.pgrb2.0p25.f057
Open file: data/gfs.t00z.pgrb2.0p25.f060
Open file: data/gfs.t00z.pgrb2.0p25.f063
Open file: data/gfs.t00z.pgrb2.0p25.f066
Open file: data/gfs.t00z.pgrb2.0p25.f069
Open file: data/gfs.t00z.pgrb2.0p25.f072
Open file: data/gfs.t00z.pgrb2.0p25.f075
Open file: data/gfs.t00z.pgrb2.0p25.f078
Open file: data/gfs.t00z.pgrb2.0p25.f081
Open file: data/gfs.t00z.pgrb2.0p25.f084
Open file: data/gfs.t00z.pgrb2.0p25.f087
Open file: data/gfs.t00z.pgrb2.0p25.f090
Open file: data/gfs.t00z.pgrb2.0p25.f093
Open file: data/gfs.t00z.pgrb2.0p25.f096
Open file: data/gfs.t00z.pgrb2.0p25.f099

Intead of using:

list_of_files = os.listdir('.')

for infile in sorted(list_of_files):
    if infile.startswith('gfs.t00z.pgrb2.0p25'):

We can use the glob function for glob library:

list_of_files = glob('gfs.t00z.pgrb2.0p25*')

for infile in sorted(list_of_files):

In [24]:
u10 = []
v10 = []
dates = []

from glob import glob
list_of_files = glob('data/gfs.t00z.pgrb2.0p25*')

for infile in sorted(list_of_files):
        
    print 'Open file: %s' % infile
    grbs = pygrib.open(infile)

    u10_grb = grbs.select(name='10 metre U wind component', typeOfLevel='heightAboveGround', level=10)[0]
    v10_grb = grbs.select(name='10 metre V wind component', typeOfLevel='heightAboveGround', level=10)[0]

    u10.append(u10_grb.values)
    v10.append(v10_grb.values)

    dates.append(u10_grb.validDate)
    grbs.close()
        
lats, lons = u10_grb.latlons()
            
u10 = np.array(u10)
v10 = np.array(v10)


Open file: data/gfs.t00z.pgrb2.0p25.f003
Open file: data/gfs.t00z.pgrb2.0p25.f006
Open file: data/gfs.t00z.pgrb2.0p25.f009
Open file: data/gfs.t00z.pgrb2.0p25.f012
Open file: data/gfs.t00z.pgrb2.0p25.f015
Open file: data/gfs.t00z.pgrb2.0p25.f018
Open file: data/gfs.t00z.pgrb2.0p25.f021
Open file: data/gfs.t00z.pgrb2.0p25.f024
Open file: data/gfs.t00z.pgrb2.0p25.f027
Open file: data/gfs.t00z.pgrb2.0p25.f030
Open file: data/gfs.t00z.pgrb2.0p25.f033
Open file: data/gfs.t00z.pgrb2.0p25.f036
Open file: data/gfs.t00z.pgrb2.0p25.f039
Open file: data/gfs.t00z.pgrb2.0p25.f042
Open file: data/gfs.t00z.pgrb2.0p25.f045
Open file: data/gfs.t00z.pgrb2.0p25.f048
Open file: data/gfs.t00z.pgrb2.0p25.f051
Open file: data/gfs.t00z.pgrb2.0p25.f054
Open file: data/gfs.t00z.pgrb2.0p25.f057
Open file: data/gfs.t00z.pgrb2.0p25.f060
Open file: data/gfs.t00z.pgrb2.0p25.f063
Open file: data/gfs.t00z.pgrb2.0p25.f066
Open file: data/gfs.t00z.pgrb2.0p25.f069
Open file: data/gfs.t00z.pgrb2.0p25.f072
Open file: data/gfs.t00z.pgrb2.0p25.f075
Open file: data/gfs.t00z.pgrb2.0p25.f078
Open file: data/gfs.t00z.pgrb2.0p25.f081
Open file: data/gfs.t00z.pgrb2.0p25.f084
Open file: data/gfs.t00z.pgrb2.0p25.f087
Open file: data/gfs.t00z.pgrb2.0p25.f090
Open file: data/gfs.t00z.pgrb2.0p25.f093
Open file: data/gfs.t00z.pgrb2.0p25.f096
Open file: data/gfs.t00z.pgrb2.0p25.f099

Now the same steps that were performed earlier are repeated now:

  • Flip grid from 0 to 360 to -180 to 180
  • Find the nearest point to São Paulo (lat = -23.650000 and lon = -46.616667)

In [25]:
u10, newlons = flip_grid(u10, lons)
v10, newlons = flip_grid(v10, lons)

In [26]:
idx = find_nearest(-46.616667, -23.650000, newlons, lats)

Import pandas to create a dataframe with dates as index and then save it to a csv file


In [27]:
import pandas as pd

data = {'u10': u10[:, idx[0], idx[1]], 'v10': v10[:, idx[0], idx[1]]}

df = pd.DataFrame(data, index=dates)

print df


                      u10   v10
2017-02-06 03:00:00 -0.04 -0.78
2017-02-06 06:00:00  0.34 -1.44
2017-02-06 09:00:00  0.65 -1.59
2017-02-06 12:00:00  0.70  0.66
2017-02-06 15:00:00 -0.22  2.87
2017-02-06 18:00:00 -0.93  3.06
2017-02-06 21:00:00 -1.34  2.82
2017-02-07 00:00:00 -0.55  0.96
2017-02-07 03:00:00  0.28  0.48
2017-02-07 06:00:00  0.69  0.78
2017-02-07 09:00:00  0.95  0.60
2017-02-07 12:00:00  0.05  1.54
2017-02-07 15:00:00 -0.55  2.85
2017-02-07 18:00:00 -0.80  4.52
2017-02-07 21:00:00 -0.99  3.90
2017-02-08 00:00:00 -0.90  2.63
2017-02-08 03:00:00 -0.38  1.80
2017-02-08 06:00:00  0.02  1.20
2017-02-08 09:00:00  0.63  0.89
2017-02-08 12:00:00 -0.30  2.10
2017-02-08 15:00:00 -1.32  3.46
2017-02-08 18:00:00 -1.67  5.06
2017-02-08 21:00:00 -2.04  3.93
2017-02-09 00:00:00 -1.53  2.46
2017-02-09 03:00:00 -1.10  2.21
2017-02-09 06:00:00 -0.15  1.93
2017-02-09 09:00:00  0.13  1.61
2017-02-09 12:00:00 -0.52  2.72
2017-02-09 15:00:00 -0.48  3.48
2017-02-09 18:00:00 -1.17  5.54
2017-02-09 21:00:00 -1.33  4.60
2017-02-10 00:00:00 -1.02  2.70
2017-02-10 03:00:00  0.11  1.60

In [28]:
df.to_csv('data.csv', sep=';')