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; 13constant constantFieldHalfByte=8; 14 15# For grib1 -> grib2 16#constant dataRepresentationTemplateNumber = 0; 17 18position offsetBeforeData; 19 20if( bitmapPresent || !GDSPresent ) { 21 # For grib1 -> grib2 22 constant bitMapIndicator = 0; 23 24 meta codedValues data_g1simple_packing( 25 #simple_packing args 26 section4Length, 27 offsetBeforeData, 28 offsetSection4, 29 unitsFactor, 30 unitsBias, 31 changingPrecision, 32 numberOfCodedValues, 33 bitsPerValue, 34 referenceValue, 35 binaryScaleFactor, 36 decimalScaleFactor, 37 #g1simple_packing args 38 halfByte, 39 packingType, 40 grid_ieee,precision 41 ) : read_only; 42 meta values data_apply_bitmap(codedValues,bitmap,missingValue,binaryScaleFactor) : dump; 43 alias data.packedValues = codedValues; 44} else { 45 46 # For grib1 -> grib2 47 constant bitMapIndicator = 255; 48 49 meta values data_g1simple_packing( 50 section4Length, 51 offsetBeforeData, 52 offsetSection4, 53 unitsFactor, 54 unitsBias, 55 changingPrecision, 56 numberOfCodedValues, 57 bitsPerValue, 58 referenceValue, 59 binaryScaleFactor, 60 decimalScaleFactor, 61 halfByte, 62 packingType, 63 grid_ieee,precision 64 ) : dump; 65 alias data.packedValues = values; 66} 67 68 69 70meta numberOfCodedValues number_of_coded_values(bitsPerValue,offsetBeforeData,offsetAfterData,halfByte,numberOfValues) : dump; 71 72meta packingError simple_packing_error(bitsPerValue,binaryScaleFactor,decimalScaleFactor,referenceValue,ibm) : no_copy; 73meta unpackedError simple_packing_error(zero,binaryScaleFactor,decimalScaleFactor,referenceValue,ieee) : no_copy; 74template statistics "common/statistics_grid.def"; 75 76