KSEC1 element | Contents | GRIB octet | Recommended GRIB_API keys | Coded GRIB_API keys | Comments
--- | --- | --- | --- | --- | ---
37 |
    ECMWF local GRIB use definition identifier.
    4 = Ocean model data.
| 41 | localDefinitionNumber | localDefinitionNumber |
38 | Class | 42 | class | marsClass |
39 | Type | 43 | type | marsType |
40 | Stream | 44-45 | stream | marsStream |
41 |
    Version number or experiment identifier.
    (4 ASCII characters, right justified)
| 46-49 | expver | experimentVersionNumber |
42 | Ensemble member number |
    50-51, if stream = 1090
    50, otherwise
| number | perturbationNumber |
43 | Zero | 51, unless stream = 1090 |  |  |
- | 1 (a flag showing a post-auxiliary array is in use) | 52 | flagShowingPostAuxiliaryArrayInUse | flagShowingPostAuxiliaryArrayInUse |
44 | System number | 53 | systemNumber | systemNumber |
45 | Method number | 54 | methodNumber | methodNumber |

Used for storing ocean model data in GRIB code. A separate version of code table 2 is used for ocean data: ECMWF local Code Table 2, Version Number 150 or 151 for FM92-VIII.

All coordinates in this local use GRIB definition are given as 4-byte INTEGERs in the following units:

- Latitudes and longitudes: microdegrees
- Distance (general): metres (default: can be changed)
- Time: seconds (default: can be changed)
- Depth below sea level: millimetres (positive downwards)
- Isopycnic level: potential density - 1000*106.
  - Permitted range of values is approximately:
  - -2.147*10 9 < i < 2.147*109

At several points in the definition, there may be a need for a variable amount of supplementary data. This is indicated with '(+info)', and in such cases a supplementary data block is specified at the end of the local use section.

### Coordinate structure definition.

The physical meaning of the (x,y,z,t) coordinate system is defined below.

KSEC1 element | Contents | GRIB octet | Recommended GRIB API keys | Coded GRIB API keys | Comments
--- | --- | --- | --- | --- | ---
46 |
    Space unit flag (applies only if lengths not otherwise labelled):
     0 = metres
     i<128 = 10**i metres
     i>128 = 10**(i-256) metres
| 55 | spaceUnitFlag | spaceUnitFlag |
47 |
    Vertical coordinate definition (z):
     0 = z above origin
     1 = R from origin
     2 = h above mean sea level geopotential
     3 = h above ground surface
     160 = Geopotential depth below mean sea level (mm)
     161 = Ocean isopycnic surface (potential density)
| 56 | verticalCoordinateDefinition | verticalCoordinateDefinition |
48 |
    Horizontal coordinate definition (x,y):
     0 = Latitude/longitude (microdegrees)
     1 = Cartesian (fundamental origin)
     2 = Cartesian (shifted, rotated origin) (+info)
     3 = Regular gaussian grid (microdegrees) (+info)
     4 = Polar stereographic (+info)
     5 = Spherical harmonic coefficients (INTEGERs) (+info)
| 57 | horizontalCoordinateDefinition | horizontalCoordinateDefinition |
49 |

    Time unit flag:
     0 = Seconds
     1 = Minutes
     2 = Hours
     3 = Days
     4 = Years
     5<i<128 = 10**(i-4) years i>128 = 10**(i-256) seconds
| 58 | timeUnitFlag | timeUnitFlag |
50 |
    Time coordinate definition (t):
     0 = Real Earth time (UTC)
     1 = Ideal Earth time (360 * 86400s days per year)
| 59 | timeCoordinateDefinition | timeCoordinateDefinition |

### Position definition.

A 2-dimensional field located in 4-dimensional space-time needs 2 coordinates to define where the field is located, and 2 coordinates internal to the field. The locating coordinates are specified first. Each coordinate is identified according to the following table, in this order where possible:

