mirror of https://github.com/ecmwf/eccodes.git
GRIB-601: GRIB edition 2: Support the new identification templates in section 1
This commit is contained in:
parent
e6ae11b826
commit
24d45c486f
|
@ -4655,6 +4655,11 @@ dist_definitionsgrib2_DATA = \
|
||||||
grib2/section.8.def\
|
grib2/section.8.def\
|
||||||
grib2/sections.def\
|
grib2/sections.def\
|
||||||
grib2/shortName.def\
|
grib2/shortName.def\
|
||||||
|
grib2/template.1.0.def\
|
||||||
|
grib2/template.1.1.def\
|
||||||
|
grib2/template.1.2.def\
|
||||||
|
grib2/template.1.calendar.def\
|
||||||
|
grib2/template.1.offset.def\
|
||||||
grib2/template.3.0.def\
|
grib2/template.3.0.def\
|
||||||
grib2/template.3.1.def\
|
grib2/template.3.1.def\
|
||||||
grib2/template.3.10.def\
|
grib2/template.3.10.def\
|
||||||
|
|
|
@ -111,3 +111,12 @@ concept stepType {
|
||||||
"ratio" = {selectStepTemplateInterval=1; stepTypeInternal="ratio";}
|
"ratio" = {selectStepTemplateInterval=1; stepTypeInternal="ratio";}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
transient setCalendarId = 0 ;
|
||||||
|
transient deleteCalendarId = 0 ;
|
||||||
|
alias calendarIdPresent = zero;
|
||||||
|
if ( ((section1Length > 21) or setCalendarId > 0) and deleteCalendarId == 0) {
|
||||||
|
alias calendarIdPresent = present;
|
||||||
|
codetable[2] calendarIdentificationTemplateNumber ('1.5.table',masterDir,localDir) : dump,string_type,no_fail;
|
||||||
|
template calendarIdentification "grib2/template.1.[calendarIdentificationTemplateNumber:l].def";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
# Copyright 2005-2014 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.
|
||||||
|
#
|
||||||
|
|
||||||
|
# TEMPLATE 1.0, Calendar Definition
|
||||||
|
|
||||||
|
include "template.1.calendar.def";
|
|
@ -0,0 +1,12 @@
|
||||||
|
# Copyright 2005-2014 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.
|
||||||
|
#
|
||||||
|
|
||||||
|
# TEMPLATE 1.1, Paleontological Offset
|
||||||
|
|
||||||
|
include "template.1.offset.def";
|
|
@ -0,0 +1,13 @@
|
||||||
|
# Copyright 2005-2014 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.
|
||||||
|
#
|
||||||
|
|
||||||
|
# TEMPLATE 1.2, Calendar Definition and Paleontological Offset
|
||||||
|
|
||||||
|
include "template.1.calendar.def";
|
||||||
|
include "template.1.offset.def";
|
|
@ -0,0 +1,11 @@
|
||||||
|
# Copyright 2005-2014 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.
|
||||||
|
#
|
||||||
|
|
||||||
|
# Type of Calendar (see Code Table 1.6)
|
||||||
|
codetable[1] typeOfCalendar ('1.6.table',masterDir,localDir) = 255 : dump,no_copy,edition_specific;
|
|
@ -0,0 +1,12 @@
|
||||||
|
# Copyright 2005-2014 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.
|
||||||
|
#
|
||||||
|
|
||||||
|
# Number of tens of thousands of years of offset
|
||||||
|
signed[2] numberOfTensOfThousandsOfYearsOfOffset = missing() : can_be_missing,dump,no_copy,edition_specific;
|
||||||
|
alias paleontologicalOffset=numberOfTensOfThousandsOfYearsOfOffset ;
|
|
@ -28,6 +28,7 @@ endforeach()
|
||||||
#################################################
|
#################################################
|
||||||
list( APPEND tests
|
list( APPEND tests
|
||||||
definitions
|
definitions
|
||||||
|
calendar
|
||||||
bufr_dump
|
bufr_dump
|
||||||
bufrdc_desc_ref
|
bufrdc_desc_ref
|
||||||
bufrdc_ref
|
bufrdc_ref
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
TESTS = definitions.sh \
|
TESTS = definitions.sh calendar.sh \
|
||||||
bufrdc_desc_ref.sh bufrdc_ref.sh bufr_dump.sh \
|
bufrdc_desc_ref.sh bufrdc_ref.sh bufr_dump.sh \
|
||||||
ieee.sh grib1to2.sh \
|
ieee.sh grib1to2.sh \
|
||||||
unit_tests.sh \
|
unit_tests.sh \
|
||||||
|
|
|
@ -0,0 +1,54 @@
|
||||||
|
#!/bin/sh
|
||||||
|
# Copyright 2005-2014 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
|
||||||
|
|
||||||
|
temp1=temp1.calendar.$$
|
||||||
|
temp2=temp2.calendar.$$
|
||||||
|
sample=$GRIB_SAMPLES_PATH/GRIB2.tmpl
|
||||||
|
|
||||||
|
########### Utility function ##############
|
||||||
|
check_key_equals()
|
||||||
|
{
|
||||||
|
file=$1
|
||||||
|
key=$2
|
||||||
|
val=$3
|
||||||
|
result=`${tools_dir}grib_get -p $key $file`
|
||||||
|
[ "$result" = "$val" ]
|
||||||
|
}
|
||||||
|
###########################################
|
||||||
|
|
||||||
|
${tools_dir}grib_set -s tablesVersion=13,setCalendarId=1,typeOfCalendar=0 $sample $temp1
|
||||||
|
check_key_equals $temp1 calendarIdPresent 1
|
||||||
|
check_key_equals $temp1 section1Length 24
|
||||||
|
check_key_equals $temp1 calendarIdentificationTemplateNumber 0
|
||||||
|
check_key_equals $temp1 typeOfCalendar 0
|
||||||
|
|
||||||
|
${tools_dir}grib_set -s tablesVersion=13,setCalendarId=1,calendarIdentificationTemplateNumber=1 $sample $temp1
|
||||||
|
check_key_equals $temp1 calendarIdPresent 1
|
||||||
|
check_key_equals $temp1 section1Length 25
|
||||||
|
check_key_equals $temp1 calendarIdentificationTemplateNumber 1
|
||||||
|
check_key_equals $temp1 numberOfTensOfThousandsOfYearsOfOffset MISSING
|
||||||
|
|
||||||
|
${tools_dir}grib_set -s tablesVersion=13,setCalendarId=1,calendarIdentificationTemplateNumber=2 $sample $temp1
|
||||||
|
check_key_equals $temp1 calendarIdPresent 1
|
||||||
|
check_key_equals $temp1 section1Length 26
|
||||||
|
check_key_equals $temp1 calendarIdentificationTemplateNumber 2
|
||||||
|
check_key_equals $temp1 typeOfCalendar 255
|
||||||
|
check_key_equals $temp1 numberOfTensOfThousandsOfYearsOfOffset MISSING
|
||||||
|
|
||||||
|
# Remove the calendar section
|
||||||
|
${tools_dir}grib_set -s deleteCalendarId=1 $temp1 $temp2
|
||||||
|
check_key_equals $temp2 section1Length 21
|
||||||
|
check_key_equals $temp2 calendarIdPresent 0
|
||||||
|
|
||||||
|
rm -f $temp1 $temp2
|
Loading…
Reference in New Issue