File: neg_fctime.sh

package info (click to toggle)
grib-api 1.19.0-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 217,848 kB
  • ctags: 16,929
  • sloc: ansic: 111,244; sh: 14,785; makefile: 5,307; f90: 3,583; perl: 3,160; python: 2,830; yacc: 712; fortran: 468; lex: 330; cpp: 305; awk: 66
file content (66 lines) | stat: -rwxr-xr-x 2,081 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/sh
# Copyright 2005-2016 ECMWF.
#
# 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=$GRIB_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
  ${tools_dir}grib_set -s productDefinitionTemplateNumber=$p,forecastTime=-2 $sample2 $temp
done


############################

# check input time and date
grib_check_key_equals $input 'dataDate,dataTime' '20080206 1200'

# Negative step in same day
# --------------------------
${tools_dir}grib_set -s forecastTime=-2 $input $temp
grib_check_key_equals $temp 'validityDate,validityTime' '20080206 1000'

${tools_dir}grib_set -s forecastTime=-11 $input $temp
grib_check_key_equals $temp 'validityDate,validityTime' '20080206 100'

${tools_dir}grib_set -s forecastTime=-12 $input $temp
grib_check_key_equals $temp 'validityDate,validityTime' '20080206 0'


# Negative step previous day
# --------------------------
${tools_dir}grib_set -s forecastTime=-13 $input $temp
grib_check_key_equals $temp 'validityDate,validityTime' '20080205 2300'

${tools_dir}grib_set -s forecastTime=-24 $input $temp
grib_check_key_equals $temp 'validityDate,validityTime' '20080205 1200'

${tools_dir}grib_set -s forecastTime=-33 $input $temp
grib_check_key_equals $temp 'validityDate,validityTime' '20080205 300'

# Negative step further back
# --------------------------
${tools_dir}grib_set -s forecastTime=-38 $input $temp
grib_check_key_equals $temp 'validityDate,validityTime' '20080204 2200'

${tools_dir}grib_set -s forecastTime=-185 $input $temp
grib_check_key_equals $temp 'validityDate,validityTime' '20080129 1900'


# Clean up
rm -f $temp