Testing: GRIB1 with GDS not present

This commit is contained in:
Shahram Najm 2023-08-04 13:23:39 +00:00
parent ca027115da
commit d23e35c6ce
4 changed files with 34 additions and 2 deletions

View File

@ -0,0 +1 @@
label "_empty";

View File

@ -24,6 +24,7 @@
IMPLEMENTS = unpack_double
IMPLEMENTS = pack_double
IMPLEMENTS = value_count
IMPLEMENTS = get_native_type
MEMBERS=const char* missing_value
MEMBERS=const char* number_of_values
MEMBERS=const char* number_of_points
@ -43,6 +44,7 @@ or edit "accessor.class" and rerun ./make_class.pl
*/
static int get_native_type(grib_accessor*);
static int pack_double(grib_accessor*, const double* val, size_t* len);
static int unpack_double(grib_accessor*, double* val, size_t* len);
static int value_count(grib_accessor*, long*);
@ -77,7 +79,7 @@ static grib_accessor_class _grib_accessor_class_gds_not_present_bitmap = {
&value_count, /* get number of values */
0, /* get number of bytes */
0, /* get offset to bytes */
0, /* get native type */
&get_native_type, /* get native type */
0, /* get sub_section */
0, /* pack_missing */
0, /* is_missing */
@ -132,7 +134,7 @@ static void init(grib_accessor* a, const long v, grib_arguments* args)
static int value_count(grib_accessor* a, long* number_of_points)
{
grib_accessor_gds_not_present_bitmap* self = (grib_accessor_gds_not_present_bitmap*)a;
*number_of_points = 0;
*number_of_points = 0;
return grib_get_long_internal(grib_handle_of_accessor(a), self->number_of_points, number_of_points);
}
@ -207,3 +209,8 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len)
// a possible implementation
return GRIB_NOT_IMPLEMENTED;
}
static int get_native_type(grib_accessor* a)
{
return GRIB_TYPE_DOUBLE;
}

View File

@ -236,6 +236,7 @@ if( HAVE_BUILD_TOOLS )
metar_compare
bufr_set
grib_ieee
grib1_gds_not_present
grib_sh_ieee64
grib_optimize_scaling
grib_optimize_scaling_sh

23
tests/grib1_gds_not_present.sh Executable file
View File

@ -0,0 +1,23 @@
#!/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
REDIRECT=/dev/null
label="grib1_gds_not_present_test"
tempGrib=temp.$label.grib
input=$data_dir/reduced_latlon_surface.grib1
${tools_dir}/grib_set -s gridDescriptionSectionPresent=0 $input $tempGrib
${tools_dir}/grib_dump $tempGrib > $REDIRECT 2>&1
# Clean up
rm -f $tempGrib