NDFD GRIB Encoding - MDL
The National Weather Service (NWS) is creating a National Digital Forecast Database (NDFD) which will contain gridded forecasts of several weather elements. In general, the weather parameters in the NDFD will be ground-based, sensible weather elements. The forecast grids that comprise the NDFD will come from multiple sources, including the NWS' Weather Forecast Offices(WFO) and the National Centers for Environmental Prediction (NCEP). The World Meteorological Organization (WMO) has adopted Edition 2 of the GRIB code as a standard for sharing GRIdded Binary data. GRIB, Edition 2 (GRIB2) will be involved in the NDFD in two ways. GRIB2 will be one of the primary formats used to transmit NDFD data to NWS customers and partners.
The purpose of this document is to describe, in detail, the techniques that will be used to encode NWS forecasts into NDFD GRIB2 bulletins. When dealing with a code as general and as flexible as GRIB2, one often encounters multiple, plausible ways to accomplish the encoding task. It is hoped that this document will clarify the many decisions made during the creation of the NDFD.
In summer of 2011, NDFD will begin making experimental CONUS GRIB2 files available that contain finer spatial resolution (2.5 km) and higher temporal resolution ( 1-hr, for Days 1-3) grids.
This document will assume that the reader has access to and a working knowledge of the WMO publication FM 92-XII GRIB General Regularly-distributed Information in Binary Form. NCEP WMO GRIB2 documentation should provide access to a version that has been formatted for web access.
The NWS has created an NDFD Project Home Page. There you will find the latest news regarding NDFD plans and recent developments. In addition, MDL developers have written software that may be downloaded and used for accessing and decoding NDFD GRIB2 files from the NWS Telecommunications Gateway (NWSTG). To obtain the latest version of this software, see the MDL Degrib Page.
File, and Bulletin Structure
A single file will contain multiple GRIB2 bulletins. One file will contain multiple forecast projections for a given weather element covering a specific geographic region. There are NDFD grids available for the lower 48 states (CONUS), 16 different CONUS sub-sectors, Puerto Rico, Hawaii, Guam, and Alaska. For Tropical Prediction Center grids, there are two additional domains. One domain covers the area defined by NCEP's AWIPS 227 grid. The other domain covers the Northern Pacific, as defined by NCEP's AWIPS 204 grid.
The NDFD Oceanic domain covers a large area of the world's surface, and also contains forecast data provided by the Tropical Analysis and Forecast Branch of the National Hurricane Center, as well as the Ocean Prediction Center.
See National Digital Forecast Database (NDFD) Reference for a detailed list of geographic sectors, filenames, and WMO header information with regards to NDFD data.
GRIB2 files for a given element and region will be split into two files, one containing the forecast grids for the period Day 1 through Day 3, the other containing the forecast grids for the period Day 4 through Day 7. These files are located in different directories at the NWSTG FTP download site.
Every NDFD GRIB file begins with a flag field separator of the format:
where the "nnnnnnnnnn" is the size in bytes of the file, (minus the separator), right justified with leading zeroes, and with a trailing "\lf". The "\lf" character represents a single octet with the decimal value of 10. The size of the Flag field separator is 19 bytes.
Following the flag field separator is a WMO "super header". Check the NDFD WMO Heading Reference for the specific format of NDFD WMO headers. The WMO super header is 21 bytes long, the trailing "\cr\cr\lf" inclusive. The "\cr" character represents a single octet with the decimal value of 13. Immediately following the super header is another flag field separator for the first GRIB2 bulletin in the file. It contains the size of the bulletin to follow.
The bulletin itself begins with a WMO header. Again, refer to the link above to get detailed information regarding the format of the header. The header contains the valid time of the GRIB2 bulletin. The WMO header is also 21 bytes long, the trailing "\cr\cr\lf" inclusive. Following the header is the packed GRIB2 grid. It begins with the ASCII text "GRIB" and ends with the ASCII text "7777". The packed data contains all the GRIB2 sections for that grid, as well as the packed grid.
Here's an example of the file format (individual components are bracketed with "< >"):
<file flag field separator\lf> <WMO super header\cr\cr\lf> <bulletin 1 flag field separator\lf> <WMO header 1 for bulletin\cr\cr\lf> <"GRIB"packed data7777><bulletin 2 flag field separator\lf> <WMO header 2 for bulletin\cr\cr\lf> <"GRIB"packed data7777><bulletin 3 flag field separator\lf> . . . <WMO header nn for bulletin\cr\cr\lf> <"GRIB"packed data7777>