mirror of https://github.com/ecmwf/eccodes.git
Merge remote-tracking branch 'origin/develop' into feature/ECC-1537-TileTemplate
This commit is contained in:
commit
e5fc1b7440
|
@ -9,6 +9,8 @@
|
|||
|
||||
constant ieeeFloats = 0 : hidden, edition_specific;
|
||||
transient eps=0;
|
||||
constant false=0 : hidden;
|
||||
constant true=1 : hidden;
|
||||
constant two=1 : hidden;
|
||||
constant three=1 : hidden;
|
||||
constant eight=8 : hidden;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# GRID DEFINITION spherical harmonic coefficients (including rotated, stretched, or stretched and rotated)
|
||||
constant isGridded = zero;
|
||||
constant isGridded = false;
|
||||
|
||||
# J - pentagonal resolution parameter
|
||||
unsigned[2] J : dump ;
|
||||
|
|
|
@ -8,5 +8,5 @@ meta geography.longitudeOfSouthernPoleInDegrees scale(longitudeOfSouthernPole ,o
|
|||
|
||||
ibmfloat geography.angleOfRotationInDegrees : dump;
|
||||
|
||||
alias angleOfRotation =angleOfRotationInDegrees;
|
||||
alias isRotatedGrid = one;
|
||||
alias angleOfRotation = angleOfRotationInDegrees;
|
||||
alias isRotatedGrid = true;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
constant isGridded = one;
|
||||
constant isGridded = true;
|
||||
|
||||
# Scanning mode
|
||||
flags[1] scanningMode 'grib1/8.table' : edition_specific,no_copy;
|
||||
|
|
|
@ -25,7 +25,7 @@ codetable[1] dataRepresentationType 'grib1/6.table' = 0;
|
|||
meta gridDefinitionDescription codetable_title(dataRepresentationType);
|
||||
|
||||
# Grid definition (according to data representation type - octet 6 above)
|
||||
alias isRotatedGrid=zero;
|
||||
alias isRotatedGrid = false;
|
||||
|
||||
if (dataRepresentationType < 192) {
|
||||
template dataRepresentation "grib1/grid_definition_[dataRepresentationType:l].def";
|
||||
|
|
|
@ -13,6 +13,8 @@ constant tablesVersionLatestOfficial = 31 : edition_specific;
|
|||
# If this is different from the official version, then it is the pre-operational version
|
||||
constant tablesVersionLatest = 32 : edition_specific;
|
||||
|
||||
constant false = 0 : hidden;
|
||||
constant true = 1 : hidden;
|
||||
constant million = 1000000 : hidden;
|
||||
constant grib2divider = 1000000;
|
||||
alias extraDimensionPresent=zero;
|
||||
|
|
|
@ -75,24 +75,69 @@ concept marsType(unknown) {
|
|||
}
|
||||
}
|
||||
|
||||
# get the values from the 1st most outer loop which matter
|
||||
meta outerLoopLengthOfTimeRange element(lengthOfTimeRange, 0);
|
||||
meta outerLoopTypeOfStatisticalProcessing element(typeOfStatisticalProcessing, 0);
|
||||
meta outerLoopTypeOfTimeIncrement element(typeOfTimeIncrement, 0);
|
||||
|
||||
# See GRIB-205 re no_copy
|
||||
# Cannot use typeOfProcessedData for stream. See GRIB-911
|
||||
concept marsStream(unknown) {
|
||||
|
||||
oper = {
|
||||
productDefinitionTemplateNumber = 8;
|
||||
}
|
||||
oper = {
|
||||
productDefinitionTemplateNumber = 0;
|
||||
}
|
||||
|
||||
oper = {
|
||||
productDefinitionTemplateNumber = 8;
|
||||
}
|
||||
enda = {
|
||||
productDefinitionTemplateNumber = 11;
|
||||
}
|
||||
enda = {
|
||||
productDefinitionTemplateNumber = 1;
|
||||
}
|
||||
} : no_copy;
|
||||
moda = {
|
||||
productDefinitionTemplateNumber = 8;
|
||||
outerLoopTypeOfTimeIncrement = 1;
|
||||
}
|
||||
# avgd, mind, maxd
|
||||
dame = {
|
||||
productDefinitionTemplateNumber = 8;
|
||||
outerLoopTypeOfTimeIncrement = 1;
|
||||
outerLoopLengthOfTimeRange = 21;
|
||||
}
|
||||
# accumd
|
||||
dame = {
|
||||
productDefinitionTemplateNumber = 8;
|
||||
outerLoopTypeOfTimeIncrement = 1;
|
||||
outerLoopLengthOfTimeRange = 24;
|
||||
}
|
||||
} : no_copy,read_only;
|
||||
|
||||
alias mars.stream = marsStream;
|
||||
alias mars.type = marsType;
|
||||
|
||||
if (marsStream is "moda") {
|
||||
meta verificationDate g1verificationdate(dataDate, dataTime, outerLoopLengthOfTimeRange) : read_only;
|
||||
meta monthlyVerificationDate g1monthlydate(verificationDate) : no_copy;
|
||||
alias mars.date = monthlyVerificationDate;
|
||||
|
||||
unalias mars.time;
|
||||
unalias mars.step;
|
||||
}
|
||||
|
||||
if (marsStream is "dame") {
|
||||
if (!(outerLoopTypeOfStatisticalProcessing == 3 || outerLoopTypeOfStatisticalProcessing == 2)) {
|
||||
# not mind or maxd
|
||||
alias mars.date = validityDate;
|
||||
}
|
||||
|
||||
if (outerLoopLengthOfTimeRange == 24) {
|
||||
# accumd
|
||||
meta verificationDate g1verificationdate(dataDate, dataTime, outerLoopLengthOfTimeRange) : read_only;
|
||||
alias mars.date = verificationDate;
|
||||
}
|
||||
|
||||
unalias mars.time;
|
||||
unalias mars.step;
|
||||
}
|
||||
|
|
|
@ -111,7 +111,7 @@ meta is_aerosol_optical g2_aerosol(productDefinitionTemplateNumber, stepType, 1
|
|||
|
||||
transient setCalendarId = 0 ;
|
||||
transient deleteCalendarId = 0 ;
|
||||
alias calendarIdPresent = zero;
|
||||
alias calendarIdPresent = false;
|
||||
if ( ((section1Length > 21) or setCalendarId > 0) and deleteCalendarId == 0) {
|
||||
alias calendarIdPresent = present;
|
||||
codetable[2] calendarIdentificationTemplateNumber ('1.5.table',masterDir,localDir) : dump,string_type,no_fail;
|
||||
|
|
|
@ -14,7 +14,7 @@ transient addEmptySection2 = 0;
|
|||
|
||||
if ( addEmptySection2 == 0 ) {
|
||||
if ( grib2LocalSectionPresent==1 or ( section2Length>5 or new() ) ) {
|
||||
alias section2Used=one;
|
||||
alias section2Used=true;
|
||||
|
||||
if(productionStatusOfProcessedData == 8 || productionStatusOfProcessedData == 9) {
|
||||
# This for adding an expver other than prod/test to UERRA
|
||||
|
|
|
@ -33,7 +33,7 @@ if(numberOfOctectsForNumberOfPoints == 0){
|
|||
codetable[2] gridDefinitionTemplateNumber ('3.1.table',masterDir,localDir) =0 : dump,edition_specific;
|
||||
meta gridDefinitionDescription codetable_title(gridDefinitionTemplateNumber);
|
||||
|
||||
alias isRotatedGrid=zero;
|
||||
alias isRotatedGrid = false;
|
||||
|
||||
if (gridDefinitionTemplateNumber >= 32768) {
|
||||
template gridDefinitionSection "grib2/local/[centreForLocal]/template.3.[gridDefinitionTemplateNumber:l].def";
|
||||
|
|
|
@ -20,7 +20,7 @@ alias numberOfVerticalGridDescriptors=NV ;
|
|||
transient neitherPresent = 0;
|
||||
|
||||
if (centre==7 || centre==46) {
|
||||
alias disableGrib1LocalSection=one;
|
||||
alias disableGrib1LocalSection=true;
|
||||
}
|
||||
|
||||
concept datasetForLocal(unknown) {
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# TEMPLATE 3.10, Mercator
|
||||
include "grib2/template.3.shape_of_the_earth.def";
|
||||
|
||||
constant isGridded = one;
|
||||
constant isGridded = true;
|
||||
|
||||
unsigned[4] Ni : dump;
|
||||
alias numberOfPointsAlongAParallel = Ni;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# (C) Copyright 2005- ECMWF.
|
||||
|
||||
# TEMPLATE 3.100, Triangular grid based on an icosahedron (see Attachment I.2-GRIB-Att.)
|
||||
constant isGridded = one;
|
||||
constant isGridded = true;
|
||||
|
||||
# n2 - exponent of 2 for the number of intervals on main triangle sides
|
||||
unsigned[1] n2 : dump ;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# TEMPLATE 3.1000, Cross-section grid, with points equally spaced on the horizontal
|
||||
include "grib2/template.3.shape_of_the_earth.def";
|
||||
|
||||
constant isGridded = one;
|
||||
constant isGridded = true;
|
||||
|
||||
# Number of horizontal points
|
||||
unsigned[4] numberOfHorizontalPoints : dump ;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
# TEMPLATE 3.101, General Unstructured Grid
|
||||
|
||||
constant isGridded = one;
|
||||
constant isGridded = true;
|
||||
|
||||
codetable[1] shapeOfTheEarth ('3.2.table',masterDir,localDir) : dump;
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# TEMPLATE 3.110, Equatorial azimuthal equidistant projection
|
||||
include "grib2/template.3.shape_of_the_earth.def";
|
||||
|
||||
constant isGridded = one;
|
||||
constant isGridded = true;
|
||||
|
||||
# Nx - number of points along X-axis
|
||||
unsigned[4] numberOfPointsAlongXAxis : dump;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# TEMPLATE 3.1100, Hovmoller diagram grid with points equally spaced on the horizontal
|
||||
include "grib2/template.3.shape_of_the_earth.def";
|
||||
|
||||
constant isGridded = one;
|
||||
constant isGridded = true;
|
||||
|
||||
# Number of horizontal points
|
||||
unsigned[5] numberOfHorizontalPoints : dump ;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# TEMPLATE 3.12, Transverse Mercator
|
||||
include "grib2/template.3.shape_of_the_earth.def";
|
||||
|
||||
constant isGridded = one;
|
||||
constant isGridded = true;
|
||||
|
||||
unsigned[4] Ni : dump;
|
||||
alias numberOfPointsAlongAParallel = Ni;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
# TEMPLATE 3.120, Azimuth-range projection
|
||||
|
||||
constant isGridded = one;
|
||||
constant isGridded = true;
|
||||
|
||||
# Nb - number of data bins along radials (A data bin is a data point representing the volume centred on it)
|
||||
unsigned[4] numberOfDataBinsAlongRadials;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# (C) Copyright 2005- ECMWF.
|
||||
|
||||
# TEMPLATE 3.1200, Time section grid
|
||||
constant isGridded = one;
|
||||
constant isGridded = true;
|
||||
|
||||
# NT - Number of time steps
|
||||
unsigned[4] numberOfTimeSteps : dump;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
# TEMPLATE 3.130, Irregular Latitude/longitude grid
|
||||
|
||||
constant isGridded = one;
|
||||
constant isGridded = true;
|
||||
|
||||
# Note: This template is deprecated.
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# TEMPLATE 3.140, Lambert azimuthal equal area projection
|
||||
include "grib2/template.3.shape_of_the_earth.def";
|
||||
|
||||
constant isGridded = one;
|
||||
constant isGridded = true;
|
||||
|
||||
# Nx - number of points along X-axis
|
||||
unsigned[4] numberOfPointsAlongXAxis : dump;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# TEMPLATE 3.20, Polar stereographic projection
|
||||
include "grib2/template.3.shape_of_the_earth.def";
|
||||
|
||||
constant isGridded = one;
|
||||
constant isGridded = true;
|
||||
|
||||
# Nx - number of points along X-axis
|
||||
unsigned[4] Nx : dump;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# TEMPLATE 3.30, Lambert conformal
|
||||
include "grib2/template.3.shape_of_the_earth.def";
|
||||
|
||||
constant isGridded = one;
|
||||
constant isGridded = true;
|
||||
|
||||
unsigned[4] Nx : dump;
|
||||
alias Ni = Nx;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# TEMPLATE 3.31, Albers equal area
|
||||
include "grib2/template.3.shape_of_the_earth.def";
|
||||
|
||||
constant isGridded = one;
|
||||
constant isGridded = true;
|
||||
|
||||
# Nx - number of points along the X-axis
|
||||
unsigned[4] Nx : dump;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# TEMPLATE 3.90, Space view perspective or orthographic
|
||||
include "grib2/template.3.shape_of_the_earth.def";
|
||||
|
||||
constant isGridded = one;
|
||||
constant isGridded = true;
|
||||
|
||||
unsigned[4] Nx : dump;
|
||||
alias Ni = Nx;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
label "BiFourier coefficients";
|
||||
constant biFourierCoefficients=1;
|
||||
constant isGridded = one;
|
||||
constant isGridded = true;
|
||||
|
||||
codetable[1] spectralType ('3.6.table',masterDir,localDir) = 2 : no_copy;
|
||||
alias spectralDataRepresentationType=spectralType;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# (C) Copyright 2005- ECMWF.
|
||||
|
||||
constant isGridded = one;
|
||||
constant isGridded = true;
|
||||
|
||||
unsigned[4] Ni : can_be_missing,dump;
|
||||
alias numberOfPointsAlongAParallel=Ni;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
# See https://healpix.jpl.nasa.gov/pdf/intro.pdf
|
||||
|
||||
constant isGridded = one;
|
||||
constant isGridded = true;
|
||||
|
||||
# Number of grid points along one side of one of the 12 base resolution pixels (>=1)
|
||||
# The number of data points should be = 12 * Nside * Nside
|
||||
|
|
|
@ -18,4 +18,4 @@ alias geography.angleOfRotationInDegrees=angleOfRotation;
|
|||
|
||||
alias angleOfRotationOfProjection=angleOfRotation;
|
||||
|
||||
alias isRotatedGrid=one;
|
||||
alias isRotatedGrid = true;
|
||||
|
|
|
@ -24,13 +24,13 @@ alias scaleFactorOfMinorAxisOfOblateSpheroidEarth=scaleFactorOfEarthMinorAxis ;
|
|||
unsigned[4] scaledValueOfEarthMinorAxis = missing(): can_be_missing, edition_specific;
|
||||
alias scaledValueOfMinorAxisOfOblateSpheroidEarth=scaledValueOfEarthMinorAxis;
|
||||
|
||||
alias earthIsOblate=one;
|
||||
alias earthIsOblate = true;
|
||||
|
||||
_if (shapeOfTheEarth == 0) {
|
||||
transient radius=6367470;
|
||||
alias radiusOfTheEarth=radius;
|
||||
alias radiusInMetres=radius;
|
||||
alias earthIsOblate=zero;
|
||||
alias earthIsOblate=false;
|
||||
}
|
||||
_if (shapeOfTheEarth == 1){
|
||||
meta radius from_scale_factor_scaled_value(
|
||||
|
@ -38,20 +38,20 @@ _if (shapeOfTheEarth == 1){
|
|||
scaledValueOfRadiusOfSphericalEarth);
|
||||
alias radiusOfTheEarth=radius;
|
||||
alias radiusInMetres=radius;
|
||||
alias earthIsOblate=zero;
|
||||
alias earthIsOblate=false;
|
||||
}
|
||||
_if (shapeOfTheEarth == 6){
|
||||
transient radius=6371229;
|
||||
alias radiusOfTheEarth=radius;
|
||||
alias radiusInMetres=radius;
|
||||
alias earthIsOblate=zero;
|
||||
alias earthIsOblate=false;
|
||||
}
|
||||
|
||||
_if (shapeOfTheEarth == 8){
|
||||
transient radius=6371200;
|
||||
alias radiusOfTheEarth=radius;
|
||||
alias radiusInMetres=radius;
|
||||
alias earthIsOblate=zero;
|
||||
alias earthIsOblate=false;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -26,4 +26,4 @@ alias spectralDataRepresentationType=spectralType;
|
|||
codetable[1] spectralMode ('3.7.table',masterDir,localDir) = 1 : no_copy;
|
||||
alias spectralDataRepresentationMode=spectralMode;
|
||||
|
||||
constant isGridded = zero;
|
||||
constant isGridded = false;
|
||||
|
|
|
@ -54,10 +54,10 @@ alias vertical.level=level;
|
|||
alias vertical.bottomLevel=bottomLevel;
|
||||
alias vertical.topLevel=topLevel;
|
||||
|
||||
alias extraDim=zero;
|
||||
alias extraDim=false;
|
||||
if (defined(extraDimensionPresent)) {
|
||||
if (extraDimensionPresent) {
|
||||
alias extraDim=one;
|
||||
alias extraDim=true;
|
||||
}
|
||||
}
|
||||
if (extraDim) {
|
||||
|
|
|
@ -18,15 +18,16 @@ unsigned[1] minuteOfEndOfOverallTimeInterval =0 : edition_specific;
|
|||
# Second of end of overall time interval
|
||||
unsigned[1] secondOfEndOfOverallTimeInterval =0 : edition_specific;
|
||||
|
||||
# n - number of time range specifications describing the time intervals used to calculate the statistically-processed field
|
||||
# Number of time range specifications describing the time intervals used to calculate the statistically-processed field
|
||||
unsigned[1] numberOfTimeRange = 1 : edition_specific;
|
||||
alias n = numberOfTimeRange;
|
||||
alias numberOfTimeRanges = numberOfTimeRange;
|
||||
|
||||
# Total number of data values missing in statistical process
|
||||
unsigned[4] numberOfMissingInStatisticalProcess = 0 : edition_specific;
|
||||
alias totalNumberOfDataValuesMissingInStatisticalProcess=numberOfMissingInStatisticalProcess;
|
||||
|
||||
statisticalProcessesList list(numberOfTimeRange)
|
||||
statisticalProcessesList list(numberOfTimeRanges)
|
||||
{
|
||||
# Statistical process used to calculate the processed field from the field at each time increment during the time range
|
||||
codetable[1] typeOfStatisticalProcessing ('4.10.table',masterDir,localDir) : edition_specific;
|
||||
|
@ -50,7 +51,7 @@ statisticalProcessesList list(numberOfTimeRange)
|
|||
}
|
||||
|
||||
# See GRIB-488. We only support maximum of 2 time ranges
|
||||
if (numberOfTimeRange == 1 || numberOfTimeRange == 2) {
|
||||
if (numberOfTimeRanges == 1 || numberOfTimeRanges == 2) {
|
||||
concept stepTypeInternal {
|
||||
"instant" = {typeOfStatisticalProcessing=255;}
|
||||
"avg" = {typeOfStatisticalProcessing=0;typeOfTimeIncrement=255;}
|
||||
|
@ -95,7 +96,7 @@ if (numberOfTimeRange == 1 || numberOfTimeRange == 2) {
|
|||
indicatorOfUnitForTimeRange,
|
||||
lengthOfTimeRange,
|
||||
typeOfTimeIncrement,
|
||||
numberOfTimeRange
|
||||
numberOfTimeRanges
|
||||
) : dump,no_copy;
|
||||
|
||||
meta stepRange g2step_range(startStep,endStep): dump;
|
||||
|
|
|
@ -20,7 +20,7 @@ alias NR = firstDimension;
|
|||
# NC - second dimension (columns)
|
||||
unsigned[2] secondDimension;
|
||||
|
||||
alias NC = secondDimension;
|
||||
alias NC = secondDimension;
|
||||
# First dimension coordinate value definition (Code Table 5.2)
|
||||
unsigned[1] firstDimensionCoordinateValueDefinition;
|
||||
|
||||
|
@ -41,7 +41,7 @@ unsigned[1] firstDimensionPhysicalSignificance ;
|
|||
# Second dimension physical significance (Code Table 5.3)
|
||||
unsigned[1] secondDimensionPhysicalSignificance ;
|
||||
|
||||
ieeefloat coefsFirst[NC1]; # TODO: find proper names
|
||||
ieeefloat coefsFirst[NC1]; # TODO: find proper names
|
||||
ieeefloat coefsSecond[NC2]; # TODO: find proper names
|
||||
|
||||
alias data.coefsFirst = coefsFirst;
|
||||
|
|
|
@ -20,7 +20,7 @@ unsigned[4] secondaryMissingValueSubstitute ;
|
|||
# NG - Number of groups of data values into which field is split
|
||||
unsigned[4] numberOfGroupsOfDataValues ;
|
||||
|
||||
alias NG = numberOfGroupsOfDataValues;
|
||||
alias NG = numberOfGroupsOfDataValues;
|
||||
# Reference for group widths
|
||||
unsigned[1] referenceForGroupWidths ;
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ unsigned[4] secondaryMissingValueSubstitute ;
|
|||
# NG - Number of groups of data values into which field is split
|
||||
unsigned[4] numberOfGroupsOfDataValues ;
|
||||
|
||||
alias NG = numberOfGroupsOfDataValues;
|
||||
alias NG = numberOfGroupsOfDataValues;
|
||||
# Reference for group widths
|
||||
unsigned[1] referenceForGroupWidths ;
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ transient decimalScaleFactor=0 : hidden;
|
|||
alias numberOfBits = bitsPerValue;
|
||||
alias numberOfBitsContainingEachPackedValue = bitsPerValue;
|
||||
|
||||
codetable[1] precision ('5.7.table',masterDir,localDir) = 1 : edition_specific;
|
||||
codetable[1] precision ('5.7.table',masterDir,localDir) = 1 : edition_specific;
|
||||
concept accuracy(zero) {
|
||||
32 = { precision = 1; }
|
||||
64 = { precision = 2; }
|
||||
|
|
|
@ -8,12 +8,12 @@ include "grib2/template.5.original_values.def";
|
|||
unsigned[1] ccsdsFlags : dump;
|
||||
alias ccsdsCompressionOptionsMask=ccsdsFlags;
|
||||
|
||||
flagbit AEC_DATA_SIGNED_OPTION_MASK(ccsdsFlags,0) = 0;
|
||||
flagbit AEC_DATA_SIGNED_OPTION_MASK(ccsdsFlags,0) = 0;
|
||||
|
||||
# AEC_DATA_3BYTE_OPTION_MASK was switched on in order to allow data stored
|
||||
# with 17 <=bitsPerValue<= 24 to be stored in 3 rather than 4 bytes.
|
||||
# This eliminates discretization errors that were occurring when it was off.
|
||||
flagbit AEC_DATA_3BYTE_OPTION_MASK(ccsdsFlags,1) = 1;
|
||||
flagbit AEC_DATA_3BYTE_OPTION_MASK(ccsdsFlags,1) = 1;
|
||||
|
||||
flagbit AEC_DATA_MSB_OPTION_MASK(ccsdsFlags,2) = 1;
|
||||
flagbit AEC_DATA_PREPROCESS_OPTION_MASK(ccsdsFlags,3) = 1;
|
||||
|
|
|
@ -12,11 +12,11 @@ if (gribex_mode_on()) {
|
|||
|
||||
meta _numberOfValues spectral_truncation(J,K,M,numberOfValues): read_only;
|
||||
|
||||
constant laplacianScalingFactorUnset = -2147483647;
|
||||
constant laplacianScalingFactorUnset = -2147483647;
|
||||
signed[4] laplacianScalingFactor : edition_specific ;
|
||||
|
||||
meta data.laplacianOperator scale(laplacianScalingFactor,one,million,truncateLaplacian) ;
|
||||
meta laplacianOperatorIsSet evaluate(laplacianScalingFactor != laplacianScalingFactorUnset && !computeLaplacianOperator);
|
||||
meta data.laplacianOperator scale(laplacianScalingFactor,one,million,truncateLaplacian) ;
|
||||
meta laplacianOperatorIsSet evaluate(laplacianScalingFactor != laplacianScalingFactorUnset && !computeLaplacianOperator);
|
||||
|
||||
transient JS= 20 ;
|
||||
transient KS=20 ;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# (C) Copyright 2005- ECMWF.
|
||||
|
||||
ieeefloat referenceValue : no_copy;
|
||||
ieeefloat referenceValue : no_copy;
|
||||
meta referenceValueError reference_value_error(referenceValue,ieee);
|
||||
|
||||
signed[2] binaryScaleFactor : no_copy;
|
||||
|
|
|
@ -7,26 +7,26 @@ include "grib2/template.5.packing.def";
|
|||
if (gribex_mode_on()) {
|
||||
transient computeLaplacianOperator=0 : hidden;
|
||||
} else {
|
||||
transient computeLaplacianOperator=1 : hidden;
|
||||
transient computeLaplacianOperator=1 : hidden;
|
||||
}
|
||||
|
||||
meta _numberOfValues spectral_truncation(J,K,M,numberOfValues): read_only;
|
||||
|
||||
constant laplacianScalingFactorUnset = -2147483647;
|
||||
constant laplacianScalingFactorUnset = -2147483647;
|
||||
signed[4] laplacianScalingFactor : edition_specific ;
|
||||
|
||||
meta data.laplacianOperator scale(laplacianScalingFactor,one,million,truncateLaplacian) ;
|
||||
meta laplacianOperatorIsSet evaluate(laplacianScalingFactor != laplacianScalingFactorUnset && !computeLaplacianOperator);
|
||||
meta data.laplacianOperator scale(laplacianScalingFactor,one,million,truncateLaplacian) ;
|
||||
meta laplacianOperatorIsSet evaluate(laplacianScalingFactor != laplacianScalingFactorUnset && !computeLaplacianOperator);
|
||||
|
||||
unsigned[2] JS ;
|
||||
unsigned[2] KS ;
|
||||
unsigned[2] MS ;
|
||||
unsigned[2] JS;
|
||||
unsigned[2] KS;
|
||||
unsigned[2] MS;
|
||||
|
||||
alias subSetJ=JS ;
|
||||
alias subSetK=KS ;
|
||||
alias subSetM=MS ;
|
||||
alias subSetJ=JS;
|
||||
alias subSetK=KS;
|
||||
alias subSetM=MS;
|
||||
|
||||
unsigned[4] TS ;
|
||||
unsigned[4] TS;
|
||||
|
||||
meta _TS spectral_truncation(JS,KS,MS,TS) : read_only,hidden;
|
||||
|
||||
|
|
|
@ -10,14 +10,14 @@ transient computeLaplacianOperator=1 : hidden;
|
|||
codetable[1] biFourierSubTruncationType ('5.25.table',masterDir,localDir) : dump;
|
||||
codetable[1] biFourierPackingModeForAxes ('5.26.table',masterDir,localDir) = 0 : dump;
|
||||
|
||||
constant laplacianScalingFactorUnset = -2147483647;
|
||||
constant laplacianScalingFactorUnset = -2147483647;
|
||||
signed[4] laplacianScalingFactor : edition_specific ; # units of 10^-6
|
||||
|
||||
meta data.laplacianOperator scale(laplacianScalingFactor,one,million,truncateLaplacian) ;
|
||||
meta laplacianOperatorIsSet evaluate(laplacianScalingFactor != laplacianScalingFactorUnset && !computeLaplacianOperator);
|
||||
meta data.laplacianOperator scale(laplacianScalingFactor,one,million,truncateLaplacian) ;
|
||||
meta laplacianOperatorIsSet evaluate(laplacianScalingFactor != laplacianScalingFactorUnset && !computeLaplacianOperator);
|
||||
|
||||
unsigned[2] biFourierResolutionSubSetParameterN : dump ; # NS
|
||||
unsigned[2] biFourierResolutionSubSetParameterM : dump ; # MS
|
||||
unsigned[2] biFourierResolutionSubSetParameterN : dump; # NS
|
||||
unsigned[2] biFourierResolutionSubSetParameterM : dump; # MS
|
||||
unsigned[4] totalNumberOfValuesInUnpackedSubset = 0 : dump; # TS
|
||||
|
||||
# This is read_only until we support other values
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# Reference value (R)
|
||||
# The copy_ok means that the value is copied when changing the representation
|
||||
# e.g. from jpeg to simple packing.
|
||||
ieeefloat referenceValue : read_only, copy_ok;
|
||||
ieeefloat referenceValue : read_only, copy_ok;
|
||||
meta referenceValueError reference_value_error(referenceValue,ieee);
|
||||
|
||||
# Binary scale factor (E)
|
||||
|
|
|
@ -9,7 +9,7 @@ unsigned[4] primaryMissingValue ;
|
|||
unsigned[4] secondaryMissingValue ;
|
||||
|
||||
unsigned[4] numberOfGroups ;
|
||||
alias NG = numberOfGroups;
|
||||
alias NG = numberOfGroups;
|
||||
|
||||
unsigned[1] referenceOfWidths ;
|
||||
unsigned[1] widthOfWidths ;
|
||||
|
|
|
@ -7,95 +7,93 @@ constant sphericalHarmonics = 1;
|
|||
constant complexPacking = 1;
|
||||
|
||||
meta codedValues data_g2complex_packing(
|
||||
section7Length,
|
||||
offsetBeforeData,
|
||||
offsetSection7,
|
||||
section7Length,
|
||||
offsetBeforeData,
|
||||
offsetSection7,
|
||||
|
||||
unitsFactor,
|
||||
unitsBias,
|
||||
changingPrecision,
|
||||
numberOfValues,
|
||||
bitsPerValue,
|
||||
referenceValue,
|
||||
binaryScaleFactor,
|
||||
decimalScaleFactor,
|
||||
optimizeScaleFactor,
|
||||
unitsFactor,
|
||||
unitsBias,
|
||||
changingPrecision,
|
||||
numberOfValues,
|
||||
bitsPerValue,
|
||||
referenceValue,
|
||||
binaryScaleFactor,
|
||||
decimalScaleFactor,
|
||||
optimizeScaleFactor,
|
||||
|
||||
GRIBEXShBugPresent,
|
||||
unpackedSubsetPrecision,
|
||||
GRIBEXShBugPresent,
|
||||
unpackedSubsetPrecision,
|
||||
|
||||
laplacianOperatorIsSet,
|
||||
laplacianOperator,
|
||||
laplacianOperatorIsSet,
|
||||
laplacianOperator,
|
||||
|
||||
J,
|
||||
K,
|
||||
M,
|
||||
J,
|
||||
K,
|
||||
M,
|
||||
|
||||
J,
|
||||
J,
|
||||
J,
|
||||
J,
|
||||
J,
|
||||
J,
|
||||
numberOfValues
|
||||
): read_only;
|
||||
|
||||
numberOfValues
|
||||
): read_only;
|
||||
meta data.packedValues data_sh_packed(
|
||||
section7Length,
|
||||
offsetBeforeData,
|
||||
offsetSection7,
|
||||
|
||||
meta data.packedValues data_sh_packed(
|
||||
section7Length,
|
||||
offsetBeforeData,
|
||||
offsetSection7,
|
||||
unitsFactor,
|
||||
unitsBias,
|
||||
changingPrecision,
|
||||
numberOfValues,
|
||||
bitsPerValue,
|
||||
referenceValue,
|
||||
binaryScaleFactor,
|
||||
decimalScaleFactor,
|
||||
optimizeScaleFactor,
|
||||
|
||||
unitsFactor,
|
||||
unitsBias,
|
||||
changingPrecision,
|
||||
numberOfValues,
|
||||
bitsPerValue,
|
||||
referenceValue,
|
||||
binaryScaleFactor,
|
||||
decimalScaleFactor,
|
||||
optimizeScaleFactor,
|
||||
GRIBEXShBugPresent,
|
||||
unpackedSubsetPrecision,
|
||||
|
||||
GRIBEXShBugPresent,
|
||||
unpackedSubsetPrecision,
|
||||
laplacianOperatorIsSet,
|
||||
laplacianOperator,
|
||||
|
||||
laplacianOperatorIsSet,
|
||||
laplacianOperator,
|
||||
J,
|
||||
K,
|
||||
M,
|
||||
|
||||
J,
|
||||
K,
|
||||
M,
|
||||
J,
|
||||
J,
|
||||
J
|
||||
) : read_only;
|
||||
|
||||
J,
|
||||
J,
|
||||
J
|
||||
) : read_only;
|
||||
meta data.unpackedValues data_sh_unpacked(
|
||||
section7Length,
|
||||
offsetBeforeData,
|
||||
offsetSection7,
|
||||
|
||||
meta data.unpackedValues data_sh_unpacked(
|
||||
section7Length,
|
||||
offsetBeforeData,
|
||||
offsetSection7,
|
||||
unitsFactor,
|
||||
unitsBias,
|
||||
changingPrecision,
|
||||
numberOfValues,
|
||||
bitsPerValue,
|
||||
referenceValue,
|
||||
binaryScaleFactor,
|
||||
decimalScaleFactor,
|
||||
optimizeScaleFactor,
|
||||
|
||||
unitsFactor,
|
||||
unitsBias,
|
||||
changingPrecision,
|
||||
numberOfValues,
|
||||
bitsPerValue,
|
||||
referenceValue,
|
||||
binaryScaleFactor,
|
||||
decimalScaleFactor,
|
||||
optimizeScaleFactor,
|
||||
GRIBEXShBugPresent,
|
||||
unpackedSubsetPrecision,
|
||||
|
||||
GRIBEXShBugPresent,
|
||||
unpackedSubsetPrecision,
|
||||
laplacianOperatorIsSet,
|
||||
laplacianOperator,
|
||||
|
||||
laplacianOperatorIsSet,
|
||||
laplacianOperator,
|
||||
|
||||
J,
|
||||
K,
|
||||
M,
|
||||
|
||||
J,
|
||||
K,
|
||||
M
|
||||
J,
|
||||
K,
|
||||
M,
|
||||
J,
|
||||
K,
|
||||
M
|
||||
) : read_only;
|
||||
|
||||
meta packingError simple_packing_error(bitsPerValue,binaryScaleFactor,decimalScaleFactor,referenceValue,ieee) : no_copy;
|
||||
|
|
|
@ -7,105 +7,105 @@ constant sphericalHarmonics = 1;
|
|||
constant complexPacking = 1;
|
||||
|
||||
meta codedValues data_g2complex_packing(
|
||||
section7Length,
|
||||
offsetBeforeData,
|
||||
offsetSection7,
|
||||
section7Length,
|
||||
offsetBeforeData,
|
||||
offsetSection7,
|
||||
|
||||
unitsFactor,
|
||||
unitsBias,
|
||||
changingPrecision,
|
||||
numberOfValues,
|
||||
bitsPerValue,
|
||||
referenceValue,
|
||||
binaryScaleFactor,
|
||||
decimalScaleFactor,
|
||||
optimizeScaleFactor,
|
||||
unitsFactor,
|
||||
unitsBias,
|
||||
changingPrecision,
|
||||
numberOfValues,
|
||||
bitsPerValue,
|
||||
referenceValue,
|
||||
binaryScaleFactor,
|
||||
decimalScaleFactor,
|
||||
optimizeScaleFactor,
|
||||
|
||||
GRIBEXShBugPresent,
|
||||
unpackedSubsetPrecision,
|
||||
GRIBEXShBugPresent,
|
||||
unpackedSubsetPrecision,
|
||||
|
||||
laplacianOperatorIsSet,
|
||||
laplacianOperator,
|
||||
laplacianOperatorIsSet,
|
||||
laplacianOperator,
|
||||
|
||||
subSetJ,
|
||||
subSetK,
|
||||
subSetM,
|
||||
subSetJ,
|
||||
subSetK,
|
||||
subSetM,
|
||||
|
||||
pentagonalResolutionParameterJ,
|
||||
pentagonalResolutionParameterK,
|
||||
pentagonalResolutionParameterM,
|
||||
pentagonalResolutionParameterJ,
|
||||
pentagonalResolutionParameterK,
|
||||
pentagonalResolutionParameterM,
|
||||
|
||||
numberOfValues
|
||||
): read_only;
|
||||
numberOfValues
|
||||
): read_only;
|
||||
|
||||
meta data.packedValues data_sh_packed(
|
||||
section7Length,
|
||||
offsetBeforeData,
|
||||
offsetSection7,
|
||||
meta data.packedValues data_sh_packed(
|
||||
section7Length,
|
||||
offsetBeforeData,
|
||||
offsetSection7,
|
||||
|
||||
unitsFactor,
|
||||
unitsBias,
|
||||
changingPrecision,
|
||||
numberOfValues,
|
||||
bitsPerValue,
|
||||
referenceValue,
|
||||
binaryScaleFactor,
|
||||
decimalScaleFactor,
|
||||
optimizeScaleFactor,
|
||||
unitsFactor,
|
||||
unitsBias,
|
||||
changingPrecision,
|
||||
numberOfValues,
|
||||
bitsPerValue,
|
||||
referenceValue,
|
||||
binaryScaleFactor,
|
||||
decimalScaleFactor,
|
||||
optimizeScaleFactor,
|
||||
|
||||
GRIBEXShBugPresent,
|
||||
unpackedSubsetPrecision,
|
||||
GRIBEXShBugPresent,
|
||||
unpackedSubsetPrecision,
|
||||
|
||||
laplacianOperatorIsSet,
|
||||
laplacianOperator,
|
||||
laplacianOperatorIsSet,
|
||||
laplacianOperator,
|
||||
|
||||
subSetJ,
|
||||
subSetK,
|
||||
subSetM,
|
||||
subSetJ,
|
||||
subSetK,
|
||||
subSetM,
|
||||
|
||||
pentagonalResolutionParameterJ,
|
||||
pentagonalResolutionParameterK,
|
||||
pentagonalResolutionParameterM
|
||||
) : read_only;
|
||||
pentagonalResolutionParameterJ,
|
||||
pentagonalResolutionParameterK,
|
||||
pentagonalResolutionParameterM
|
||||
) : read_only;
|
||||
|
||||
meta data.unpackedValues data_sh_unpacked(
|
||||
section7Length,
|
||||
offsetBeforeData,
|
||||
offsetSection7,
|
||||
meta data.unpackedValues data_sh_unpacked(
|
||||
section7Length,
|
||||
offsetBeforeData,
|
||||
offsetSection7,
|
||||
|
||||
unitsFactor,
|
||||
unitsBias,
|
||||
changingPrecision,
|
||||
numberOfValues,
|
||||
bitsPerValue,
|
||||
referenceValue,
|
||||
binaryScaleFactor,
|
||||
decimalScaleFactor,
|
||||
optimizeScaleFactor,
|
||||
unitsFactor,
|
||||
unitsBias,
|
||||
changingPrecision,
|
||||
numberOfValues,
|
||||
bitsPerValue,
|
||||
referenceValue,
|
||||
binaryScaleFactor,
|
||||
decimalScaleFactor,
|
||||
optimizeScaleFactor,
|
||||
|
||||
GRIBEXShBugPresent,
|
||||
unpackedSubsetPrecision,
|
||||
GRIBEXShBugPresent,
|
||||
unpackedSubsetPrecision,
|
||||
|
||||
laplacianOperatorIsSet,
|
||||
laplacianOperator,
|
||||
laplacianOperatorIsSet,
|
||||
laplacianOperator,
|
||||
|
||||
subSetJ,
|
||||
subSetK,
|
||||
subSetM,
|
||||
subSetJ,
|
||||
subSetK,
|
||||
subSetM,
|
||||
|
||||
pentagonalResolutionParameterJ,
|
||||
pentagonalResolutionParameterK,
|
||||
pentagonalResolutionParameterM
|
||||
) : read_only;
|
||||
pentagonalResolutionParameterJ,
|
||||
pentagonalResolutionParameterK,
|
||||
pentagonalResolutionParameterM
|
||||
) : read_only;
|
||||
|
||||
meta packingError simple_packing_error(bitsPerValue,binaryScaleFactor,decimalScaleFactor,referenceValue,ieee) : no_copy;
|
||||
meta unpackedError simple_packing_error(zero,binaryScaleFactor,decimalScaleFactor,referenceValue,ieee) : no_copy;
|
||||
|
||||
meta values data_apply_bitmap(codedValues,
|
||||
bitmap,
|
||||
missingValue,
|
||||
binaryScaleFactor,
|
||||
numberOfDataPoints,
|
||||
numberOfValues) : dump;
|
||||
bitmap,
|
||||
missingValue,
|
||||
binaryScaleFactor,
|
||||
numberOfDataPoints,
|
||||
numberOfValues) : dump;
|
||||
|
||||
template statistics "common/statistics_spectral.def";
|
||||
|
|
|
@ -8,21 +8,21 @@
|
|||
# Octets 6-nn : Binary data values - binary string, with each (scaled)
|
||||
|
||||
meta codedValues data_g2simple_packing_with_preprocessing(
|
||||
section7Length,
|
||||
offsetBeforeData,
|
||||
offsetSection7,
|
||||
unitsFactor,
|
||||
unitsBias,
|
||||
changingPrecision,
|
||||
numberOfValues,
|
||||
bitsPerValue,
|
||||
referenceValue,
|
||||
binaryScaleFactor,
|
||||
decimalScaleFactor,
|
||||
optimizeScaleFactor,
|
||||
typeOfPreProcessing,
|
||||
preProcessingParameter
|
||||
): read_only;
|
||||
section7Length,
|
||||
offsetBeforeData,
|
||||
offsetSection7,
|
||||
unitsFactor,
|
||||
unitsBias,
|
||||
changingPrecision,
|
||||
numberOfValues,
|
||||
bitsPerValue,
|
||||
referenceValue,
|
||||
binaryScaleFactor,
|
||||
decimalScaleFactor,
|
||||
optimizeScaleFactor,
|
||||
typeOfPreProcessing,
|
||||
preProcessingParameter
|
||||
): read_only;
|
||||
|
||||
meta values data_apply_bitmap(codedValues,
|
||||
bitmap,
|
||||
|
|
|
@ -41,7 +41,6 @@ meta codedValues data_g2second_order_packing(
|
|||
widthOfSPD,
|
||||
orderOfSPD,
|
||||
numberOfPoints
|
||||
|
||||
): read_only;
|
||||
|
||||
meta values data_apply_bitmap(codedValues,
|
||||
|
|
|
@ -71,6 +71,7 @@
|
|||
1097 smma Seasonal monthly means anomalies
|
||||
1098 clte Climate run output
|
||||
1099 clmn Climate run monthly means output
|
||||
1100 dame Daily means
|
||||
1110 seap Sensitive area prediction
|
||||
1120 eefh Extended ensemble forecast hindcast
|
||||
1121 eehs Extended ensemble forecast hindcast statistics
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -2579,9 +2579,10 @@ static int create_keys(const grib_accessor* a, long onlySubset, long startSubset
|
|||
groupNumber++;
|
||||
incrementBitmapIndex = 0;
|
||||
if (bitmapIndex >= MAX_NUMBER_OF_BITMAPS) {
|
||||
grib_context_log(c, GRIB_LOG_ERROR, "Bitmap error: bitmap index=%d, max num bitmaps=%d\n", bitmapIndex, MAX_NUMBER_OF_BITMAPS);
|
||||
err = GRIB_DECODING_ERROR;
|
||||
return err;
|
||||
//grib_context_log(c, GRIB_LOG_ERROR, "Bitmap error: bitmap index=%d, max num bitmaps=%d\n", bitmapIndex, MAX_NUMBER_OF_BITMAPS);
|
||||
//err = GRIB_DECODING_ERROR;
|
||||
//return err;
|
||||
bitmapIndex--;
|
||||
}
|
||||
bitmapStart[bitmapIndex] = grib_accessors_list_last(self->dataAccessors);
|
||||
bitmapSize[bitmapIndex] = 1;
|
||||
|
|
|
@ -207,7 +207,7 @@ static grib_trie* load_bufr_elements_table(grib_accessor* a, int* err)
|
|||
}
|
||||
|
||||
if (!filename) {
|
||||
grib_context_log(c, GRIB_LOG_ERROR, "unable to find definition file %s", self->dictionary);
|
||||
grib_context_log(c, GRIB_LOG_ERROR, "Unable to find definition file %s", self->dictionary);
|
||||
if (strlen(masterRecomposed) > 0) grib_context_log(c, GRIB_LOG_DEBUG,"master path=%s", masterRecomposed);
|
||||
if (strlen(localRecomposed) > 0) grib_context_log(c, GRIB_LOG_DEBUG, "local path=%s", localRecomposed);
|
||||
*err = GRIB_FILE_NOT_FOUND;
|
||||
|
|
|
@ -217,7 +217,7 @@ static int value_count(grib_accessor* a, long* numberOfPoints)
|
|||
*numberOfPoints = 0;
|
||||
|
||||
if ((err = grib_get_long_internal(grib_handle_of_accessor(a), self->numberOfPoints, numberOfPoints)) != GRIB_SUCCESS) {
|
||||
grib_context_log(a->context, GRIB_LOG_ERROR, "unable to get count of %s (%s)", a->name, grib_get_error_message(err));
|
||||
grib_context_log(a->context, GRIB_LOG_ERROR, "Unable to get count of %s (%s)", a->name, grib_get_error_message(err));
|
||||
}
|
||||
|
||||
return err;
|
||||
|
|
|
@ -256,7 +256,7 @@ static int pack_double(grib_accessor* a, const double* cval, size_t* len)
|
|||
return GRIB_SUCCESS;
|
||||
break;
|
||||
case GRIB_INVALID_BPV:
|
||||
grib_context_log(a->context, GRIB_LOG_ERROR, "unable to compute packing parameters. Invalid bits per value");
|
||||
grib_context_log(a->context, GRIB_LOG_ERROR, "Unable to compute packing parameters. Invalid bits per value");
|
||||
return ret;
|
||||
case GRIB_SUCCESS:
|
||||
break;
|
||||
|
|
|
@ -640,7 +640,7 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len)
|
|||
if (max == min) {
|
||||
int large_constant_fields = 0;
|
||||
if (grib_get_nearest_smaller_value(gh, self->reference_value, val[0], &reference_value) != GRIB_SUCCESS) {
|
||||
grib_context_log(a->context, GRIB_LOG_ERROR, "unable to find nearest_smaller_value of %g for %s", min, self->reference_value);
|
||||
grib_context_log(a->context, GRIB_LOG_ERROR, "Unable to find nearest_smaller_value of %g for %s", min, self->reference_value);
|
||||
return GRIB_INTERNAL_ERROR;
|
||||
}
|
||||
if ((err = grib_set_double_internal(gh, self->reference_value, reference_value)) != GRIB_SUCCESS)
|
||||
|
@ -722,7 +722,7 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len)
|
|||
return err;
|
||||
if (grib_get_nearest_smaller_value(gh, self->reference_value, min, &reference_value) != GRIB_SUCCESS) {
|
||||
grib_context_log(a->context, GRIB_LOG_ERROR,
|
||||
"unable to find nearest_smaller_value of %g for %s", min, self->reference_value);
|
||||
"Unable to find nearest_smaller_value of %g for %s", min, self->reference_value);
|
||||
return GRIB_INTERNAL_ERROR;
|
||||
}
|
||||
/* divisor=1; */
|
||||
|
@ -737,7 +737,7 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len)
|
|||
/* divisor=1; */
|
||||
if (grib_get_nearest_smaller_value(gh, self->reference_value, min, &reference_value) != GRIB_SUCCESS) {
|
||||
grib_context_log(a->context, GRIB_LOG_ERROR,
|
||||
"unable to find nearest_smaller_value of %g for %s", min, self->reference_value);
|
||||
"Unable to find nearest_smaller_value of %g for %s", min, self->reference_value);
|
||||
return GRIB_INTERNAL_ERROR;
|
||||
}
|
||||
}
|
||||
|
@ -776,7 +776,7 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len)
|
|||
|
||||
if (grib_get_nearest_smaller_value(gh, self->reference_value,
|
||||
min, &reference_value) != GRIB_SUCCESS) {
|
||||
grib_context_log(a->context, GRIB_LOG_ERROR, "unable to find nearest_smaller_value of %g for %s", min, self->reference_value);
|
||||
grib_context_log(a->context, GRIB_LOG_ERROR, "Unable to find nearest_smaller_value of %g for %s", min, self->reference_value);
|
||||
return GRIB_INTERNAL_ERROR;
|
||||
}
|
||||
|
||||
|
|
|
@ -179,7 +179,7 @@ static grib_trie* load_dictionary(grib_accessor* a, int* err)
|
|||
}
|
||||
|
||||
if (!filename) {
|
||||
grib_context_log(c, GRIB_LOG_ERROR, "unable to find def file %s", self->dictionary);
|
||||
grib_context_log(c, GRIB_LOG_ERROR, "Unable to find def file %s", self->dictionary);
|
||||
*err = GRIB_FILE_NOT_FOUND;
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -114,14 +114,26 @@ static void init(grib_accessor* a, const long l, grib_arguments* c)
|
|||
self->element = grib_arguments_get_long(hand, c, n++);
|
||||
}
|
||||
|
||||
static int check_element_index(const char* func, const char* array_name, long index, size_t size)
|
||||
{
|
||||
const grib_context* c = grib_context_get_default();
|
||||
if (index < 0 || index >= size) {
|
||||
grib_context_log(c, GRIB_LOG_ERROR, "%s: Invalid element index %ld for array '%s'. Value must be between 0 and %zu",
|
||||
func, index, array_name, size - 1);
|
||||
return GRIB_INVALID_ARGUMENT;
|
||||
}
|
||||
return GRIB_SUCCESS;
|
||||
}
|
||||
|
||||
static int unpack_long(grib_accessor* a, long* val, size_t* len)
|
||||
{
|
||||
grib_accessor_element* self = (grib_accessor_element*)a;
|
||||
int ret = 0;
|
||||
size_t size = 0;
|
||||
long* ar = NULL;
|
||||
grib_context* c = a->context;
|
||||
const grib_context* c = a->context;
|
||||
grib_handle* hand = grib_handle_of_accessor(a);
|
||||
long index = self->element;
|
||||
|
||||
if (*len < 1) {
|
||||
ret = GRIB_ARRAY_TOO_SMALL;
|
||||
|
@ -140,14 +152,16 @@ static int unpack_long(grib_accessor* a, long* val, size_t* len)
|
|||
if ((ret = grib_get_long_array_internal(hand, self->array, ar, &size)) != GRIB_SUCCESS)
|
||||
return ret;
|
||||
|
||||
if (self->element < 0 || self->element >= size) {
|
||||
grib_context_log(c, GRIB_LOG_ERROR, "Invalid element %ld for array '%s'. Value must be between 0 and %zu",
|
||||
self->element, self->array, size - 1);
|
||||
ret = GRIB_INVALID_ARGUMENT;
|
||||
// An index of -x means the xth item from the end of the list, so ar[-1] means the last item in ar
|
||||
if (index < 0) {
|
||||
index = size + index;
|
||||
}
|
||||
|
||||
if ((ret = check_element_index(__func__, self->array, index, size)) != GRIB_SUCCESS) {
|
||||
goto the_end;
|
||||
}
|
||||
|
||||
*val = ar[self->element];
|
||||
*val = ar[index];
|
||||
|
||||
the_end:
|
||||
grib_context_free(c, ar);
|
||||
|
@ -160,8 +174,9 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len)
|
|||
int ret = 0;
|
||||
size_t size = 0;
|
||||
long* ar = NULL;
|
||||
grib_context* c = a->context;
|
||||
const grib_context* c = a->context;
|
||||
grib_handle* hand = grib_handle_of_accessor(a);
|
||||
long index = self->element;
|
||||
|
||||
if (*len < 1) {
|
||||
ret = GRIB_ARRAY_TOO_SMALL;
|
||||
|
@ -180,11 +195,23 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len)
|
|||
if ((ret = grib_get_long_array_internal(hand, self->array, ar, &size)) != GRIB_SUCCESS)
|
||||
return ret;
|
||||
|
||||
ar[self->element] = *val;
|
||||
// An index of -x means the xth item from the end of the list, so ar[-1] means the last item in ar
|
||||
if (index < 0) {
|
||||
index = size + index;
|
||||
}
|
||||
|
||||
if ((ret = check_element_index(__func__, self->array, index, size)) != GRIB_SUCCESS) {
|
||||
goto the_end;
|
||||
}
|
||||
|
||||
Assert(index >= 0);
|
||||
Assert(index < size);
|
||||
ar[index] = *val;
|
||||
|
||||
if ((ret = grib_set_long_array_internal(hand, self->array, ar, size)) != GRIB_SUCCESS)
|
||||
return ret;
|
||||
goto the_end;
|
||||
|
||||
the_end:
|
||||
grib_context_free(c, ar);
|
||||
return ret;
|
||||
}
|
||||
|
@ -195,8 +222,9 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len)
|
|||
int ret = 0;
|
||||
size_t size = 0;
|
||||
double* ar = NULL;
|
||||
grib_context* c = a->context;
|
||||
grib_handle* hand = grib_handle_of_accessor(a);
|
||||
const grib_context* c = a->context;
|
||||
const grib_handle* hand = grib_handle_of_accessor(a);
|
||||
long index = self->element;
|
||||
|
||||
if (*len < 1) {
|
||||
ret = GRIB_ARRAY_TOO_SMALL;
|
||||
|
@ -215,14 +243,16 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len)
|
|||
if ((ret = grib_get_double_array_internal(hand, self->array, ar, &size)) != GRIB_SUCCESS)
|
||||
return ret;
|
||||
|
||||
if (self->element < 0 || self->element >= size) {
|
||||
grib_context_log(c, GRIB_LOG_ERROR, "Invalid element %ld for array '%s'. Value must be between 0 and %zu",
|
||||
self->element, self->array, size - 1);
|
||||
ret = GRIB_INVALID_ARGUMENT;
|
||||
// An index of -x means the xth item from the end of the list, so ar[-1] means the last item in ar
|
||||
if (index < 0) {
|
||||
index = size + index;
|
||||
}
|
||||
|
||||
if ((ret = check_element_index(__func__, self->array, index, size)) != GRIB_SUCCESS) {
|
||||
goto the_end;
|
||||
}
|
||||
|
||||
*val = ar[self->element];
|
||||
*val = ar[index];
|
||||
|
||||
the_end:
|
||||
grib_context_free(c, ar);
|
||||
|
|
|
@ -424,7 +424,7 @@ static int pack_expression(grib_accessor* a, grib_expression* e)
|
|||
len = 1;
|
||||
ret = grib_expression_evaluate_double(hand, e, &dval);
|
||||
if (ret != GRIB_SUCCESS) {
|
||||
grib_context_log(a->context, GRIB_LOG_ERROR, "unable to set %s as double (from %s)",
|
||||
grib_context_log(a->context, GRIB_LOG_ERROR, "Unable to set %s as double (from %s)",
|
||||
a->name, e->cclass->name);
|
||||
return ret;
|
||||
}
|
||||
|
@ -438,7 +438,7 @@ static int pack_expression(grib_accessor* a, grib_expression* e)
|
|||
len = sizeof(tmp);
|
||||
cval = grib_expression_evaluate_string(hand, e, tmp, &len, &ret);
|
||||
if (ret != GRIB_SUCCESS) {
|
||||
grib_context_log(a->context, GRIB_LOG_ERROR, "unable to set %s as string (from %s)",
|
||||
grib_context_log(a->context, GRIB_LOG_ERROR, "Unable to set %s as string (from %s)",
|
||||
a->name, e->cclass->name);
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -433,7 +433,7 @@ static int pack_expression(grib_accessor* a, grib_expression* e)
|
|||
len = 1;
|
||||
ret = grib_expression_evaluate_long(hand, e, &lval);
|
||||
if (ret != GRIB_SUCCESS) {
|
||||
grib_context_log(a->context, GRIB_LOG_ERROR, "unable to set %s as long", a->name);
|
||||
grib_context_log(a->context, GRIB_LOG_ERROR, "Unable to set %s as long", a->name);
|
||||
return ret;
|
||||
}
|
||||
/*if (hand->context->debug)
|
||||
|
@ -454,7 +454,7 @@ static int pack_expression(grib_accessor* a, grib_expression* e)
|
|||
len = sizeof(tmp);
|
||||
cval = grib_expression_evaluate_string(hand, e, tmp, &len, &ret);
|
||||
if (ret != GRIB_SUCCESS) {
|
||||
grib_context_log(a->context, GRIB_LOG_ERROR, "unable to set %s as string", a->name);
|
||||
grib_context_log(a->context, GRIB_LOG_ERROR, "Unable to set %s as string", a->name);
|
||||
return ret;
|
||||
}
|
||||
len = strlen(cval);
|
||||
|
|
|
@ -124,7 +124,7 @@ static void init(grib_accessor* a, const long len, grib_arguments* arg)
|
|||
e = grib_arguments_get_expression(hand, arg, n++);
|
||||
err = grib_expression_evaluate_long(hand, e, &(self->relativeOffset));
|
||||
if (err)
|
||||
grib_context_log(hand->context, GRIB_LOG_ERROR, "unable to evaluate relativeOffset");
|
||||
grib_context_log(hand->context, GRIB_LOG_ERROR, "Unable to evaluate relativeOffset");
|
||||
|
||||
grib_get_long(hand, self->sectionLength, §ionLength);
|
||||
|
||||
|
|
|
@ -160,7 +160,7 @@ static void init(grib_accessor* a, const long length, grib_arguments* args)
|
|||
len = sizeof(tmp);
|
||||
p = grib_expression_evaluate_string(hand, expression, tmp, &len, &ret);
|
||||
if (ret != GRIB_SUCCESS) {
|
||||
grib_context_log(a->context, GRIB_LOG_ERROR, "unable to evaluate %s as string: %s",
|
||||
grib_context_log(a->context, GRIB_LOG_ERROR, "Unable to evaluate %s as string: %s",
|
||||
a->name, grib_get_error_message(ret));
|
||||
return;
|
||||
}
|
||||
|
|
14783
src/grib_hash_keys.cc
14783
src/grib_hash_keys.cc
File diff suppressed because it is too large
Load Diff
|
@ -30,7 +30,7 @@ set -e
|
|||
[ $status -ne 0 ]
|
||||
|
||||
#cat $tempErr
|
||||
grep -q "unable to set values as double" $tempErr
|
||||
grep -q "Unable to set values as double" $tempErr
|
||||
|
||||
|
||||
# Clean up
|
||||
|
|
|
@ -30,7 +30,7 @@ cat > $tempFilt <<EOF
|
|||
set iDirectionIncrement = 10000;
|
||||
set jDirectionIncrement = 10000;
|
||||
|
||||
meta lastVal element(values, numberOfValues - 1);
|
||||
meta lastVal element(values, -1); # Like Python
|
||||
set lastVal = 42;
|
||||
|
||||
write;
|
||||
|
|
|
@ -22,16 +22,28 @@ cat > $tempFilt <<EOF
|
|||
meta elemA element(pl, Nj - 3);
|
||||
meta elemB element(pl, Nj - 2);
|
||||
meta elemC element(pl, Nj - 1);
|
||||
print "elemA=[elemA], elemB=[elemB], elemC=[elemC]";
|
||||
meta elemZ element(pl, -1); # another way of getting the last element
|
||||
print "elemA=[elemA], elemB=[elemB], elemC=[elemC], elemZ=[elemZ]";
|
||||
EOF
|
||||
${tools_dir}/grib_filter $tempFilt $input > $tempText
|
||||
echo "elemA=36, elemB=25, elemC=20" > $tempRef
|
||||
echo "elemA=36, elemB=25, elemC=20, elemZ=20" > $tempRef
|
||||
diff $tempRef $tempText
|
||||
|
||||
|
||||
# Invalid element
|
||||
# Invalid element indexes
|
||||
cat > $tempFilt <<EOF
|
||||
meta badElem element(pl, -1);
|
||||
meta badElem element(pl, -97);
|
||||
print "[badElem]";
|
||||
EOF
|
||||
set +e
|
||||
${tools_dir}/grib_filter $tempFilt $input > $tempText 2>&1
|
||||
status=$?
|
||||
set -e
|
||||
[ $status -ne 0 ]
|
||||
grep -q "Invalid element.*Value must be between 0 and 95" $tempText
|
||||
|
||||
cat > $tempFilt <<EOF
|
||||
meta badElem element(pl, 197);
|
||||
print "[badElem]";
|
||||
EOF
|
||||
set +e
|
||||
|
@ -42,4 +54,24 @@ set -e
|
|||
grep -q "Invalid element.*Value must be between 0 and 95" $tempText
|
||||
|
||||
|
||||
# Access a double array
|
||||
input=$ECCODES_SAMPLES_PATH/sh_ml_grib2.tmpl
|
||||
cat > $tempFilt <<EOF
|
||||
meta elemZ element(values, -1);
|
||||
print "Last value as a double = [elemZ:d]";
|
||||
EOF
|
||||
${tools_dir}/grib_filter $tempFilt $input
|
||||
|
||||
cat > $tempFilt <<EOF
|
||||
meta badElem element(values, 100000);
|
||||
print "[badElem:d]";
|
||||
EOF
|
||||
set +e
|
||||
${tools_dir}/grib_filter $tempFilt $input
|
||||
status=$?
|
||||
set -e
|
||||
[ $status -ne 0 ]
|
||||
|
||||
|
||||
# Clean up
|
||||
rm -f $tempRef $tempText $tempFilt
|
||||
|
|
4757
tests/keys
4757
tests/keys
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue