ECC-1374: Add more tests

This commit is contained in:
Shahram Najm 2022-03-28 16:18:11 +01:00
parent 6eae07b94a
commit 6d6d574dfc
7 changed files with 29 additions and 22 deletions

View File

@ -27,6 +27,7 @@ meta countOfGroupLengths sum(groupLengths);
transient numberOfCodedValues=countOfGroupLengths+orderOfSPD;
#transient numberOfCodedValues=countOfGroupLengths;
meta bitsPerValue second_order_bits_per_value(codedValues,binaryScaleFactor,decimalScaleFactor);
alias accuracy = bitsPerValue;
position offsetBeforeData;

View File

@ -11,6 +11,7 @@ meta numberOfGroups evaluate(codedNumberOfFirstOrderPackedValues + 65536 * extra
unsigned[1] groupWidth :dump;
meta bitsPerValue second_order_bits_per_value(values,binaryScaleFactor,decimalScaleFactor);
alias accuracy = bitsPerValue;
position offsetBeforeData;

View File

@ -11,6 +11,7 @@ meta numberOfGroups evaluate(codedNumberOfFirstOrderPackedValues + 65536 * extra
unsigned[1] groupWidths[numberOfGroups] :dump;
meta bitsPerValue second_order_bits_per_value(values,binaryScaleFactor,decimalScaleFactor);
alias accuracy = bitsPerValue;
position offsetBeforeData;

View File

@ -11,6 +11,7 @@ meta numberOfGroups evaluate(codedNumberOfFirstOrderPackedValues + 65536 * extra
unsigned[1] groupWidths[numberOfGroups] :dump;
meta bitsPerValue second_order_bits_per_value(values,binaryScaleFactor,decimalScaleFactor);
alias accuracy = bitsPerValue;
position offsetBeforeData;

View File

@ -1,27 +1,28 @@
# (C) Copyright 2005- ECMWF.
ieeefloat referenceValue : no_copy;
ieeefloat referenceValue: no_copy;
meta referenceValueError reference_value_error(referenceValue,ieee);
signed[2] binaryScaleFactor : no_copy;
signed[2] binaryScaleFactor: no_copy;
signed[2] decimalScaleFactor :no_copy;
signed[2] decimalScaleFactor: no_copy;
# Try different values of binaryScaleFactor and decimalScaleFactor to reduce packing error
transient optimizeScaleFactor = 0;
unsigned[1] bitsPerValue ;
unsigned[1] bitsPerValue;
alias accuracy = bitsPerValue;
if (bitsPerValue) {
unsigned[1] widthOfFirstOrderValues :no_copy ;
unsigned[1] widthOfFirstOrderValues :no_copy ;
unsigned [4] numberOfGroups : no_copy;
unsigned [4] numberOfSecondOrderPackedValues : no_copy;
unsigned [1] widthOfWidths : no_copy;
unsigned [1] widthOfLengths : no_copy;
unsigned [1] orderOfSPD = 2 : no_copy ;
unsigned [4] numberOfGroups : no_copy;
unsigned [4] numberOfSecondOrderPackedValues : no_copy;
unsigned [1] widthOfWidths : no_copy;
unsigned [1] widthOfLengths : no_copy;
unsigned [1] orderOfSPD = 2 : no_copy ;
if (orderOfSPD) {
unsigned[1] widthOfSPD ;
meta SPD spd(widthOfSPD,orderOfSPD) : read_only;
}
if (orderOfSPD) {
unsigned[1] widthOfSPD ;
meta SPD spd(widthOfSPD,orderOfSPD) : read_only;
}
}

View File

@ -3,15 +3,16 @@
ieeefloat referenceValue : no_copy;
meta referenceValueError reference_value_error(referenceValue,ieee);
signed[2] binaryScaleFactor : no_copy;
signed[2] binaryScaleFactor : no_copy;
signed[2] decimalScaleFactor :no_copy;
signed[2] decimalScaleFactor :no_copy;
# Try different values of binaryScaleFactor and decimalScaleFactor to reduce packing error
transient optimizeScaleFactor = 0;
unsigned[1] bitsPerValue ;
unsigned[1] widthOfFirstOrderValues :no_copy ;
unsigned[1] bitsPerValue;
alias accuracy = bitsPerValue;
unsigned[1] widthOfFirstOrderValues :no_copy;
unsigned [4] numberOfGroups : no_copy;
unsigned [4] numberOfSecondOrderPackedValues : no_copy;
@ -24,6 +25,6 @@ flagbit boustrophedonicOrdering(secondOrderFlags,7) = 0;
alias boustrophedonic=boustrophedonicOrdering;
if (orderOfSPD) {
unsigned[1] widthOfSPD ;
meta SPD spd(widthOfSPD,orderOfSPD) : read_only;
unsigned[1] widthOfSPD ;
meta SPD spd(widthOfSPD,orderOfSPD) : read_only;
}

View File

@ -87,6 +87,7 @@ sec_ord_bmp=sec_ord_bmp.$$.grib1
# Convert to second order packing
${tools_dir}/grib_set -r -s packingType=grid_second_order gen_bitmap.grib $sec_ord_bmp
grib_check_key_equals $sec_ord_bmp accuracy 4
# Check there are missing values
nums=`${tools_dir}/grib_get -p numberOfDataPoints,numberOfCodedValues,numberOfMissing $sec_ord_bmp`
[ "$nums" = "5969 4 5965" ]
@ -129,7 +130,7 @@ cat > $test_filter<<EOF
EOF
${tools_dir}/grib_filter -o $temp2 $test_filter $ECCODES_SAMPLES_PATH/GRIB2.tmpl
${tools_dir}/grib_set -r -s packingType=grid_second_order $temp2 $temp3
grib_check_key_equals $temp3 packingType grid_simple
grib_check_key_equals $temp3 packingType,accuracy 'grid_simple 24'
# Three coded values: Now we can change to 2nd order
cat > $test_filter<<EOF
@ -138,7 +139,7 @@ cat > $test_filter<<EOF
EOF
${tools_dir}/grib_filter -o $temp2 $test_filter $ECCODES_SAMPLES_PATH/GRIB2.tmpl
${tools_dir}/grib_set -r -s packingType=grid_second_order $temp2 $temp3
grib_check_key_equals $temp3 packingType grid_second_order
grib_check_key_equals $temp3 packingType,accuracy 'grid_second_order 24'
# ECC-1219: packingType conversion from grid_ieee to grid_second_order