# Copyright 2005-2018 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
# 
# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
#

# START 1/local.98.191 ----------------------------------------------------------------------
# LOCAL 98 191
#
# localDefinitionTemplate_191
# ---------------------------
#
# Description            Octet    Code    Ksec1    Count
# -----------            -----    ----    -----    -----
#localDefinitionNumber       41  I1  37  -
#class               42  I1  38  -
#type                43  I1  39  -
#stream              44  I2  40  -
#experimentVersionNumber     46  A4  41  -
#zeroForCompatibilityWithMars    50  PAD 42  2
#formatVersionMajorNumber    52  I1  44  -
#formatVersionMinorNumber    53  I1  45  -
#originalSubCentreIdentifier 54  I1  46  -
#setToZero           55  PAD 47  4
#numberOfBytesOfFreeFormatData   59  I2  51  -
#dataDescriptorBytes     61  BYTES   52  numberOfBytesOfFreeFormatData
#padToAMultipleOf80Bytes     60  PADFROM n/a 80
#


template mars_labeling "grib1/mars_labeling.def";

# zeroForCompatibilityWithMars
pad padding_loc191_1(2);

unsigned[1] formatVersionMajorNumber  : dump;

unsigned[1] formatVersionMinorNumber  : dump;

unsigned[1] originalSubCentreIdentifier  : dump;

# This does not belong here, this is for class=ms,country=de
alias mars.levelist = level;


# setToZero

pad padding_loc191_2(4);

unsigned[2] numberOfBytesOfFreeFormatData  : dump;

position offsetFreeFormData;
#freeFormDataList list(numberOfBytesOfFreeFormatData) {
#    unsigned[1] freeFormData;
#}

unsigned[1] freeFormData[numberOfBytesOfFreeFormatData]  : dump;

# padToAMultipleOf80Bytes
# -1 comes from gribex
padtomultiple padding_loc191_3(offsetFreeFormData,80);
position offsetAfterPadding;
constant GRIBEXSection1Problem = ( offsetAfterPadding - offsetFreeFormData) % 80 ;



# END   1/local.98.191 ----------------------------------------------------------------------
