Merge branch 'develop' into feature/ECC-1620_sub-hourly

This commit is contained in:
Eugen Betke 2023-11-28 12:18:55 +00:00
commit c515507a26
27 changed files with 229 additions and 228 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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 ;

View File

@ -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 ;

View File

@ -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; }

View File

@ -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;

View File

@ -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 ;

View File

@ -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;

View File

@ -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;

View File

@ -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

View File

@ -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)

View File

@ -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 ;

View File

@ -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;

View File

@ -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";

View File

@ -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,

View File

@ -41,7 +41,6 @@ meta codedValues data_g2second_order_packing(
widthOfSPD,
orderOfSPD,
numberOfPoints
): read_only;
meta values data_apply_bitmap(codedValues,

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;
}

View File

@ -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;
}

View File

@ -133,6 +133,7 @@ static int unpack_long(grib_accessor* a, long* val, size_t* len)
long* ar = NULL;
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;
@ -152,15 +153,15 @@ static int unpack_long(grib_accessor* a, long* val, size_t* len)
return ret;
// An index of -x means the xth item from the end of the list, so ar[-1] means the last item in ar
if (self->element < 0) {
self->element = size + self->element;
if (index < 0) {
index = size + index;
}
if ((ret = check_element_index(__func__, self->array, self->element, size)) != GRIB_SUCCESS) {
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);
@ -175,6 +176,7 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len)
long* ar = NULL;
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;
@ -194,17 +196,17 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len)
return ret;
// An index of -x means the xth item from the end of the list, so ar[-1] means the last item in ar
if (self->element < 0) {
self->element = size + self->element;
if (index < 0) {
index = size + index;
}
if ((ret = check_element_index(__func__, self->array, self->element, size)) != GRIB_SUCCESS) {
if ((ret = check_element_index(__func__, self->array, index, size)) != GRIB_SUCCESS) {
goto the_end;
}
Assert(self->element >= 0);
Assert(self->element < size);
ar[self->element] = *val;
Assert(index >= 0);
Assert(index < size);
ar[index] = *val;
if ((ret = grib_set_long_array_internal(hand, self->array, ar, size)) != GRIB_SUCCESS)
goto the_end;
@ -222,6 +224,7 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len)
double* ar = NULL;
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;
@ -241,15 +244,15 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len)
return ret;
// An index of -x means the xth item from the end of the list, so ar[-1] means the last item in ar
if (self->element < 0) {
self->element = size + self->element;
if (index < 0) {
index = size + index;
}
if ((ret = check_element_index(__func__, self->array, self->element, size)) != GRIB_SUCCESS) {
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);

View File

@ -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;
}

View File

@ -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);

View File

@ -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, &sectionLength);

View File

@ -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;
}

View File

@ -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