eccodes/tests/grib_calendar.sh

44 lines
1.8 KiB
Bash
Raw Permalink Normal View History

#!/bin/sh
2020-01-28 14:32:34 +00:00
# (C) Copyright 2005- 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.ctest.sh
2023-12-14 13:35:47 +00:00
label="grib_calendar_test"
2023-12-14 13:35:47 +00:00
temp1=temp1.$label.$$
temp2=temp2.$label.$$
sample=$ECCODES_SAMPLES_PATH/GRIB2.tmpl
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
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
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
# 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
rm -f $temp1 $temp2