110 likes | 267 Views
n emsio library. Jun Wang, Mark Iredell. Introduction. nemsio is a package to support input/output in NOAA Environmental Modeling System (NEMS) Current NEMSIO can handle binary data and GRIB-1 data NEMSIO has serial version and MPI version. DATA STRUCTURE.
E N D
nemsio library Jun Wang, Mark Iredell
Introduction • nemsio is a package to support input/output in NOAA Environmental Modeling System (NEMS) • Current NEMSIO can handle binary data and GRIB-1 data • NEMSIO has serial version and MPI version
DATA STRUCTURE • A NEMSIO file contains two parts: meta data and data fields. • Meta data: • Standard model meta data • User defined meta data (optional) • Data fields: • Same dimension for all the fields • Real kind (4 or 8 bytes real) • Same format for all the fields
Standard meta data • required by NEMS model applications such as NMMB and GFS and NCEP GSI • Total 12 meta data records, can be reduced by users • First 2 meta data are required in all cases: • Gtype, gdatatype, modelname,version, nmeta • Nrec, idate, forecast time, dimention, nframe, nsoil, ntrac,jcap,ncldt,idsl,idvc,idvm,idrt,rlon_min, rlon_max,rlat_min,rlat_max • 10 other meta data records: recname, reclevtyp and reclev (meta data 3:5), vcoord,lat,lon,dx,dy,Cpi,Ri
User defined meta data • extrameta in second standard meta data indicates if there are any user defined meta data • User defined mata data can have 5 data type: integer, real(4), real(8), logical and character(16) • if extrameta is true, meta data record exists: • Nmetavari,nmetavarr,nmetavarl,nmetavarc,nmetavarr8 • Nmetaaryi,nmetaaryr,nmetaaryl,nmetaaryc,nmetaaryr8 • User defined meta data records holds each meta data’s name, length (for array) and value
nemsio interfaces –serial version • nemsio_init(iret) • nemsio_finalize(iret) • nemsio_open(gfile,gname,'read|write|rdwr',optarg,iret) • nemsio_close(gfile, iret) • nemsio_getfilehead(gfile,optargs,iret) • nemsio_getheadvar(gfile,argname,argval,iret) • nemsio_getrechead(gfile,jrec,vname,vlevtyp,vlev,iret) • nemsio_setfilehead(gfile,optarg,iret) • nemsio_readrec(gfile,jrec,data,nframe,iret) • nemsio_readrecv(gfile,name,levtyp,lev,data,nframe,iret) • nemsio_writerec(gfile,jrec,itr,zhour,data,iret) • nemsio_writerecv(gfile,name,levtyp,lev,itr,zhour,data,iret)
nemsio parallel version • Using MPI 2 • More efficient for file size ~GB
nemsio interface – parallel version • nemsio_open(gfile,gfname,gaction,mpi_comm,optargs,iret) • nemsio_denseread(gfile,ista,iend,jsta,jend,data,iret) • nemsio_densewrite(gfile,ista,iend,jsta,jend,data,jrecs,jrece,iret)
Utilities for nemsio files • nemsio_read: read a nemsio file, list all the meta data information and maxium/minium of each data field • nemsio_get: get value of a specific meta data variable or a data field • mknmmbctl: create .ctl file from a nemsio file for viewing the data in Grads • nemsio_cvt: convert a nemsio file from big/little endian to little/big endian
Future work • Add GRIB2 format data type • Add NetCDF data type
Documentation • http://www.emc.ncep.noaa.gov/NEMS/nemsio.php