- 1 = t
- 2 = z
- 3 = x
- 4 = y

  ### Mixed coordinates

  It is possible to specify mixed coordinates, to allow sections at angles to the coordinate system.

  KSEC1 element | Contents | GRIB octet | Recommended GRIB API keys | Coded GRIB API keys | Comments
  --- | --- | --- | --- | --- | ---
  51 |
      Mixed coordinate field flag:
       0 = No mixed coordinates
       1 = x,y coordinates mixed (+info)
       2 = x,z coordinates mixed (+info)
       3 = y,z coordinates mixed (+info)
       4 = x,t coordinates mixed (+info)
       5 = y,t coordinates mixed (+info)
       6 = z,t coordinates mixed (+info)
  | 60 | mixedCoordinateFieldFlag | mixedCoordinateFieldFlag |
  52 | Coordinate 1 flag (usually time). | 61 | coordinate1Flag | coordinate1Flag |
  53 |
      Averaging flag:
       0 = no averaging (data on/at level 1)
       1 = inclusive average between level 1 and 2
       2 = exclusive average between level 1 and 2
  | 62 | averaging1Flag | averaging1Flag |
  54 | Position of level 1 | 63-66 | coordinate1Start | coordinate1Start |
  55 | Position of level 2 (or zero if not used) | 67-70 | coordinate1End | coordinate1End |
  56 | Coordinate 2 flag (usually z-coordinate). | 71 | coordinate2Flag | coordinate2Flag |
  57 |
      Averaging flag:
       0 = no averaging (data on/at level 1)
       1 = inclusive average between level 1 and 2
       2 = exclusive average between level 1 and 2
  | 72 | averaging2Flag | averaging2Flag |
  58 | Position of level 1 | 73-76 | coordinate2Start | coordinate2Start |
  59 | Position of level 2 (or zero if not used) | 77-80 | coordinate2End | coordinate2End |

  An inclusive average discards land points when calculating the average, and will produce a value where there is at least one valid ocean point. An exclusive average will only produce a value if all of the points being averaged are valid.

  ### Data grid definitions

  KSEC1 element | Contents | GRIB octet | Recommended GRIB API keys | Coded GRIB API keys | Comments
  --- | --- | --- | --- | --- | ---
  60 | Coordinate 3 flag (x-axis, usually longitude). | 81 | coordinate3Flag | coordinate3Flag |
  61 | Coordinate 4 flag (y-axis, usually latitude). | 82 | coordinate4Flag | coordinate4Flag |
  62 | Coordinate 4 of first grid point | 83-86 | coordinate4OfFirstGridPoint | coordinate4OfFirstGridPoint |
  63 | Coordinate 3 of first grid point | 87-90 | coordinate3OfFirstGridPoint | coordinate3OfFirstGridPoint |
  64 | Coordinate 4 of last grid point | 91-94 | coordinate4OfLastGridPoint | coordinate4OfLastGridPoint |
  65 | Coordinate 3 of last grid point | 95-98 | coordinate3OfLastGridPoint | coordinate3OfLastGridPoint |
  66 | i-increment | 99-102 | iIncrement | iIncrement |
  67 | j-increment | 103-106 | jIncrement | jIncrement |
  68 |
      Flag for irregular grid coordinate list:
       0 = none
       1 = x-axis values (typically longitude)
       2 = y-axis values (typically latitude)
       3 = first x-axis, then y-axis values given
  | 107 | flagForIrregularGridCoordinateList | flagForIrregularGridCoordinateList |
  69 |
      Flag for normal or staggered grid:
       0 = normal grid (all rows have same x-coordinate system)
       1 = staggered grid (odd and even rows have different x-coordinate systems,
           eg Arakawa grid).
  | 108 | flagForNormalOrStaggeredGrid | flagForNormalOrStaggeredGrid |

  ### Auxiliary information

  KSEC1 element | Contents | GRIB octet | Recommended GRIB API keys | Coded GRIB API keys | Comments
  --- | --- | --- | --- | --- | ---
  70 |
      Flag for any further information:
       0 = none
       1 = auxiliary array contains x-axis topographic depths/heights.
  | 109 | flagForAnyFurtherInformation | flagForAnyFurtherInformation |
  71 | Number of entries in the horizontal coordinate definition | 110 | numberInHorizontalCoordinates | numberInHorizontalCoordinates |
  72 | Number of entries in mixed coordinate definition | 111-112 | numberInMixedCoordinateDefinition | numberInMixedCoordinateDefinition |
  73 | Number of entries in the grid coordinate list | 113-114 | numberInTheGridCoordinateList | numberInTheGridCoordinateList |
  74 | Number of entries in the auxiliary array | 115-116 | numberInTheAuxiliaryArray | numberInTheAuxiliaryArray |

  The horizontal coordinate definition, the mixed coordinate definition, the grid coordinate list, the auxiliary array and the post-auxiliary-array values are stored in GRIB as 4-byte INTEGERs.

  Horizontal coordinate definition
  KSEC1 element | Contents | Recommended GRIB API keys | Coded GRIB API keys | Comments
  --- | --- | --- | --- | ---
  A1-nn | Horizontal coordinate supplement. Not yet defined. | horizontalCoordinateSupplement | horizontalCoordinateSupplement | "numberInHorizontalCoordinates" elements

  Mixed coordinate definition
  KSEC1 element | Contents | Recommended GRIB API keys | Coded GRIB API keys | Comments
  --- | --- | --- | --- | ---
  B1 |
      Flag for regularity of x-y coordinate mixing:
       0 = Mixing is regular and linear
       1 = Mixing is irregular, code given
  | mixedCoordinateDefinition | mixedCoordinateDefinition | "numberInMixedCoordinateDefinition" elements
  - | For regular, linear mixing. |  |  |
  B2 | Alpha *109 |  |  |
  B3 | X0 |  |  |
  B4 | Y0 |  |  |
  - | Irregular mixing with code given. |  |  |
  B2 | Locally defined codes to define section. |  |  |
  B3 | Locally defined codes to define section. |  |  |
  B4 | Locally defined codes to define section. |  |  |

  Grid coordinate list
  KSEC1 element | Contents | Recommended GRIB API keys | Coded GRIB API keys | Comments
  --- | --- | --- | --- | ---
  C1-nn |
      Coordinates of irregular x and y-axes.
      The x-axis is given first, then the second x-axis (if staggered grid), and
      then the y-axis.
      If the x-axis is regular but staggered, the longitude of the first point of
      the second row should be specified as the first entry of this list.
  | gridCoordinate | gridCoordinate | "numberInTheGridCoordinateList" values

  Auxiliary array
  KSEC1 element | Contents | Recommended GRIB API keys | Coded GRIB API keys | Comments
  --- | --- | --- | --- | ---
  D1-nn | Auxiliary array values. | auxiliary | auxiliary | "numberInTheAuxiliaryArray" values

  Post-auxiliary array
  KSEC1 element | Contents | Recommended GRIB API keys | Coded GRIB API keys | Comments
  --- | --- | --- | --- | ---
  E1 | Size of post-auxiliary array (number of entries, including E1) | sizeOfPostAuxiliaryArrayPlusOne | sizeOfPostAuxiliaryArrayPlusOne |
  E2-E4 | Array values | postAuxiliary | postAuxiliary | "sizeOfPostAuxiliaryArrayPlusOne- 1" valies
  E5-E7 | Used for hindcast support if E1 > 4 |  |  |
  E8 | Used if E1=8 |  |  |
  E5 | Reference date (YYYYMMDD) |  |  |
  E6 | Climate date - from (YYYYMMDD), or zero |  |  |
  E7 | Climate date - to (YYYYMMDD), or zero |  |  |
  E8 |
      Ocean Atmosphere coupling:
      0 = unspecified
      1 = uncoupled
      2 = coupled

  If the post-auxiliary array is not being used, E1 (the value in KSEC1 after the end of the previously defined part of KSEC1) must be explicitly set to zero when coding or else errors may result.

  ### Comments on setting other GRIB parameters.

  The time and time-range data should be set in the main section, if possible.

  The indicator of type of level should be set to 160 (depth below sea level) for all oceanographic data. The depth in metres should be set to the appropriate value if the field is a horizontal section, and to zero in all other cases.

  It is assumed that the grid description section of the GRIB code corresponds to a latitude/longitude grid, with correct values for the number of points along parallels/meridians, and the coordinates of the first and last data points are in millidegrees (or the appropriate units from this section, divided by 1000).

  The coordinate increments should be given to the extent that the field is regular.