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

# TEMPLATE 5.51, Spherical harmonics data - complex packing

include "grib2/template.5.packing.def";

if (gribex_mode_on()) {
  transient computeLaplacianOperator=0 : hidden;
} else {
  transient computeLaplacianOperator=1 : hidden;
}

meta _numberOfValues spectral_truncation(J,K,M,numberOfValues): read_only;

constant laplacianScalingFactorUnset  = -2147483647;
signed[4] laplacianScalingFactor : edition_specific ;

meta  data.laplacianOperator         scale(laplacianScalingFactor,one,million,truncateLaplacian) ;
meta  laplacianOperatorIsSet    evaluate(laplacianScalingFactor != laplacianScalingFactorUnset && !computeLaplacianOperator);

transient JS= 20 ;
transient KS=20 ;
transient MS=20 ;
transient subSetJ=0 ;
transient subSetK=0 ;
transient subSetM=0 ;

unsigned[4] TS ;

meta _TS spectral_truncation(J,K,M,TS) : read_only,hidden;

# This is read_only until we support other values
codetable[1] unpackedSubsetPrecision ('5.7.table',masterDir,localDir) = 2 : dump;

alias precisionOfTheUnpackedSubset=unpackedSubsetPrecision;
