Exctract a level from a 3D fieldΒΆ
[1]:
# for figures in notebook
%matplotlib inline
# import & initialize epygram
import epygram
epygram.init_env()
# path to file
import os
INPUTS_DIR = os.path.join('..', 'inputs')
[2]:
# open resource as a meta-CL-resource, CL = Combine Levels
r = epygram.resources.meta_resource(os.path.join(INPUTS_DIR, 'ICMSHAROM+0022'), 'r', 'CL')
# in this case, field need to be defined with GRIB2 nomenclature
[3]:
f = r.readfield({'discipline':0, 'parameterCategory':0, 'parameterNumber':0, 'typeOfFirstFixedSurface':119})
[4]:
f.sp2gp()
[5]:
f18 = f.getlevel(18)
[6]:
print(type(f))
print(type(f18))
print(f18.geometry.vcoordinate.levels)
<class 'epygram.fields.D3Field.D3Field'>
<class 'epygram.fields.H2DField.H2DField'>
[18]
[ ]: