# Copyright 2005-2016 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.
#

label "grib 2 Section 7 data";
# START grib2::section
# SECTION 7, DATA SECTION
#  Length of section in octets
# (nn)

position offsetSection7;

section_length[4] section7Length ;
meta section7 section_pointer(offsetSection7,section7Length,7);

#  Number of section
unsigned[1] numberOfSection = 7:read_only;

# Octets 6-nn : Data in a format described by Data Template 7.x, where x is the Data Representation
# Template number given in octets 10-11 of Section 5
position offsetBeforeData;
#if (changed(dataRepresentationTemplateNumber)) {
  template dataValues "grib2/template.7.[dataRepresentationTemplateNumber:l].def";
#}

meta changeDecimalPrecision decimal_precision(bitsPerValue,decimalScaleFactor,changingPrecision,values)  : edition_specific;
meta decimalPrecision decimal_precision(bitsPerValue,decimalScaleFactor,changingPrecision)  : edition_specific;
alias setDecimalPrecision=changeDecimalPrecision;

meta setBitsPerValue bits_per_value(values,bitsPerValue)  : edition_specific;

meta getNumberOfValues size(values) : edition_specific,dump ;

meta scaleValuesBy scale_values(values,missingValue)  : edition_specific;
meta offsetValuesBy offset_values(values,missingValue)  : edition_specific;

concept productType(unknown) {
    "obstat" = {grib2LocalSectionPresent=1; centre=98; grib2LocalSectionNumber=500;productDefinitionTemplateNumber=2000;}
}

position offsetAfterData;
meta md5Section7 md5(offsetSection7,section7Length);
alias md5DataSection = md5Section7;

