eccodes/tests/grib_neg_fctime.sh

67 lines
2.0 KiB
Bash
Raw Normal View History

2015-04-30 09:14:58 +00:00
#!/bin/sh
2019-04-15 13:44:45 +00:00
# Copyright 2005-2019 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.
#
. ./include.sh
REDIRECT=/dev/null
temp=neg_fctime.temp.grib
input=${data_dir}/sample.grib2
############################
# Check various grib2 PDTs
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
done
############################
2015-04-30 09:14:58 +00:00
# check input time and date
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