Testing: Test for WRAP

This commit is contained in:
Shahram Najm 2021-08-15 15:54:13 +01:00
parent e7c6360c50
commit 20a52d119a
5 changed files with 85 additions and 67 deletions

View File

@ -1,31 +1,24 @@
# (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.
#
section_length[3] section4Length ;
section_length[3] section4Length;
unsigned[1] reserved=0 : hidden;
unsigned[1] reserved=0 : hidden;
flags[1] missingDataFlag 'grib1/1.table';
unsigned[1] numberOfBytesPerInteger ;
unsigned[2] reserved=0 : hidden;
unsigned[2] reserved=0 : hidden;
unsigned[3] numberOfChars ;
unsigned[3] numberOfChars;
unsigned[3] numberOfFloats ;
unsigned[3] numberOfFloats;
unsigned[3] numberOfInts ;
unsigned[3] numberOfInts;
unsigned[3] numberOfLogicals ;
unsigned[3] numberOfLogicals;
unsigned[3] numberOfReservedBytes ;
unsigned[3] numberOfReservedBytes;
unsigned[4] reserved=0 : hidden;
unsigned[4] reserved=0 : hidden;
@ -40,62 +33,57 @@ if(numberOfBytesPerInteger == 4) { signed[4] integerValues[numberOfInts]; }
if(numberOfChars >= 12)
{
ascii[2] marsClass;
ascii[2] dummy1;
ascii[2] marsType;
ascii[2] dummy2;
ascii[4] marsExpver;
ascii[2] marsClass;
ascii[2] dummy1;
ascii[2] marsType;
ascii[2] dummy2;
ascii[4] marsExpver;
constant numberOfRemaininChars = numberOfChars - 12;
constant numberOfRemaininChars = numberOfChars - 12;
charValues list(numberOfRemaininChars) {
ascii[1] char;
}
charValues list(numberOfRemaininChars) {
ascii[1] char;
}
constant zero = 0;
concept isEps(zero) { 1 = { marsType = "pf"; } }
concept isSens(zero) { 1 = { marsType = "sf"; } }
constant zero = 0;
concept isEps(zero) { 1 = { marsType = "pf"; } }
concept isSens(zero) { 1 = { marsType = "sf"; } }
constant oper = "oper";
constant oper = "oper";
concept marsStream(oper) {
"enfo" = { marsType = "pf"; }
"enfo" = { marsType = "cf"; }
"sens" = { marsType = "sf"; }
}
concept marsStream(oper) {
"enfo" = { marsType = "pf"; }
"enfo" = { marsType = "cf"; }
"sens" = { marsType = "sf"; }
}
if(isEps)
{
constant perturbationNumber = 0;
alias mars.number = perturbationNumber;
}
if(isEps)
{
constant perturbationNumber = 0;
alias mars.number = perturbationNumber;
}
if(isSens)
{
constant iterationNumber = 0;
constant diagnosticNumber = 0;
alias mars.iteration = iterationNumber;
alias mars.diagnostic = diagnosticNumber;
}
# This is commented out because some of the BUDG have the wrong info there
alias mars.stream = marsStream;
alias mars.class = marsClass;
alias mars.type = marsType;
alias mars.expver = marsExpver;
if(isSens)
{
constant iterationNumber = 0;
constant diagnosticNumber = 0;
alias mars.iteration = iterationNumber;
alias mars.diagnostic = diagnosticNumber;
}
# This is commented out because some of the BUDG have the wrong info there
alias mars.stream = marsStream;
alias mars.class = marsClass;
alias mars.type = marsType;
alias mars.expver = marsExpver;
}
else
{
charValues list(numberOfChars) {
ascii[1] char;
}
charValues list(numberOfChars) {
ascii[1] char;
}
}
#reservedBytes list (numberOfReservedBytes){
# unsigned[1] byte;
# }
# unsigned[1] byte;
#}

View File

@ -11,17 +11,17 @@ position startOfHeaders;
ascii[4] identifier = `WRAP`: dump;
alias ls.identifier=identifier;
uint64 totalLength : dump;
uint8 version = 1 : dump;
uint8 spare;
uint64 totalLength : dump;
uint8 version = 1 : dump;
uint8 spare;
template metadata "wrap/metadata.[version].def";
template metadata "wrap/metadata.[version].def";
position endOfHeadersMarker;
position endOfHeadersMarker;
constant dataLength = (totalLength - endOfHeadersMarker - 4);
blob data[dataLength] : dump;
ascii[4] endMark = `7777` : dump;
ascii[4] endMark = `7777` : dump;
position totalLength;
position totalLength;

BIN
samples/wrap.tmpl Normal file

Binary file not shown.

View File

@ -100,6 +100,7 @@ if( HAVE_BUILD_TOOLS )
grib_sh_imag
grib_sh_spectral_complex
pseudo_diag
wrap
grib_levtype
grib_grid_unstructured
grib_grid_lambert_conformal

29
tests/wrap.sh Executable file
View File

@ -0,0 +1,29 @@
#!/bin/sh
# (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.
#
# Tests for WRAP
. ./include.sh
label="wrap-test"
tempOut=temp.${label}.out
tempTxt=temp.${label}.txt
tempRef=temp.${label}.ref
REDIRECT=/dev/null
input=$ECCODES_SAMPLES_PATH/wrap.tmpl
${tools_dir}/grib_dump -TA -O $input
id=`${tools_dir}/grib_get -TA -p identifier $input`
[ "$id" = "WRAP" ]
# Clean up
rm -f $tempOut $tempRef $tempTxt