mirror of https://github.com/ecmwf/eccodes.git
ECC-1866: GRIB: Setting step on interval-based message with dataDate=0
This commit is contained in:
parent
dceb761abb
commit
5a5eac1b36
|
@ -491,6 +491,13 @@ static int pack_long_(grib_accessor* a, const long end_step_value, const long en
|
|||
return GRIB_WRONG_STEP;
|
||||
}
|
||||
|
||||
if (!is_date_valid(year, month, day, hour, minute, second)) { // ECC-1866
|
||||
grib_context_log(h->context, GRIB_LOG_ERROR, "%s:%s: Date/Time is not valid! "
|
||||
"year=%ld month=%ld day=%ld hour=%ld minute=%ld second=%ld",
|
||||
a->cclass->name, __func__, year, month, day, hour, minute, second);
|
||||
return GRIB_DECODING_ERROR;
|
||||
}
|
||||
|
||||
err = grib_datetime_to_julian(year, month, day, hour, minute, second, &dend);
|
||||
if (err != GRIB_SUCCESS)
|
||||
return err;
|
||||
|
|
|
@ -256,9 +256,28 @@ cat >$tempFilt <<EOF
|
|||
print "[typeOfStatisticalProcessing]";
|
||||
EOF
|
||||
${tools_dir}/grib_filter $tempFilt $ECCODES_SAMPLES_PATH/GRIB2.tmpl > $tempLog
|
||||
cat $tempLog
|
||||
grep -q "255 8 7" $tempLog
|
||||
|
||||
# ECC-1866: Setting step on interval-based message with dataDate=0000
|
||||
# -------------------------------------------------------------------
|
||||
tempGrbA=${data_dir}/temp.$label.A.grib
|
||||
tempGrbB=${data_dir}/temp.$label.B.grib
|
||||
${tools_dir}/grib_set -s stepType=accum $ECCODES_SAMPLES_PATH/GRIB2.tmpl $tempGrbA
|
||||
set +e
|
||||
${tools_dir}/grib_set -s year=0,month=0,day=0,step=0 $tempGrbA $tempGrbB 2>$tempLog
|
||||
status=$?
|
||||
set -e
|
||||
[ $status -ne 0 ]
|
||||
grep -q "Date/Time is not valid" $tempLog
|
||||
|
||||
set +e
|
||||
${tools_dir}/grib_set -s year=0,month=0,day=0,stepUnits=1 $tempGrbA $tempGrbB 2>$tempLog
|
||||
status=$?
|
||||
set -e
|
||||
[ $status -ne 0 ]
|
||||
grep -q "Date/Time is not valid" $tempLog
|
||||
rm -f $tempGrbA $tempGrbB
|
||||
|
||||
# Clean up
|
||||
rm -f $temp $tempLog $tempFilt
|
||||
rm -f $grib2File.p8tmp ${grib2File}.tmp x.grib
|
||||
|
|
Loading…
Reference in New Issue