2014-11-13 16:47:32 +00:00
|
|
|
#!/bin/sh
|
2020-01-28 14:32:34 +00:00
|
|
|
# (C) Copyright 2005- ECMWF.
|
2014-11-13 16:47:32 +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
|
2014-11-13 16:47:32 +00:00
|
|
|
|
2023-12-14 13:35:47 +00:00
|
|
|
label="grib_calendar_test"
|
2014-11-13 16:47:32 +00:00
|
|
|
|
2023-12-14 13:35:47 +00:00
|
|
|
temp1=temp1.$label.$$
|
|
|
|
temp2=temp2.$label.$$
|
2015-01-23 22:47:51 +00:00
|
|
|
sample=$ECCODES_SAMPLES_PATH/GRIB2.tmpl
|
2014-11-13 16:47:32 +00:00
|
|
|
|
2017-02-03 14:21:24 +00:00
|
|
|
${tools_dir}/grib_set -s tablesVersion=13,setCalendarId=1,typeOfCalendar=0 $sample $temp1
|
2016-01-21 16:52:24 +00:00
|
|
|
grib_check_key_equals $temp1 calendarIdPresent 1
|
|
|
|
grib_check_key_equals $temp1 section1Length 24
|
|
|
|
grib_check_key_equals $temp1 calendarIdentificationTemplateNumber 0
|
|
|
|
grib_check_key_equals $temp1 typeOfCalendar 0
|
2014-11-13 16:47:32 +00:00
|
|
|
|
2017-02-03 14:21:24 +00:00
|
|
|
${tools_dir}/grib_set -s tablesVersion=13,setCalendarId=1,calendarIdentificationTemplateNumber=1 $sample $temp1
|
2016-01-21 16:52:24 +00:00
|
|
|
grib_check_key_equals $temp1 calendarIdPresent 1
|
|
|
|
grib_check_key_equals $temp1 section1Length 25
|
|
|
|
grib_check_key_equals $temp1 calendarIdentificationTemplateNumber 1
|
|
|
|
grib_check_key_equals $temp1 numberOfTensOfThousandsOfYearsOfOffset MISSING
|
2014-11-13 16:47:32 +00:00
|
|
|
|
2017-02-03 14:21:24 +00:00
|
|
|
${tools_dir}/grib_set -s tablesVersion=13,setCalendarId=1,calendarIdentificationTemplateNumber=2 $sample $temp1
|
2016-01-21 16:52:24 +00:00
|
|
|
grib_check_key_equals $temp1 calendarIdPresent 1
|
|
|
|
grib_check_key_equals $temp1 section1Length 26
|
|
|
|
grib_check_key_equals $temp1 calendarIdentificationTemplateNumber 2
|
|
|
|
grib_check_key_equals $temp1 typeOfCalendar 255
|
|
|
|
grib_check_key_equals $temp1 numberOfTensOfThousandsOfYearsOfOffset MISSING
|
2014-11-13 16:47:32 +00:00
|
|
|
|
|
|
|
# Remove the calendar section
|
2017-02-03 14:21:24 +00:00
|
|
|
${tools_dir}/grib_set -s deleteCalendarId=1 $temp1 $temp2
|
2016-01-21 16:52:24 +00:00
|
|
|
grib_check_key_equals $temp2 section1Length 21
|
|
|
|
grib_check_key_equals $temp2 calendarIdPresent 0
|
2014-11-13 16:47:32 +00:00
|
|
|
|
|
|
|
rm -f $temp1 $temp2
|