Aggregate model-level fields to a 3D-field, save it to netCDFΒΆ

[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]:
print(f.spectral)
f.sp2gp()
True
[5]:
print(f.getdata(d4=True).shape)
(1, 90, 250, 250)
[6]:
f.dump_to_nc('/tmp/temp.nc', variablename='temperature')
[ ]: