1# Copyright 2005-2018 ECMWF.
2#
3# This software is licensed under the terms of the Apache Licence Version 2.0
4# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
5#
6# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
7# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
8#
9
10# moved here to allow different bitsPerValue in second order packing
11unsigned[1] bitsPerValue : dump ;
12alias numberOfBitsContainingEachPackedValue = bitsPerValue;
13
14# For grib1 -> grib2
15#constant dataRepresentationTemplateNumber = ?;
16
17# TODO
18codetable[1] precision "grib1/precision.table" = 2 : dump,edition_specific;
19position offsetBeforeData;
20if( bitmapPresent || !GDSPresent ) {
21  # For grib1 -> grib2
22  constant bitMapIndicator = 0;
23  meta   codedValues data_raw_packing(
24                section4Length,
25                offsetBeforeData,
26                offsetSection4,
27                numberOfCodedValues,
28                precision
29              );
30  meta values data_apply_bitmap(codedValues,
31                bitmap,missingValue,binaryScaleFactor) : dump;
32  alias data.packedValues = codedValues;
33} else {
34 # For grib1 -> grib2
35 constant bitMapIndicator = 255;
36
37  meta   values data_raw_packing(
38                section4Length,
39                offsetBeforeData,
40                offsetSection4,
41                numberOfCodedValues,
42                precision
43              );
44  alias data.packedValues = values;
45}
46
47meta numberOfCodedValues number_of_values_data_raw_packing(values,precision);
48
49template statistics "common/statistics_grid.def";
50