Skip to content

Commit

Permalink
Testing: GRIB-488
Browse files Browse the repository at this point in the history
  • Loading branch information
shahramn committed Nov 26, 2024
1 parent 1056745 commit b2e7009
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/accessor/grib_accessor_class_g2end_step.cc
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,12 @@ void grib_accessor_g2end_step_t::dump(grib_dumper* dumper)
}

// See GRIB-488
bool is_special_expver(const grib_handle* h)
static bool is_special_expver(const grib_handle* h)
{
int ret = 0;
char strMarsExpVer[50] = {0,};
char strMarsClass[50] = {0,};
size_t slen = 50;
ret = grib_get_string(h, "mars.class", strMarsClass, &slen);
int ret = grib_get_string(h, "mars.class", strMarsClass, &slen);
if (ret == GRIB_SUCCESS && STR_EQUAL(strMarsClass, "em")) {
// em = ERA-CLIM model integration for the 20th-century (ERA-20CM)
slen = 50;
Expand Down
1 change: 1 addition & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ if( HAVE_BUILD_TOOLS )
bufr_ecc-1785
bufr_ecc-1958
bufr_ecc-1938
grib_488
grib_ecc-490
grib_ecc-756
grib_ecc-806
Expand Down
49 changes: 49 additions & 0 deletions tests/grib_488.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/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.
#

. ./include.ctest.sh

# ---------------------------------------------------------
# This is the test for the JIRA issue GRIB-488
# GRIB2: step calculation for typeOfTimeIncrement=1
# ---------------------------------------------------------

label="grib-488_test"
tempGrib=temp.$label.grib
tempFilt=temp.$label.filt

sample_grib2=$ECCODES_SAMPLES_PATH/reduced_gg_pl_80_grib2.tmpl

cat >$tempFilt<<EOF
set marsClass = 'em';
set marsType = 'fc';
set marsStream = 'edmm';
set experimentVersionNumber = '1605';
set productDefinitionTemplateNumber = 11;
set yearOfEndOfOverallTimeInterval = 1900;
set monthOfEndOfOverallTimeInterval = 1;
set dayOfEndOfOverallTimeInterval = 1;
set hourOfEndOfOverallTimeInterval = 0;
set numberOfMissingInStatisticalProcess = 31;
set typeOfStatisticalProcessing = 0;
set typeOfTimeIncrement = 1;
set lengthOfTimeRange = 3;
set indicatorOfUnitForTimeIncrement = 1;
set timeIncrement = 24;
print "[stepRange=] [mars.step=]";
write;
EOF
${tools_dir}/grib_filter -o $tempGrib $tempFilt $sample_grib2
grib_check_key_equals $tempGrib stepRange,mars.step "0-3 3"


# Clean up
rm -f $tempGrib $tempFilt

0 comments on commit b2e7009

Please sign in to comment.