2015-04-30 09:14:58 +00:00
|
|
|
#!/bin/sh
|
2020-01-28 14:32:34 +00:00
|
|
|
# (C) Copyright 2005- ECMWF.
|
2015-04-30 09:14:58 +00:00
|
|
|
#
|
|
|
|
# This software is licensed under the terms of the Apache Licence Version 2.0
|
|
|
|
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
|
|
|
|
#
|
|
|
|
# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
|
|
|
|
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
|
|
|
|
#
|
|
|
|
|
2022-04-03 22:02:48 +00:00
|
|
|
. ./include.ctest.sh
|
2015-04-30 09:14:58 +00:00
|
|
|
|
2023-03-18 15:52:13 +00:00
|
|
|
label="grib_neg_fctime_test"
|
|
|
|
temp=temp.$label.grib
|
2015-04-30 09:14:58 +00:00
|
|
|
input=${data_dir}/sample.grib2
|
|
|
|
|
2015-08-26 10:40:06 +00:00
|
|
|
# Check various grib2 PDTs
|
2023-03-18 15:52:13 +00:00
|
|
|
# --------------------------
|
2015-08-26 10:40:06 +00:00
|
|
|
sample2=$ECCODES_SAMPLES_PATH/GRIB2.tmpl
|
|
|
|
PDTs="0 1 2 3 8 9 10 11 12 13 14 45 46 47 48 53"
|
|
|
|
for p in $PDTs; do
|
2017-02-03 14:21:24 +00:00
|
|
|
${tools_dir}/grib_set -s productDefinitionTemplateNumber=$p,forecastTime=-2 $sample2 $temp
|
2015-08-26 10:40:06 +00:00
|
|
|
done
|
|
|
|
|
|
|
|
|
2015-04-30 09:14:58 +00:00
|
|
|
# check input time and date
|
2023-03-18 15:52:13 +00:00
|
|
|
# --------------------------
|
2016-01-21 16:52:24 +00:00
|
|
|
grib_check_key_equals $input 'dataDate,dataTime' '20080206 1200'
|
2015-04-30 09:14:58 +00:00
|
|
|
|
|
|
|
# Negative step in same day
|
|
|
|
# --------------------------
|
2017-02-03 14:21:24 +00:00
|
|
|
${tools_dir}/grib_set -s forecastTime=-2 $input $temp
|
2016-01-21 16:52:24 +00:00
|
|
|
grib_check_key_equals $temp 'validityDate,validityTime' '20080206 1000'
|
2015-04-30 09:14:58 +00:00
|
|
|
|
2017-02-03 14:21:24 +00:00
|
|
|
${tools_dir}/grib_set -s forecastTime=-11 $input $temp
|
2016-01-21 16:52:24 +00:00
|
|
|
grib_check_key_equals $temp 'validityDate,validityTime' '20080206 100'
|
2015-04-30 09:14:58 +00:00
|
|
|
|
2017-02-03 14:21:24 +00:00
|
|
|
${tools_dir}/grib_set -s forecastTime=-12 $input $temp
|
2016-01-21 16:52:24 +00:00
|
|
|
grib_check_key_equals $temp 'validityDate,validityTime' '20080206 0'
|
2015-04-30 09:14:58 +00:00
|
|
|
|
|
|
|
|
|
|
|
# Negative step previous day
|
|
|
|
# --------------------------
|
2017-02-03 14:21:24 +00:00
|
|
|
${tools_dir}/grib_set -s forecastTime=-13 $input $temp
|
2016-01-21 16:52:24 +00:00
|
|
|
grib_check_key_equals $temp 'validityDate,validityTime' '20080205 2300'
|
2015-04-30 09:14:58 +00:00
|
|
|
|
2017-02-03 14:21:24 +00:00
|
|
|
${tools_dir}/grib_set -s forecastTime=-24 $input $temp
|
2016-01-21 16:52:24 +00:00
|
|
|
grib_check_key_equals $temp 'validityDate,validityTime' '20080205 1200'
|
2015-04-30 09:14:58 +00:00
|
|
|
|
2017-02-03 14:21:24 +00:00
|
|
|
${tools_dir}/grib_set -s forecastTime=-33 $input $temp
|
2016-01-21 16:52:24 +00:00
|
|
|
grib_check_key_equals $temp 'validityDate,validityTime' '20080205 300'
|
2015-04-30 09:14:58 +00:00
|
|
|
|
|
|
|
# Negative step further back
|
|
|
|
# --------------------------
|
2017-02-03 14:21:24 +00:00
|
|
|
${tools_dir}/grib_set -s forecastTime=-38 $input $temp
|
2016-01-21 16:52:24 +00:00
|
|
|
grib_check_key_equals $temp 'validityDate,validityTime' '20080204 2200'
|
2015-04-30 09:14:58 +00:00
|
|
|
|
2017-02-03 14:21:24 +00:00
|
|
|
${tools_dir}/grib_set -s forecastTime=-185 $input $temp
|
2016-01-21 16:52:24 +00:00
|
|
|
grib_check_key_equals $temp 'validityDate,validityTime' '20080129 1900'
|
2015-04-30 09:14:58 +00:00
|
|
|
|
|
|
|
|
|
|
|
# Clean up
|
|
|
|
rm -f $temp
|