Testing: grid_second_order_constant_width

This commit is contained in:
Shahram Najm 2023-09-03 12:15:48 +01:00
parent 9b79f50bc3
commit 94026eb80b
3 changed files with 23 additions and 7 deletions

View File

@ -308,7 +308,8 @@ static int unpack_double(grib_accessor* a, double* values, size_t* len)
static int pack_double(grib_accessor* a, const double* cval, size_t* len)
{
grib_context_log(a->context, GRIB_LOG_ERROR, "constant width packing not implemented");
const char* cclass_name = a->cclass->name;
grib_context_log(a->context, GRIB_LOG_ERROR, "%s: %s: Not implemented", cclass_name, __func__);
return GRIB_NOT_IMPLEMENTED;
}

View File

@ -12,19 +12,19 @@
label="grib_get_fail_test"
tempText=temp.$label.txt
REDIRECT=/dev/null
# Check input file has been downloaded
[ -f ${data_dir}/regular_latlon_surface.grib1 ]
# Expect failure as the key does not exist
set +e
${tools_dir}/grib_get -p boomerang ${data_dir}/regular_latlon_surface.grib1 2> $REDIRECT > $REDIRECT
${tools_dir}/grib_get -p boomerang ${data_dir}/regular_latlon_surface.grib1
status=$?
set -e
[ $status -ne 0 ]
# ECC-1551: Print which key does not exist
# -----------------------------------------
set +e
${tools_dir}/grib_get -p Ni,Nh,Nj $ECCODES_SAMPLES_PATH/GRIB2.tmpl > $tempText 2>&1
status=$?
@ -32,8 +32,8 @@ set -e
[ $status -ne 0 ]
grep -q "Nh (Key/value not found)" $tempText
# Types like uint16 etc
# Create a temporary directory which holds the tables etc
# Types like uint16, uint32 etc
# -------------------------------
tempDir=${label}.temp.dir
rm -rf $tempDir
mkdir -p $tempDir/definitions/grib2
@ -51,12 +51,13 @@ input=$ECCODES_SAMPLES_PATH/GRIB2.tmpl
set +e
${tools_dir}/grib_get -p key_uint16 $input > $tempText 2>&1
${tools_dir}/grib_get -p key_uint32 $input >> $tempText 2>&1
${tools_dir}/grib_get -p key_uint64 $input >> $tempText 2>&1
${tools_dir}/grib_get -p key_uint32_le $input >> $tempText 2>&1
${tools_dir}/grib_get -p key_uint64_le $input >> $tempText 2>&1
set -e
cat $tempText
${tools_dir}/grib_get -p key_uint64 $input
${tools_dir}/grib_get -p key_uint64_le $input
# Clean up
cd $test_dir
rm -rf $tempDir

View File

@ -183,6 +183,20 @@ ${tools_dir}/grib_set -s scaleValuesBy=1.1 boustrophedonic.grib1 $temp1
unset ECCODES_GRIBEX_BOUSTROPHEDONIC
# data_g1second_order_constant_width_packing
# ------------------------------------------
input=second_ord_rbr.grib1
${tools_dir}/grib_set -s secondOrderOfDifferentWidth=0,secondaryBitmapPresent=1 $input $temp1
grib_check_key_equals $temp1 packingType grid_second_order_constant_width
${tools_dir}/grib_dump -O $temp1 > $REDIRECT
set +e
${tools_dir}/grib_set -s scaleValuesBy=2 $temp1 $temp2 > $tempText 2>&1
status=$?
set -e
[ $status -ne 0 ]
grep -q "Not implemented" $tempText
# Clean up
rm -f $temp_stat1 $temp_stat2
rm -f $temp1 $temp2 $temp3 $sec_ord_bmp