From 9ddef2ea04dfd2e4eec01bb8c2d61d6cf9e2cdd2 Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Sat, 25 Jun 2022 13:01:00 +0100 Subject: [PATCH] Testing: cleanup --- tests/grib_optimize_scaling.c | 8 ++++---- tests/grib_second_order.sh | 19 +++++++++++-------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/tests/grib_optimize_scaling.c b/tests/grib_optimize_scaling.c index 7f0b325f6..192840e4c 100644 --- a/tests/grib_optimize_scaling.c +++ b/tests/grib_optimize_scaling.c @@ -12,7 +12,7 @@ /* * Test the use of optimizeScaleFactor; on the following field, the packing error - * is reduced by almost a factor of 2; + * is reduced by almost a factor of 2; * Test that second order packing gives the same result as simple packing with optimizeScaleFactor=1 * philippe.marguinaud@meteo.fr, 2016/02 */ @@ -2718,6 +2718,7 @@ static void encode_decode(double* zval, const char* packingType, const int bitsP size_t len, slen; grib_handle* h; + /*printf("encode_decode: packingType=%s bitsPerValue=%d opt=%d\n", packingType, bitsPerValue, ioptimizeScaleFactor);*/ GRIB_CHECK(((h = grib_handle_new_from_samples(NULL, "regular_ll_pl_grib2")) == NULL), 0); GRIB_CHECK(grib_set_long(h, "Ni", NLON), 0); GRIB_CHECK(grib_set_long(h, "Nj", NLAT), 0); @@ -2749,8 +2750,7 @@ int main(int argc, char* argv[]) int bitsPerValue[11] = { 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18 }; int ipackingType, ibitsPerValue, ioptimizeScaleFactor; - - for (ibitsPerValue = 0; ibitsPerValue < 11; ibitsPerValue++) + for (ibitsPerValue = 0; ibitsPerValue < 11; ibitsPerValue++) { for (ipackingType = 0; ipackingType < 2; ipackingType++) { double zval_simple[NLAT * NLON]; double zval_second[NLAT * NLON]; @@ -2766,7 +2766,7 @@ int main(int argc, char* argv[]) return 1; } } - + } printf(" %30s %30s %30s %s\n", "bitsPerValue", "error(optimizeScaleFactor=0)", "error(optimizeScaleFactor=1)", "ratio"); for (ibitsPerValue = 0; ibitsPerValue < 11; ibitsPerValue++) { double zerr[2]; diff --git a/tests/grib_second_order.sh b/tests/grib_second_order.sh index abe060870..c95d50b0b 100755 --- a/tests/grib_second_order.sh +++ b/tests/grib_second_order.sh @@ -12,13 +12,15 @@ workdir=`pwd` REDIRECT=/dev/null +label="grib_second_order_test" +tempText=temp.$label.txt cd ${data_dir} encoding=1 simple_no_bitmap=simple.grib simple_bitmap=simple_bitmap.grib -test_filter=temp.grib_second_order.filter +test_filter=temp.$label.filter files_no_bitmap="gen_ext.grib \ gen_ext_boust.grib \ @@ -113,9 +115,9 @@ res=`${tools_dir}/grib_get -w count=1 -l 0,0,1 lfpw.grib1` g1files="lfpw.grib1 gen_ext_spd_2.grib gen_ext_spd_3.grib" -temp1=temp1.grib_second_order.grib -temp_stat1=temp.grib_second_order.stat1 -temp_stat2=temp.grib_second_order.stat2 +temp1=temp1.$label.grib +temp_stat1=temp.$label.stat1 +temp_stat2=temp.$label.stat2 for f1 in $g1files; do # This does unpack and repack @@ -128,15 +130,16 @@ done # GRIB-883 # ------------ # Two coded values: Should stay as grid_simple -temp2=temp2.grib_second_order.grib -temp3=temp3.grib_second_order.grib +temp2=temp2.$label.grib +temp3=temp3.$label.grib cat > $test_filter<$tempText grib_check_key_equals $temp3 packingType,accuracy 'grid_simple 24' +grep -q "Packing not changed" $tempText # Three coded values: Now we can change to 2nd order cat > $test_filter<