Home |  | Your Room |  | Login |  | Contact |  | Feedback |  | Site Map |  | Search: |  |
About Us Overview Getting here Committees | Products Forecasts Order Data Order Software | Services Computing Archive PrepIFS | Research Modelling Reanalysis Seasonal | Publications Newsletters Manuals Libraries | News&Events Calendar Employment Open Tenders
Home > Publications > Manuals > Grib API> |
|  | #
GRIB API Manual
Installation
Python
Fortran 90
C
GRIB Conversion
| GRIBEX keys
Keys
Examples
Tools

Software
BUFR
CREX
GRIBEX
GRIB API
Interpolation
Magics
Metview
SMS
Ordering forms
Software licence
Payment rules

Related Manuals
GRIBEX manual
Interpolation manual
Metview Manuals
Magics Manuals

## GRIB section 4, the binary data section

An INTEGER array of at least 42 elements.

Contents of KSEC4
Element | Contents | GRIB API keys
--- | --- | ---
1 | Number of data values in array PSEC4 to be encoded or which have been decoded. When the 'A' coding option is used, the count is the number of image bytes stored four to an integer. When the 'B' coding option is used, the count is the number of integers used to return image bytes, stored four to an integer. When a bitmap is used, this number includes the total of both missing and present data values. If this number is negative: the number of field points is -KSEC4(1), the entire field is missing, all values in PSEC4 are 0, the coded data has all the bits of its scale factor are set to 1 all the bits of the exponent and mantissa of its reference value are set to 1 (This is an ECMWF convention). | numberOfPoints numberOfValues numberOfCodedValues numberOfMissing
2 | Number of bits used for each encoded value. | decimalPrecision bitsPerValue
3 |
    Type of data:
     0      Grid point data.
     128    Spherical harmonic coefficients
     (Used only if Section 2 is not included when
     coding data.)
| gridType
4 |
    Type of packing:
     0       Simple packing.
     64      Complex or second-order packing.
| packingType = grid_simple | grid_ieee | spectral_complex | spectral_simple | spectral_ieee | grid_simple_matrix | grid_second_order | grid_second_order_different_width | grid_complex | grid_complex_spatial_differencing | grid_jpeg | grid_png | grid_simple_log_preprocessing
5 |
    Data representation:
     0       Floating point data.
     32      Integer data.
6 |
    Additional flags indicator:
     0       No additional flags.
     16     Additional flags.
7 | Reserved. Set to 0. |
8 |
    Number of values indicator:
     0      Single datum at each grid point.
     64     Matrix of values at each grid point.
9 |
    Secondary bitmaps indicator:
     0      No secondary bitmaps.
     32     Secondary bitmaps present.
10 |
    Values width indicator:
     0      Second order values have constant width.
     16     Second order values have different widths.
11 | Number of bits for second order values when these have constant width. |
12-15 | Reserved for WMO reserved flag fields. Set to 0. |
16 | For complex packing, a pointer to the start of packed data values (ie the octet number). Otherwise set to 0. |
17 | For complex packing, the scaling factor P, stored as the INTEGER value P*1000 (in the range -10000 to +10000). Otherwise set to 0. |
18 | For complex packing, the pentagonal resolution parameter J specifying the truncation of the subset of the data represented as 32-bit floating point numbers (ie not packed). Otherwise set to 0. |
19 | For complex packing, the pentagonal resolution parameter K specifying the truncation of the subset of the data represented as 32-bit floating point numbers (ie not packed). Otherwise set to 0. |
20 | For complex packing, the pentagonal resolution parameter M specifying the truncation of the subset of the data represented as 32-bit floating point numbers (ie not packed). Otherwise set to 0. |
21 | The number of non-missing values in a field which uses a bitmap. When the 'B' coding option is used, this count is the number of image bytes (versions of GRIBEX after 13.040). |
22-33 | Reserved. Set to 0. |
34 | An offset bit pointer to coded values in the GRIB record. (This is returned by the 'G', 'I' or 'J' decoding options). |

## X decoding option.

Elements 34 to 42 are used only for the 'X' option, which decodes up to 4 values. (See HOPER above). The scanning mode must be from West to East and from North to South.

KSEC4 - X decoding option
Element | Contents
--- | ---
34 | Number of points to be decoded (maximum 4).
35 | Number of the latitude row of the first value.
36 | Number of the longitude point of the first value.
37 | Number of the latitude row of the second value.
38 | Number of the longitude point of the second value.
39 | Number of the latitude row of the third value.
40 | Number of the longitude point of the third value.
41 | Number of the latitude row of the fourth value.
42 | Number of the longitude point of the fourth value.

## Grid point matrix packing.

For grid point packing, with a matrix of values at each grid point, elements 50 to (50+NC1+NC2) are used as follows:

KSEC4 - grid matrix packing
Element | Contents
--- | ---
50 | First dimension of each matrix (the number of rows).
51 | Second dimension of each matrix (the number of columns).
52 | First dimension coordinate values definition.
53 | Number of coefficients or values used to specify the first dimension coordinate function, NC1.
54 | Second dimension coordinate values definition.
55 | Number of coefficients or values used to specify the second dimension coordinate function, NC2.
56 | First dimension physical significance.
57 | Second dimension physical significanc.
58 - 59 | Reserved. Set to 0.

## ECMWF use of REALs.

In the WMO specification, the following fields are INTEGER values. ECMWF uses floating-point values for its wave models, so these fields contain REAL values in both input and output.

KSEC4 - ECMWF use of REALs
Elements | Contents
--- | ---
60 - (59+NC1) | Coefficients to define the first dimension coordinate values in functional form, or the explicit coordinate values.
(60+NC1)-(59+NC1+NC2) | Coefficients to define the second dimension coordinate values in functional form, or the explicit coordinate values

| 22.10.2010-->-->

|  | © ECMWF |