mirror of https://github.com/ecmwf/eccodes.git
Testing: Cleanup
This commit is contained in:
parent
0d4b87b271
commit
9d4d83b0f8
|
@ -10,12 +10,12 @@
|
||||||
|
|
||||||
. ./include.ctest.sh
|
. ./include.ctest.sh
|
||||||
|
|
||||||
|
label="grib_calendar_test"
|
||||||
|
|
||||||
temp1=temp1.calendar.$$
|
temp1=temp1.$label.$$
|
||||||
temp2=temp2.calendar.$$
|
temp2=temp2.$label.$$
|
||||||
sample=$ECCODES_SAMPLES_PATH/GRIB2.tmpl
|
sample=$ECCODES_SAMPLES_PATH/GRIB2.tmpl
|
||||||
|
|
||||||
|
|
||||||
${tools_dir}/grib_set -s tablesVersion=13,setCalendarId=1,typeOfCalendar=0 $sample $temp1
|
${tools_dir}/grib_set -s tablesVersion=13,setCalendarId=1,typeOfCalendar=0 $sample $temp1
|
||||||
grib_check_key_equals $temp1 calendarIdPresent 1
|
grib_check_key_equals $temp1 calendarIdPresent 1
|
||||||
grib_check_key_equals $temp1 section1Length 24
|
grib_check_key_equals $temp1 section1Length 24
|
||||||
|
|
|
@ -10,13 +10,13 @@
|
||||||
|
|
||||||
. ./include.ctest.sh
|
. ./include.ctest.sh
|
||||||
|
|
||||||
tmpdata=grib_multi.$$.grib
|
label="grib_multi_test"
|
||||||
|
tmpdata=temp.$label.$$.grib
|
||||||
rm -f $tmpdata
|
rm -f $tmpdata
|
||||||
|
|
||||||
parameterNumber=`${tools_dir}/grib_get -p parameterNumber -w parameterCategory=2,parameterNumber=3 ${data_dir}/multi.grib2`
|
parameterNumber=`${tools_dir}/grib_get -p parameterNumber -w parameterCategory=2,parameterNumber=3 ${data_dir}/multi.grib2`
|
||||||
if [ -z "$parameterNumber" ]
|
if [ -z "$parameterNumber" ]; then
|
||||||
then
|
echo '---------- grib_get failure'
|
||||||
echo ---------- grib_get failure
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -30,9 +30,8 @@ if ( parameterCategory==2 && parameterNumber==3) {
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
parameterNumber=`${tools_dir}/grib_filter $tmpdata.rules ${data_dir}/multi.grib2`
|
parameterNumber=`${tools_dir}/grib_filter $tmpdata.rules ${data_dir}/multi.grib2`
|
||||||
if [ -z "$parameterNumber" ]
|
if [ -z "$parameterNumber" ]; then
|
||||||
then
|
echo '---------- grib_filter failure'
|
||||||
echo ---------- grib_filter failure
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -10,11 +10,13 @@
|
||||||
|
|
||||||
. ./include.ctest.sh
|
. ./include.ctest.sh
|
||||||
|
|
||||||
|
label="grib_padding_test"
|
||||||
REDIRECT=/dev/null
|
REDIRECT=/dev/null
|
||||||
temp=loc.padding.grib1
|
tempGrib=temp.local.$label.grib1
|
||||||
|
tempFilt=temp.local.$label.filt
|
||||||
|
|
||||||
${tools_dir}/grib_set -s setLocalDefinition=1 ${data_dir}/regular_latlon_surface.grib1 $temp
|
${tools_dir}/grib_set -s setLocalDefinition=1 ${data_dir}/regular_latlon_surface.grib1 $tempGrib
|
||||||
cat > $$_f <<EOF
|
cat > $tempFilt <<EOF
|
||||||
if (GRIBEXSection1Problem ) {
|
if (GRIBEXSection1Problem ) {
|
||||||
print "localDefinitionNumber=[localDefinitionNumber] size(GRIBEX-section1)=[GRIBEXSection1Problem] section1Length=[section1Length]";
|
print "localDefinitionNumber=[localDefinitionNumber] size(GRIBEX-section1)=[GRIBEXSection1Problem] section1Length=[section1Length]";
|
||||||
write "problem.grib";
|
write "problem.grib";
|
||||||
|
@ -24,27 +26,32 @@ EOF
|
||||||
|
|
||||||
# Note: we cannot use -printf "%f\n" as on some unix platforms -printf is not an option
|
# Note: we cannot use -printf "%f\n" as on some unix platforms -printf is not an option
|
||||||
# for find. So instead we use sed to get to the filename without the fullpath
|
# for find. So instead we use sed to get to the filename without the fullpath
|
||||||
localDefinitions=`find ${def_dir}/grib1/ -name 'local.98.*def' | sed -e 's:.*/::' |\
|
localDefinitions=`find ${def_dir}/grib1/ -name 'local.98.*.def' | sed -e 's:.*/::' |\
|
||||||
awk 'BEGIN {FS=".";} {print $3;}' |\
|
awk 'BEGIN {FS=".";} {print $3;}' |\
|
||||||
grep -v def |\
|
grep -v def |\
|
||||||
sed '/245/d' |\
|
sed '/245/d' |\
|
||||||
sed '/12/d' |\
|
sed '/12/d' |\
|
||||||
|
sed '/50/d' |\
|
||||||
sed '/244/d' |\
|
sed '/244/d' |\
|
||||||
|
sed '/190/d' |\
|
||||||
|
sed '/191/d' |\
|
||||||
sed '/192/d' |\
|
sed '/192/d' |\
|
||||||
xargs`
|
xargs`
|
||||||
|
|
||||||
|
count=0
|
||||||
for l1 in $localDefinitions
|
for l1 in $localDefinitions
|
||||||
do
|
do
|
||||||
${tools_dir}/grib_set -M -s localDefinitionNumber=$l1 $temp locx.grib1
|
${tools_dir}/grib_set -M -s localDefinitionNumber=$l1 $tempGrib locx.grib1
|
||||||
${tools_dir}/grib_filter -M $$_f locx.grib1
|
${tools_dir}/grib_filter -M $tempFilt locx.grib1
|
||||||
for l2 in $localDefinitions
|
for l2 in $localDefinitions
|
||||||
do
|
do
|
||||||
if [ $l1 -ne $l2 ]; then
|
if [ $l1 -ne $l2 ]; then
|
||||||
#echo "$l1 -> $l2"
|
#echo "$l1 -> $l2"
|
||||||
${tools_dir}/grib_set -M -s localDefinitionNumber=$l2 locx.grib1 locy.grib1
|
${tools_dir}/grib_set -M -s localDefinitionNumber=$l2 locx.grib1 locy.grib1
|
||||||
${tools_dir}/grib_filter -M $$_f locy.grib1
|
${tools_dir}/grib_filter -M $tempFilt locy.grib1
|
||||||
|
count=$((count+1))
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
echo Did $count iterations
|
||||||
rm -f $$_f locx.grib1 locy.grib1 $temp
|
rm -f locx.grib1 locy.grib1 $tempGrib $tempFilt
|
||||||
|
|
|
@ -20,7 +20,7 @@ int main(int argc, char** argv)
|
||||||
FILE* in = NULL;
|
FILE* in = NULL;
|
||||||
const char* infile = "../data/test_uuid.grib2";
|
const char* infile = "../data/test_uuid.grib2";
|
||||||
FILE* out = NULL;
|
FILE* out = NULL;
|
||||||
const char* outfile = "temp.grib_set_bytes.grib";
|
const char* outfile = "temp.grib_set_bytes_test.grib";
|
||||||
grib_handle* h = NULL;
|
grib_handle* h = NULL;
|
||||||
const void* buffer = NULL;
|
const void* buffer = NULL;
|
||||||
|
|
||||||
|
|
|
@ -9,14 +9,17 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
. ./include.ctest.sh
|
. ./include.ctest.sh
|
||||||
TEMP_ERR=temp.grib_set_bytes.log
|
|
||||||
TEMP_OUT=temp.grib_set_bytes.grib
|
|
||||||
|
|
||||||
$EXEC ${test_dir}/grib_set_bytes 2>$TEMP_ERR
|
label="grib_set_bytes_test"
|
||||||
|
|
||||||
grep -q "Wrong size.*for uuidOfVGrid. It is 16 bytes long" $TEMP_ERR
|
tempErr=temp.$label.log
|
||||||
|
tempOut=temp.$label.grib
|
||||||
|
|
||||||
uuid=`${tools_dir}/grib_get -p uuidOfVGrid $TEMP_OUT`
|
$EXEC ${test_dir}/grib_set_bytes 2>$tempErr
|
||||||
|
|
||||||
|
grep -q "Wrong size.*for uuidOfVGrid. It is 16 bytes long" $tempErr
|
||||||
|
|
||||||
|
uuid=`${tools_dir}/grib_get -p uuidOfVGrid $tempOut`
|
||||||
[ "$uuid" = "07204051072040510720405207204053" ]
|
[ "$uuid" = "07204051072040510720405207204053" ]
|
||||||
|
|
||||||
rm -f $TEMP_OUT $TEMP_ERR
|
rm -f $tempOut $tempErr
|
||||||
|
|
|
@ -10,7 +10,10 @@
|
||||||
|
|
||||||
. ./include.ctest.sh
|
. ./include.ctest.sh
|
||||||
|
|
||||||
TEMP=output.grib_sh_imag.grib
|
# Check that first coefficient have an imaginary part equal to zero.
|
||||||
$EXEC ${test_dir}/grib_sh_imag $TEMP
|
# philippe.marguinaud@meteo.fr, 2016/02
|
||||||
|
|
||||||
rm -f $TEMP
|
tempGrib=output.grib_sh_imag.grib
|
||||||
|
$EXEC ${test_dir}/grib_sh_imag $tempGrib
|
||||||
|
|
||||||
|
rm -f $tempGrib
|
||||||
|
|
|
@ -10,24 +10,24 @@
|
||||||
|
|
||||||
. ./include.ctest.sh
|
. ./include.ctest.sh
|
||||||
|
|
||||||
|
label="grib_statistics_test"
|
||||||
|
temp1=temp1.$label.grib
|
||||||
|
temp2=temp2.$label.grib
|
||||||
|
|
||||||
files="regular_latlon_surface.grib2 regular_latlon_surface.grib1"
|
files="regular_latlon_surface.grib2 regular_latlon_surface.grib1"
|
||||||
|
|
||||||
for file in $files
|
for file in $files; do
|
||||||
do
|
|
||||||
|
|
||||||
cat >statistics.filter<<EOF
|
cat >statistics.filter<<EOF
|
||||||
set Ni=2;
|
set Ni=2;
|
||||||
set Nj=2;
|
set Nj=2;
|
||||||
|
|
||||||
set decimalPrecision=4;
|
set decimalPrecision=4;
|
||||||
set values={2.0,2.0,2.0,2.0};
|
set values={2.0,2.0,2.0,2.0};
|
||||||
print "values=[values]";
|
print "values=[values]";
|
||||||
print "max=[max] min=[min] average=[average]";
|
print "max=[max] min=[min] average=[average]";
|
||||||
|
|
||||||
set values={2.0,5.0,2.0,2.0};
|
set values={2.0,5.0,2.0,2.0};
|
||||||
print "values=[values]";
|
print "values=[values]";
|
||||||
print "max=[max] min=[min] average=[average]";
|
print "max=[max] min=[min] average=[average]";
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
${tools_dir}/grib_filter statistics.filter ${data_dir}/$file > statistics.out
|
${tools_dir}/grib_filter statistics.filter ${data_dir}/$file > statistics.out
|
||||||
|
@ -42,8 +42,6 @@ rm -f statistics.out statistics.filter
|
||||||
# See ECC-478
|
# See ECC-478
|
||||||
# ---------------------------------------------------
|
# ---------------------------------------------------
|
||||||
input=${data_dir}/lfpw.grib1
|
input=${data_dir}/lfpw.grib1
|
||||||
temp1=temp1.statistics.grib
|
|
||||||
temp2=temp2.statistics.grib
|
|
||||||
stats=`${tools_dir}/grib_get -w count=50 -F%.2f -n statistics $input`
|
stats=`${tools_dir}/grib_get -w count=50 -F%.2f -n statistics $input`
|
||||||
[ "$stats" = "10098.00 0.00 1064.19 3066.07 2.57 4.61 0.00" ]
|
[ "$stats" = "10098.00 0.00 1064.19 3066.07 2.57 4.61 0.00" ]
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue