Skip Navigation Links www.nws.noaa.gov 
NOAA logo - Click to go to the NOAA home page National Weather Service   NWS logo - Click to go to the NWS home page
Climate Prediction Center
 
 

 
About Us
   Our Mission
   Who We Are

Contact Us
   CPC Information
   CPC Web Team

 
HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > gfsnemsio2grb
 

gfsnemsio2grb

The program gfsnemsio2grb program takes a GFS forecast or analysis in NEMSIO format and writes it out in grib2 format. The name says everything. Jun Wang (EMC) wrote a program to read the GFS NEMSIO files and create a GrADS ctl file. Wesley Ebisuzaki (CPC) used this code as starting point to convert the NEMSIO file to grib2. The program is being developed as an important piece of the post-processing of the Conventional Only Reanalysis Project (CORe is a project of CPC and ESRL).

Gfsnemsio2grb uses the ftn wgrib2_api which makes writing grib2 easy.

Changes

  • v2.0 4/2019: first public release
  • v2.1 9/2019: apply land mask to more fields, save more data from CORe nemsio file
  • v2.2 12/2019: adds hydrostatic surface pressure (fv3-64 level, dpress output)
  • delz (nemsio) -> THICKNESS, old HGT
  • dpress (nemsio) -> nothing (no grib equivalent), old PRES
  • v2.3 2/2020: adds -o GRIB_OUTPUT_file
  • v2.4 3/2020: do not write grib messages of known non-grib fields
  • v2.5 4/2020: added F option, SNOHF, CS(U|D)(S|L)F made into ave, add fix to option a
  • v2.6 11/2021: public release version: updated bacio, nemsio, w3nco libraries, support for gcc 11.2.0
    V2.6 is in testing, ask for a copy if you need it.
  • v2.7 5/2024: Fix for nemsio from CORe (gfs v15). PRES/TMP for cloud top/bottom contaminated by undefined values. GEFS (5/2024) either have these fields as unavailable or fixed.

Usage

  $ gfsnemsio2grb GFS-NEMSIO-FILE (option string) (-o GRIB-FILE)
         creates a grib2 file named GFS-NEMSIO-FILE.grb or GRIB-FILE (using -o option)
         The option -o GRIB-FILE was introduced with v2.3 (2/2020)
         optionally creates a GrADS ctl file named GFS-NEMSIO-FILE.ctl
         create
option string
   ""     no options
    a     enable the CORe customizations
          scale PRATE and CPRAT for Jeff Whitaker's ENKF system
          create 10m wind speed
          change SNOHF, Clear Sky fluxes from instantaneous to time averages
    A     use AEC compression for grib packing (fast but not supported by g2lib)
    S     use simple packing for grib packing
    f     run the fast optimizations
          reduced diagnostic output
          no GrADS ctl file is generated
    F     change SNOHF, Clear Sky fluxes from instantaneous to time averages (v2.5)
    p     surface pressure calculation (fv3 - 64 level and v2.3+)
          calculate surface pressure using dpres,
          this gives the hydrostatic surface pressure (PRES:0 m above ground)
    eXXX  enable ensemble metadata
          XXX = number of members in the ensemble
          when ensemble metadata is enabled, the input file name is scanned
             contains 'control', fields are labeled high res control
             contains 'ensmean', fields are labeled as ens-mean
             contains 'memXYZ',  fields are labeled as ensemble member XYZ (XYZ=0..254)
             note, the grib2 standard limits the number of forecasts in the
              ensemble to be 0..254.

   Note: all options are combined into one word; for example "aF"
   Note: unmatched options are not flagged
   Note: if you want to use "-o FILENAME", you must have an option string, even a "".

Requirements for easy build

  1. gcc, gfortran
  2. linux

Requirements for your own makes

  1. (gcc, gfortran) or (icc, ifort)
  2. nemsio, bacio, and w3nco libraries
  3. wgrib2 library built with ftp_api enabled v2.0.8+

Restrictions, Licences

The source code to gfsnemsio2grb is in the public domain because both authors are federal employees. However, the libraries used by gfs2nemsio2grb are covered by different licences. The licences covering the wgrib2 library will depend on the compile options.

Limitations

Not all fields in the NEMSIO file have grib names. Not sure what all the NEMSIO fields contain. Needed metadata is not in the NEMSIO file.

Code

gfsnemsio2grb.tgz directory

Building the Code

The source code tarball includes all the libraries except for wgrib2. The make uses gcc and gfortran to compile the code.
$ wget https://www.ftp.cpc.ncep.noaa.gov/wd51we/gfsnemsio2grb/gfsnemsio2grb.tgz
$ tar -xzvf gfsnemsio2grb.tgz 

   if gfsnesmsio2grb v2.5
$ cd gfsnemsio2grb/

   else if gfsnesmsio2grb v2.6+
$ cd gfsnemsio2grb.v2.6/      (replace 2.6 by version of gfsnemsio2grb)

       if gcc v10+
edit makefile, change line
   # NEW_FFLAGS="-fallow-argument-mismatch -fallow-invalid-boz
to
   NEW_FFLAGS="-fallow-argument-mismatch -fallow-invalid-boz

       endif
   endif

$ make
    ((error message saying that you need to download wgrib2))
$ wget https://www.ftp.cpc.ncep.noaa.gov/wd51we/wgrib2/wgrib2.tgz
    ((download wgrib2))
$ make
    ((executable is located in bin/gfsnemsio2grb))

Other Ports

I use the ez-build version for most of my use. However, to put the program in to NCO opertions, the code needs to run using the icc/ifort compilers and use system libraries. So a makefile for WCOSS is available.

Porting the Code, Modifying the makefile

The support for gfs2nemsio2grb is limited to building using gcc and gfortran on linux systems using the provided make. If you decide to change the building system, you are on your own. I am limiting support to linux and gcc/gfortran in order to reduce the cost in hours of making the software publicly available.

Gfs2nemsio2grb is working using Intel's icc/ifort to compilg gfsnesio2grb and wgrib2. However, the build is completely different as it relies on prebuilt libraries which may not exist on your system.

Comments: Wesley.Ebisuzaki@noaa.gov


NOAA/ National Weather Service
National Centers for Environmental Prediction
Climate Prediction Center
5830 University Research Court
College Park, Maryland 20740
Climate Prediction Center Web Team
Page last modified: March 1, 2019, 8/5/2019, 3/17/2020, 4/27/2020, 11/30/2021, 5/2024
Disclaimer Privacy Policy