# 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.
#

ieeefloat   referenceValue  : no_copy;
meta referenceValueError reference_value_error(referenceValue,ieee);

signed[2]   binaryScaleFactor : no_copy;

signed[2]   decimalScaleFactor :no_copy;

# Try different values of binaryScaleFactor and decimalScaleFactor to reduce packing error
transient optimizeScaleFactor = 0;

unsigned[1] bitsPerValue ;
unsigned[1] widthOfFirstOrderValues :no_copy ;

unsigned [4] numberOfGroups : no_copy;
unsigned [4] numberOfSecondOrderPackedValues : no_copy;
unsigned [1] widthOfWidths : no_copy;
unsigned [1] widthOfLengths : no_copy;
flags [1] secondOrderFlags "grib2/tables/[tablesVersion]/5.50002.table" = 0;
unsigned [1] orderOfSPD = 2 : no_copy ;

flagbit boustrophedonicOrdering(secondOrderFlags,7) = 0;
alias boustrophedonic=boustrophedonicOrdering;

if (orderOfSPD) {
	 unsigned[1] widthOfSPD ;
	 meta SPD spd(widthOfSPD,orderOfSPD) : read_only;
}
