From 57847622e1e2cb876a56994dbe84720757d823cf Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Mon, 18 Dec 2023 12:49:46 +0000 Subject: [PATCH] Testing: Increase coverage: spectral stats --- tests/codes_compare_keys.sh | 6 ++++++ tests/grib_grid_lamb_az_eq_area.sh | 27 ++++++++++++++++++++------- 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/tests/codes_compare_keys.sh b/tests/codes_compare_keys.sh index ca7d16a3c..44fed25d2 100755 --- a/tests/codes_compare_keys.sh +++ b/tests/codes_compare_keys.sh @@ -63,6 +63,12 @@ EOF diff $tempRef $tempLog +# Spectral +# ---------- +sample_spectral=$ECCODES_SAMPLES_PATH/sh_ml_grib2.tmpl +${test_dir}/codes_compare_keys $sample_spectral $sample_spectral enorm,avg + + # Local definitions # ---------------------- sample1=$ECCODES_SAMPLES_PATH/GRIB1.tmpl diff --git a/tests/grib_grid_lamb_az_eq_area.sh b/tests/grib_grid_lamb_az_eq_area.sh index abd4e1afb..f3ed52588 100755 --- a/tests/grib_grid_lamb_az_eq_area.sh +++ b/tests/grib_grid_lamb_az_eq_area.sh @@ -9,22 +9,23 @@ . ./include.ctest.sh +label="grib_grid_lamb_az_eq_area_test" GRIB_INFILE=${data_dir}/regular_gaussian_pressure_level_constant.grib2 REF_FILE=grib_lamb_az_eq_area.ref # Temporary files created for this test -FILTER_FILE=lamb_az_eq_area.filter -GRIB_OUTFILE=lamb_az_eq_area.grib2 -DATA_OUTFILE=lamb_data.txt +FILTER_FILE=temp.$label.filter +GRIB_OUTFILE=temp.$label.grib2 +DATA_OUTFILE=temp.$label.txt rm -f $FILTER_FILE $GRIB_OUTFILE $DATA_OUTFILE +# -------------------- # Spherical Earth -# ---------------- +# -------------------- # Create a filter cat > $FILTER_FILE< $DATA_OUTFILE # Compare output with reference. If the diff fails, script will immediately exit with status 1 -diff $DATA_OUTFILE $REF_FILE +diff $REF_FILE $DATA_OUTFILE grib_check_key_equals $GRIB_OUTFILE standardParallelInDegrees,centralLongitudeInDegrees '48 9' grib_check_key_equals $GRIB_OUTFILE xDirectionGridLengthInMetres,yDirectionGridLengthInMetres '5000 5000' @@ -62,8 +63,20 @@ grib_check_key_equals $GRIB_OUTFILE xDirectionGridLengthInMetres,yDirectionGridL ${tools_dir}/grib_ls -l 67,-33,1 $GRIB_OUTFILE # jPointsAreConsecutive -${tools_dir}/grib_get_data -s jPointsAreConsecutive=1 $GRIB_OUTFILE > $DATA_OUTFILE +tempOutA=temp.$label.A.txt +tempOutB=temp.$label.B.txt +${tools_dir}/grib_get_data -s jPointsAreConsecutive=0 $GRIB_OUTFILE > $tempOutA +${tools_dir}/grib_get_data -s jPointsAreConsecutive=1 $GRIB_OUTFILE > $tempOutB +# Results should be different. +set +e +diff $tempOutA $tempOutB > /dev/null +status=$? +set -e +[ $status -ne 0 ] +rm -f $tempOutA $tempOutB + +# -------------------- # Oblate spheroid # --------------------