From d108c4a118dee7dd1717c39f6d9fdfad5c206321 Mon Sep 17 00:00:00 2001 From: shahramn Date: Wed, 6 Mar 2024 14:07:46 +0000 Subject: [PATCH] Testing: check_gaussian_grids --- tests/grib_check_gaussian_grids.sh | 33 +++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/tests/grib_check_gaussian_grids.sh b/tests/grib_check_gaussian_grids.sh index 474eaf726..c37013981 100755 --- a/tests/grib_check_gaussian_grids.sh +++ b/tests/grib_check_gaussian_grids.sh @@ -28,6 +28,17 @@ for gg in ${samples_dir}/reduced_gg_*tmpl; do done +# Set wrong Nj. Should fail +input=$samples_dir/reduced_gg_pl_32_grib2.tmpl +${tools_dir}/grib_set -s Nj=1 $input $tempGrib +set +e +${tools_dir}/grib_check_gaussian_grid -v $tempGrib 2> $tempText +status=$? +set -e +[ $status -ne 0 ] +grep -q "Nj is 1 but should be 2\*N" $tempText + + # Set wrong N. Should fail input=$samples_dir/reduced_gg_pl_32_grib2.tmpl ${tools_dir}/grib_set -s N=0 $input $tempGrib @@ -38,6 +49,7 @@ set -e [ $status -eq 1 ] grep -q "Error: N should be > 0" $tempText + # Set wrong angle. Should fail input=$samples_dir/reduced_gg_pl_1280_grib2.tmpl ${tools_dir}/grib_set -s longitudeOfLastGridPoint=359929680 $input $tempGrib @@ -49,6 +61,17 @@ set -e grep -q "Error: longitudeOfLastGridPointInDegrees.*but should be" $tempText +# Set wrong lat2. Should fail +input=$samples_dir/reduced_gg_pl_1280_grib2.tmpl +${tools_dir}/grib_set -s latitudeOfLastGridPointInDegrees=9 $input $tempGrib +set +e +${tools_dir}/grib_check_gaussian_grid -v $tempGrib 2> $tempText +status=$? +set -e +[ $status -ne 0 ] +grep -q "First latitude must be = last latitude but opposite in sign" $tempText + + # Set wrong numberOfDataPoints. Should fail input=$samples_dir/reduced_gg_pl_96_grib2.tmpl ${tools_dir}/grib_set -s numberOfDataPoints=44 $input $tempGrib @@ -68,9 +91,17 @@ ${tools_dir}/grib_check_gaussian_grid -f -v $tempGrib 2> $tempText status=$? set -e [ $status -eq 1 ] -cat $tempText grep -q "Error: Sum of pl array 50662 does not match numberOfValues 44" $tempText +# Octahedral +set +e +${tools_dir}/grib_check_gaussian_grid -v $data_dir/msl.octa.glob.grib1 > $tempText 2>&1 +status=$? +set -e +[ $status -ne 0 ] +grep -q "This is an Octahedral Gaussian grid" $tempText +grep -q "Error: longitudeOfLastGridPointInDegrees.*should be" $tempText + # Other errors/warnings # ----------------------