2016-01-13 11:49:15 +00:00
|
|
|
#!/bin/sh
|
2020-01-28 14:32:34 +00:00
|
|
|
# (C) Copyright 2005- ECMWF.
|
2016-01-13 11:49:15 +00:00
|
|
|
#
|
|
|
|
# This software is licensed under the terms of the Apache Licence Version 2.0
|
|
|
|
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
|
|
|
|
#
|
|
|
|
# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
|
|
|
|
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
|
|
|
|
|
2022-04-03 22:02:48 +00:00
|
|
|
. ./include.ctest.sh
|
2016-01-13 11:49:15 +00:00
|
|
|
|
2023-03-09 13:03:49 +00:00
|
|
|
label="grib_global_test"
|
|
|
|
|
2016-01-13 11:49:15 +00:00
|
|
|
# Check Gaussian grids
|
|
|
|
files_global="
|
|
|
|
reduced_gaussian_lsm.grib1
|
|
|
|
reduced_gaussian_model_level.grib1
|
|
|
|
reduced_gaussian_pressure_level.grib1
|
|
|
|
reduced_gaussian_pressure_level_constant.grib1
|
|
|
|
reduced_gaussian_surface.grib1
|
|
|
|
reference_ensemble_mean.grib1
|
|
|
|
reference_stdev.grib1
|
|
|
|
regular_gaussian_model_level.grib1
|
|
|
|
regular_gaussian_pressure_level.grib1
|
|
|
|
regular_gaussian_pressure_level_constant.grib1
|
|
|
|
regular_gaussian_surface.grib1
|
|
|
|
reduced_gaussian_model_level.grib2
|
|
|
|
reduced_gaussian_pressure_level.grib2
|
|
|
|
reduced_gaussian_pressure_level_constant.grib2
|
|
|
|
reduced_gaussian_surface.grib2
|
|
|
|
reduced_gaussian_surface_jpeg.grib2
|
|
|
|
regular_gaussian_model_level.grib2
|
|
|
|
regular_gaussian_pressure_level.grib2
|
|
|
|
regular_gaussian_pressure_level_constant.grib2
|
|
|
|
regular_gaussian_surface.grib2
|
|
|
|
tigge/tigge_ecmf_pl_gh.grib
|
|
|
|
tigge/tigge_sbsj_pl_q.grib
|
|
|
|
"
|
|
|
|
|
|
|
|
files_subarea="
|
|
|
|
reduced_gaussian_sub_area.grib1
|
|
|
|
reduced_gaussian_sub_area.grib2
|
|
|
|
"
|
|
|
|
|
|
|
|
for gg in $files_global; do
|
|
|
|
filepath=${data_dir}/$gg
|
2016-01-21 16:52:24 +00:00
|
|
|
grib_check_key_equals $filepath "global" 1
|
2016-01-13 11:49:15 +00:00
|
|
|
done
|
|
|
|
|
|
|
|
for gg in $files_subarea; do
|
|
|
|
filepath=${data_dir}/$gg
|
2016-01-21 16:52:24 +00:00
|
|
|
grib_check_key_equals $filepath "global" 0
|
2016-01-13 11:49:15 +00:00
|
|
|
done
|
2023-03-09 13:03:49 +00:00
|
|
|
|
|
|
|
|
2023-03-09 13:21:32 +00:00
|
|
|
# ECC-1542: Invalid pl array in a Gaussian grid
|
|
|
|
# -----------------------------------------------
|
2023-03-09 13:03:49 +00:00
|
|
|
sample1=$ECCODES_SAMPLES_PATH/reduced_gg_pl_32_grib1.tmpl
|
|
|
|
sample2=$ECCODES_SAMPLES_PATH/reduced_gg_pl_32_grib2.tmpl
|
|
|
|
tempGrib=temp.$label.grib
|
|
|
|
tempText=temp.$label.txt
|
2023-03-09 13:21:32 +00:00
|
|
|
tempFilt=temp.$label.filt
|
|
|
|
|
2023-03-09 13:03:49 +00:00
|
|
|
# Insert a zero into the pl array
|
2023-03-09 13:21:32 +00:00
|
|
|
cat > $tempFilt <<EOF
|
2023-03-09 13:03:49 +00:00
|
|
|
meta pli element(pl, 3);
|
|
|
|
set pli = 0;
|
|
|
|
write;
|
|
|
|
EOF
|
|
|
|
|
2023-03-09 13:21:32 +00:00
|
|
|
${tools_dir}/grib_filter -o $tempGrib $tempFilt $sample2
|
2023-03-09 13:03:49 +00:00
|
|
|
set +e
|
|
|
|
${tools_dir}/grib_get -p numberOfDataPointsExpected $tempGrib > $tempText 2>&1
|
|
|
|
status=$?
|
|
|
|
set -e
|
|
|
|
[ $status -ne 0 ]
|
|
|
|
grep -q "Invalid pl array: entry at index=3 is zero" $tempText
|
|
|
|
|
2024-07-12 19:08:03 +00:00
|
|
|
if [ $HAVE_GEOGRAPHY -eq 1 ]; then
|
|
|
|
${tools_dir}/grib_filter -o $tempGrib $tempFilt $sample1
|
|
|
|
set +e
|
|
|
|
${tools_dir}/grib_get -l 0,0 $tempGrib > $tempText 2>&1
|
|
|
|
status=$?
|
|
|
|
set -e
|
|
|
|
[ $status -ne 0 ]
|
|
|
|
grep -q "Invalid pl array: entry at index=3 is zero" $tempText
|
|
|
|
fi
|
2023-03-09 13:21:32 +00:00
|
|
|
|
2023-03-09 13:03:49 +00:00
|
|
|
# Clean up
|
2023-03-09 13:21:32 +00:00
|
|
|
rm -f $tempGrib $tempText $tempFilt
|