weather.gov |
Site Map | News | Organization |
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.
Every NDFD GRIB file begins with a flag field separator of the format:
****nnnnnnnnnn****\lf
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 this link above for 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>
Octet No. | Contents |
1-4 | "GRIB" |
5-6 | Missing |
7 | 0 - for Meteorological Products, 10 - for Oceanographic Products |
8 | 2 |
9-16 | Total length of GRIB message in octets (including Section 0) |
Octet No. | Contents |
1-4 | 21 |
5 | 1 |
6-7 | 8 |
8-9 | Missing |
10 | 1 |
11 | 0 - Value will be used to designate the version number of the GRIB2-encoding software that produced the bulletin. When changes to this published format occur, this version number will be updated. |
12 | 1 |
13-14 | Year (4 digits) |
15 | Month |
16 | Day |
17 | Hour |
18 | Minute |
19 | Second |
20 | 0 or 1 |
21 | 1 |
Grids of Wx are stored as two distinct entities. The first entity is a grid of small integer values that will generally store very compactly in Section 6. The second entity is a series of null-terminated strings of ASCII characters called Weather Keys. The integers on the weather grid serve as indices, each pointing to one of the Weather Keys in the series. Each Weather Key is comprised of one or more weather subkeys, separated by a caret "^".
Essentially, the metadata packed in the Local Use Section for the parameter
Wx is a lookup table. The ASCII characters are loaded, one per octet,
and then compressed using the Simple Packing Scheme for integers defined
for Section 5. The Simple Packing Scheme treats the set of Weather
Keys as an integer array. Each integer in the array is a decimal
representation that corresponds to an ASCII character. For instance,
the integer 65 translates to the ASCII character "A". The null character
is represented by the integer 0, so that whenever a 0 is encountered in
the array, it marks the ending of a unique Weather Key. The tables
that follow show the specific contents of the Weather Keys and subkeys.
Octet No. | Contents |
1-4 | Length of section in octets (nn) |
5 | 2 |
6 | Total number of characters comprising the series of Weather Keys |
7 | 0 |
8-nn | The Weather Keys needed to describe the weather on the grid, packed using the Simple Packing scheme |
one weather type code. See Weather Type Codes, below.
one coverage/probability code. See Coverage/probability Codes, below.
one intensity code. See Intensity Codes, below.
one visibility code. See Visibility Codes, below.
Code | Meaning | Code | Meaning |
<NoWx> | No Weather | T | Thunder |
A | Hail | R | Rain |
RW | Rain Showers | L | Drizzle |
ZR | Freezing Rain | ZL | Freezing Drizzle |
S | Snow | SW | Snow Showers |
IP | Ice Pellets (sleet) | F | Fog |
H | Haze | BS | Blowing Snow |
K | Smoke | BD | Blowing Dust |
FR | Frost | BN | Blowing Sand |
IF | Ice Fog | IC | Ice Crystals |
ZF | Freezing Fog | ZY | Freezing Spray |
VA | Volcanic Ash | WP | Water Spouts |
Code | Meaning | Code | Meaning |
<NoCov> | No Coverage/probability | Iso | Isolated |
Sct | Scattered | Num | Numerous |
Wide | Widespread | Ocnl | Occasional |
SChc | Slight Chance | Chc | Chance |
Lkly | Likely | Def | Definite |
Patchy | Patchy | Areas | Areas of |
Code | Meaning | Code | Meaning |
<NoInten> | No Intensity | -- | Very Light |
- | Light | m | Moderate |
+ | Heavy |
Code | Meaning | Code | Meaning |
FL | Frequent Lightning | GW | Gusty Winds |
HvyRn | Heavy Rain | DmgW | Damaging Winds |
SmA | Small Hail | LgA | Large Hail |
OLA | Outlying Areas | OBO | on Bridges and Overpasses |
Item | Maximum number that will be present |
Weather Attributes in a Weather Subkey | 5 |
Weather Subkeys in a Weather Key | 5 |
Sample Weather Key | Meaning |
Sct:SW:-:<NoVis>: | Scattered snow showers |
Ocnl:R:-:<NoVis>:^S:Ocnl:-:<NoVis>:^
SChc:ZR:-:<NoVis>: |
Occasional rain and snow, with a slight chance of freezing rain |
Wide:FR:-:<NoVis>:OLA | Widespread frost in the outlying areas |
<NoWx>:<NoCov>:<NoInten>:<NoVis>: | No weather |
Sct:RW:-:<NoVis>:^T:Iso:m:<NoVis>: | Scattered showers with isolated thunderstorms |
Sct:T:+:<NoVis>:DmgW,LgA | Scattered severe thunderstorms with damaging winds and large hail |
Octet No. | Contents |
1-4 | Length of section in octets (nn) |
5 | 3 |
6 | 0 |
7-10 | Number of data points |
11 | 0 |
12 | 0 |
13-14 | 30 - template number |
15 | 1 |
16 | 0 |
17-20 | 6371200 - Radius of the earth |
21 | Missing |
22-25 | Missing |
26 | Missing |
27-30 | Missing |
31-34 | Nx - number of points along the X-axis |
35-38 | Ny - number of points along the Y-axis |
39-42 | La1 - latitude of first grid point |
43-46 | Lo1 - longitude of first grid point |
47 | 0 |
48-51 | 25,000,000 - Latitude where grid spacing is defined |
52-55 | 265,000,000 - Orientation longitude |
56-59 | 5,079,406 - Dx, X-direction grid length |
60-63 | 5,079,406 - Dy, Y-direction grid length |
64 | 0 |
65 | 80 - Scanning Mode |
66-69 | 25,000,000 - Latin1, first secant latitude |
70-73 | 25,000,000 - Latin2, second secant latitude |
74-77 | -90,000,000 - Latitude of southern pole |
78-81 | 0 - Longitude of southern pole |
Octet No. | Contents |
1-4 | Length of section in octets (nn) |
5 | 3 |
6 | 0 |
7-10 | Number of data points |
11 | 0 |
12 | 0 |
13-14 | 20 - template number |
15 | 1 |
16 | 0 |
17-20 | 6371200 - Radius of the earth |
21 | Missing |
22-25 | Missing |
26 | Missing |
27-30 | Missing |
31-34 | Nx - number of points along the X-axis |
35-38 | Ny - number of points along the Y-axis |
39-42 | La1 - latitude of first grid point |
43-46 | Lo1 - longitude of first grid point |
47 | 0 |
48-51 | Lat where mesh length is true |
52-55 | Orientation longitude of grid |
56-59 | Dx |
60-63 | Dy |
64 | 0 - Projection center flag |
65 | 80 - Scanning mode |
Octet No. | Contents |
1-4 | Length of section in octets (nn) |
5 | 3 |
6 | 0 |
7-10 | Number of data points |
11 | 0 |
12 | 0 |
13-14 | 10 - template number |
15 | 1 |
16 | 0 |
17-20 | 6371200 - Radius of the earth |
21 | Missing |
22-25 | Missing |
26 | Missing |
27-30 | Missing |
31-34 | Nx - number of points along the X-axis |
35-38 | Ny - number of points along the Y-axis |
39-42 | La1 - latitude of first grid point |
43-46 | Lo1 - longitude of first grid point |
47 | 0 |
48-51 | Lat where projection intersects the Earth (where mesh length defined) |
52-55 | La2 - latitude of last gridpoint |
56-59 | Lo2 - longitude of last gridpoint |
60-63 | 80 - Scanning mode |
61-64 | Orientation angle of the grid |
65-68 | Di - longitudinal direction grid length |
69-72 | Dj - latitudinal direction grid length |
Octet No. | Contents |
1-4 | 58 |
5 | 4 |
6-7 | 0 |
8-9 | 8 |
10 | 0 |
11 | 4 for MaxT
5 for MinT |
12 | 2 |
13 | 0 |
14 | 0 |
15-16 | Missing |
17 | Missing |
18 | 1 |
19-22 | Hours from reference time to beginning of MaxT/MinT valid period. |
23 | 1 |
24 | Missing |
25-28 | Missing |
29 | Missing |
30 | Missing |
31-34 | Missing |
35-36 | Year of end of MaxT/MinT valid period in GMT. |
37 | Month of end of MaxT/MinT valid period in GMT. |
38 | Day of end of MaxT/MinT valid period in GMT. |
39 | Hour of end of MaxT/MinT valid period in GMT. |
40 | Minute of end of MaxT/MinT valid period in GMT. |
41 | Second of end of MaxT/MinT valid period in GMT. |
42 | 1 |
43-46 | 0 |
47 | 2 for MaxT. 3 for MinT. |
48 | Missing |
49 | 1 |
50-53 | 12 |
54 | 1 |
55-58 | 0 |
Octet No. | Contents |
1-4 | Length of section in octets (nn) |
5 | 4 |
6-7 | 0 |
8-9 | 9 |
10 | 1 |
11 | 8 |
12 | 2 |
13 | 0 |
14 | 0 |
15-16 | Missing |
17 | Missing |
18 | 1 |
19-22 | Hours from reference time to beginning of PoP12 valid period. |
23 | 1 |
24 | Missing |
25-28 | Missing |
29 | Missing |
30 | Missing |
31-34 | Missing |
35 | Missing |
36 | Missing |
37 | 1 |
38 | Missing |
39-42 | Missing |
43 | -3 |
44-47 | 254 |
48-49 | Year of end of PoP12 valid period in GMT. |
50 | Month of end of PoP12 valid period in GMT. |
51 | Day of end of PoP12 valid period in GMT. |
52 | Hour of end of PoP12 valid period in GMT. |
53 | Minute of end of PoP12 valid period in GMT. |
54 | Second of end of PoP12 valid period in GMT. |
55 | 1 |
56-59 | 0 |
60 | 1 |
61 | Missing |
62 | 1 |
63-66 | 12 |
67 | 1 |
68-71 | 0 |
Octet No. | Contents |
1-4 | Length of section in octets (nn) |
5 | 4 |
6-7 | 0 |
8-9 | 0 |
10 | Parameter Category (FM 92 GRIB, Code Table 4.1) See table below for specific values |
11 | Parameter Number (FM 92 GRIB, Code Table 4.2) See table below for specific values |
12 | 2 |
13 | 0 |
14 | 0 |
15-16 | Missing |
17 | Missing |
18 | 1 |
19-22 | Forecast projection in hours |
23 | 1 |
24 | Missing |
25-28 | Missing |
29 | Missing |
30 | Missing |
31-34 | Missing |
Parameter | Category | Number |
Temperature | 0 | 0 |
Dewpoint | 0 | 6 |
Sky | 6 | 1 |
Wind Speed | 2 | 1 |
Wind Direction | 2 | 0 |
Wave Height (see Note 1) | 0 | 5 |
Weather | 1 | 192 |
20Ft Wind Speed | 2 | 1 |
20Ft Wind Direction | 2 | 0 |
Wind Gust | 2 | 22 |
Note 1: Wave Height is defined as an Oceanographic Product in the Indicator Section, octet 7.
Octet No. | Contents |
1-4 | Length of section in octets (nn) |
5 | 4 |
6-7 | 0 |
8-9 | 8 |
10 | 1 |
11 | 8 for QPF
29 for Snow Amount |
12 | 2 |
13 | 0 |
14 | 0 |
15-16 | Missing |
17 | Missing |
18 | 1 |
19-22 | Hours from reference time to beginning of valid period. |
23 | 1 |
24 | Missing |
25-28 | Missing |
29 | Missing |
30 | Missing |
31-34 | Missing |
35-36 | Year of end of valid period in GMT. |
37 | Month of end of valid period in GMT. |
38 | Day of end of valid periodin GMT. |
39 | Hour of end of valid period in GMT. |
40 | Minute of end of valid period in GMT. |
41 | Second of end of valid period in GMT. |
42 | 1 |
43-46 | 0 |
47 | 1 |
48 | Missing |
49 | 1 |
50-53 | 6 |
54 | 1 |
55-58 | 0 |
NDFD grids will generally contain a significant number of missing values. National mosaic grids are defined to be rectangles, and they generally extend into areas where NWS WFOs do not have forecast responsibility.
Octet No. | Contents |
1-4 | 47 |
5 | 5 |
6-9 | Total number of data points. |
10-11 | 2 or 3 |
12-15 | Reference value (R) as an IEEE 32-bit floating-point value. Varies from grid to grid. |
16-17 | Binary scale factor (E). Varies from weather element to weather element. See Element Encoding Characteristics Table for values. |
18-19 | Decimal scale factor (D). Varies from weather element to weather element. See Element Encoding Characteristics Table for values. |
20 | Number of bits used for each group reference value. |
21 | 1 (integer) for Weather grids; 0 (floating point) for all other weather elements. |
22 | 1 |
23 | 1 |
24-27 | Primary missing value substitute. See Element Encoding Characteristics Table for values. The values in the table will appear in the GRIB2 bulletins in Section 5, but will not appear with the data in section 7. The GRIB2 standard calls for missing values to be carried as the largest value possible in a particular group. |
28-31 | Missing |
32-47 | See GRIB2 documentation. |
48 | Order of spatial differencing |
Octet No. | Contents |
1-4 | Length of section in octets (nn) |
5 | 6 |
6 | 255 |
Octet No. | Contents |
1-4 | Length of section in octets (nn) |
5 | 7 |
6-nn | See GRIB2 documentation. |
Octet No. | Contents |
1-4 | "7777" |
Weather
Element |
Original
NDFD Units |
GRIB-
encoded Units |
Binary Scale
Factor |
Decimal Scale
Factor |
Primary Missing
Value Substitute |
MaxT | Fahrenheit | Kelvin | 0 | 1 | 9999 |
MinT | Fahrenheit | Kelvin | 0 | 1 | 9999 |
PoP12 | Percent Probability | Percent
Probability |
0 | 0 | 9999 |
T | Fahrenheit | Kelvin | 0 | 1 | 9999 |
Td | Fahrenheit | Kelvin | 0 | 1 | 9999 |
Sky | Percentage
Total sky coverage |
Percentage
Total sky coverage |
0 | 0 | 9999 |
Wind Speed | knots | ms-1 | 0 | 1 | 9999 |
Wind Direction | degrees true | degrees true | 0 | 0 | 9999 |
Weather | N/A | N/A | 0 | 0 | 9999 |
QPF | inches | kgm-2 | 0 | 1 | 9999 |
SnowAmt | inches | meters | 0 | 1 | 9999 |
Wave Height | feet | meters | 0 | 0 | 9999 |
20Ft Wind Speed | knots | ms-1 | 0 | 1 | 9999 |
20Ft Wind Direction | degrees true | degrees true | 0 | 0 | 9999 |
Wind Gust | knots | ms-1 | 0 | 1 | 9999 |
|
||
US
Dept of Commerce National Oceanic and Atmospheric Adminstration National Weather Service Office of the Chief Information Officer (OCIO11) 1325 East West Highway Silver Spring, MD 20910 Page last modified: June 10, 2003 Page Author: Data Management |
Disclaimer Feedback |