Extract a V2D+T section from a 4D fieldΒΆ
[1]:
%matplotlib inline
# for figures in notebook
# import & initialize epygram
import epygram
epygram.init_env()
# path to file
import os
INPUTS_DIR = os.path.join('..', 'inputs')
[2]:
paths = [os.path.join(INPUTS_DIR, 'grid.arome-forecast.guyane0025+00{:02}:00.grib'.format(i))
for i in (0, 12, 24)]
r = epygram.resources.meta_resource(paths, 'r', 'CL+MV')
[3]:
f = r.readfield({'shortName':'t', 'typeOfFirstFixedSurface':100}) # temperature on pressure levels
[4]:
print(f.getdata(d4=True).shape)
(3, 19, 317, 419)
[5]:
s = f.extractsection((-55,5), (-55,2))
[6]:
print(type(s))
print(s.getdata(d4=True).shape)
<class 'epygram.fields.V2DField.V2DField'>
(3, 19, 1, 121)
[ ]: