eccodes/definitions/grib2/template.5.1.def

70 lines
2.2 KiB
Modula-2
Raw Normal View History

2020-01-28 14:32:34 +00:00
# (C) Copyright 2005- ECMWF.
2013-03-25 12:04:10 +00:00
2021-02-06 13:07:35 +00:00
# TEMPLATE 5.1, Matrix values at grid point - simple packing
# Preliminary note:
# This template was not validated at the time of publication and should be used with caution
2013-03-25 12:04:10 +00:00
2024-01-16 12:40:17 +00:00
include "grib2/template.5.packing.def"
2013-03-25 12:04:10 +00:00
2021-02-06 13:07:35 +00:00
unsigned[1] matrixBitmapsPresent;
2013-03-25 12:04:10 +00:00
# same as in edition 1
alias secondaryBitmapPresent=matrixBitmapsPresent;
2021-02-06 13:07:35 +00:00
# Number of data values encoded in Section 7
2023-08-06 12:57:28 +00:00
unsigned[4] numberOfCodedValues;
2013-03-25 12:04:10 +00:00
2021-02-06 13:07:35 +00:00
# NR - first dimension (rows)
unsigned[2] firstDimension;
2013-03-25 12:04:10 +00:00
2022-03-08 17:15:59 +00:00
alias NR = firstDimension;
2021-02-06 13:07:35 +00:00
# NC - second dimension (columns)
unsigned[2] secondDimension;
2013-03-25 12:04:10 +00:00
2023-11-26 18:05:43 +00:00
alias NC = secondDimension;
2021-02-06 13:07:35 +00:00
# First dimension coordinate value definition (Code Table 5.2)
unsigned[1] firstDimensionCoordinateValueDefinition;
2013-03-25 12:04:10 +00:00
2021-02-06 13:07:35 +00:00
# NC1 - number of coefficients or values used to specify first dimension coordinate function
2013-03-25 12:04:10 +00:00
unsigned[1] NC1 : dump ;
alias numberOfCoefficientsOrValuesUsedToSpecifyFirstDimensionCoordinateFunction=NC1;
2021-02-06 13:07:35 +00:00
# Second dimension coordinate value definition (Code Table 5.2)
2013-03-25 12:04:10 +00:00
unsigned[1] secondDimensionCoordinateValueDefinition ;
2021-02-06 13:07:35 +00:00
# NC2 - number of coefficients or values used to specify second dimension coordinate function
2013-03-25 12:04:10 +00:00
unsigned[1] NC2 : dump ;
alias numberOfCoefficientsOrValuesUsedToSpecifySecondDimensionCoordinateFunction = NC2;
2021-02-06 13:07:35 +00:00
# First dimension physical significance (Code Table 5.3)
2013-03-25 12:04:10 +00:00
unsigned[1] firstDimensionPhysicalSignificance ;
2021-02-06 13:07:35 +00:00
# Second dimension physical significance (Code Table 5.3)
2013-03-25 12:04:10 +00:00
unsigned[1] secondDimensionPhysicalSignificance ;
2023-11-26 18:05:43 +00:00
ieeefloat coefsFirst[NC1]; # TODO: find proper names
2021-02-06 13:07:35 +00:00
ieeefloat coefsSecond[NC2]; # TODO: find proper names
2013-03-25 12:04:10 +00:00
alias data.coefsFirst = coefsFirst;
alias data.coefsSecond=coefsSecond;
2022-03-08 17:15:59 +00:00
if (matrixBitmapsPresent == 1) {
2013-03-25 12:04:10 +00:00
constant datumSize = NC*NR;
2021-02-06 13:07:35 +00:00
constant secondaryBitmapsCount = numberOfValues + 0;
2013-03-25 12:04:10 +00:00
constant secondaryBitmapsSize = secondaryBitmapsCount/8;
2022-03-08 17:15:59 +00:00
transient numberOfDataMatrices = numberOfDataPoints/datumSize;
2013-03-25 12:04:10 +00:00
position offsetBBitmap;
meta secondaryBitmaps g2bitmap(
dummy,
missingValue,
offsetBSection5,
section5Length,
numberOfCodedValues ,
2021-02-06 13:07:35 +00:00
dummy) : read_only;
2013-03-25 12:04:10 +00:00
2022-03-08 17:15:59 +00:00
meta bitmap data_g2secondary_bitmap(primaryBitmap,
2013-03-25 12:04:10 +00:00
secondaryBitmaps,
missingValue,datumSize,numberOfDataPoints) : read_only;
}