From 20a52d119aa82c742b6a254c75c71e0f5a0484e6 Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Sun, 15 Aug 2021 15:54:13 +0100 Subject: [PATCH] Testing: Test for WRAP --- definitions/tide/section.4.def | 108 +++++++++++++++------------------ definitions/wrap/boot.def | 14 ++--- samples/wrap.tmpl | Bin 0 -> 31 bytes tests/CMakeLists.txt | 1 + tests/wrap.sh | 29 +++++++++ 5 files changed, 85 insertions(+), 67 deletions(-) create mode 100644 samples/wrap.tmpl create mode 100755 tests/wrap.sh diff --git a/definitions/tide/section.4.def b/definitions/tide/section.4.def index dde9e20f4..953d29d7b 100644 --- a/definitions/tide/section.4.def +++ b/definitions/tide/section.4.def @@ -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; +#} diff --git a/definitions/wrap/boot.def b/definitions/wrap/boot.def index f7915d89c..fafb296ad 100644 --- a/definitions/wrap/boot.def +++ b/definitions/wrap/boot.def @@ -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; diff --git a/samples/wrap.tmpl b/samples/wrap.tmpl new file mode 100644 index 0000000000000000000000000000000000000000..8e2b4ae1c878af020372b5fb81cedd90c921b7fc GIT binary patch literal 31 gcmWF!atvUA0C@%mkJOx;d>w`I{Gyx`MROnk09$AVzW@LL literal 0 HcmV?d00001 diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 1089a3570..fc1a86f0c 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -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 diff --git a/tests/wrap.sh b/tests/wrap.sh new file mode 100755 index 000000000..4605885a2 --- /dev/null +++ b/tests/wrap.sh @@ -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