mirror of https://github.com/ecmwf/eccodes.git
ECC-1150: Deal with encoding a MISSING value
This commit is contained in:
parent
4766ba34cb
commit
238bad66ca
|
@ -200,6 +200,14 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len)
|
|||
return GRIB_SUCCESS;
|
||||
}
|
||||
|
||||
if (exact == GRIB_MISSING_DOUBLE) {
|
||||
if ((ret = grib_set_missing(hand, self->scaleFactor)) != GRIB_SUCCESS)
|
||||
return ret;
|
||||
if ((ret = grib_set_missing(hand, self->scaledValue)) != GRIB_SUCCESS)
|
||||
return ret;
|
||||
return GRIB_SUCCESS;
|
||||
}
|
||||
|
||||
accessor_factor = grib_find_accessor(hand, self->scaleFactor);
|
||||
accessor_value = grib_find_accessor(hand, self->scaledValue);
|
||||
if (!accessor_factor || !accessor_value) {
|
||||
|
|
|
@ -20,8 +20,8 @@ tempFilt=temp.${label}.filt
|
|||
|
||||
in=$ECCODES_SAMPLES_PATH/GRIB2.tmpl
|
||||
|
||||
# Lower limit
|
||||
# -------------
|
||||
# Decoding: Lower limit
|
||||
# ----------------------
|
||||
${tools_dir}/grib_set -s \
|
||||
productDefinitionTemplateNumber=5,scaleFactorOfLowerLimit=missing,scaledValueOfLowerLimit=missing \
|
||||
$in $tempGrib
|
||||
|
@ -39,8 +39,8 @@ EOF
|
|||
${tools_dir}/grib_filter $tempFilt $tempGrib
|
||||
|
||||
|
||||
# Try upper limit too
|
||||
# --------------------
|
||||
# Decoding: upper limit
|
||||
# -----------------------
|
||||
${tools_dir}/grib_set -s \
|
||||
productDefinitionTemplateNumber=5,scaleFactorOfUpperLimit=missing,scaledValueOfUpperLimit=missing \
|
||||
$in $tempGrib
|
||||
|
@ -57,6 +57,15 @@ cat > $tempFilt <<EOF
|
|||
EOF
|
||||
${tools_dir}/grib_filter $tempFilt $tempGrib
|
||||
|
||||
# Encoding
|
||||
# ----------
|
||||
temp2=temp2.${label}.grib
|
||||
${tools_dir}/grib_set -s upperLimit=missing,lowerLimit=missing $tempGrib $temp2
|
||||
grib_check_key_equals $temp2 lowerLimit,upperLimit 'MISSING MISSING'
|
||||
grib_check_key_equals $temp2 \
|
||||
scaleFactorOfLowerLimit,scaledValueOfLowerLimit,scaleFactorOfUpperLimit,scaledValueOfUpperLimit \
|
||||
'MISSING MISSING MISSING MISSING'
|
||||
rm -f $temp2
|
||||
|
||||
# Clean up
|
||||
rm -f $tempGrib $tempFilt
|
||||
|
|
Loading…
Reference in New Issue