Testing: clean up

This commit is contained in:
Shahram Najm 2017-11-30 17:49:46 +00:00
parent f89f5c0f5d
commit 0d95c9be2c
14 changed files with 62 additions and 67 deletions

View File

@ -34,7 +34,7 @@ cat syno_multi.bufr temp_101.bufr > $fBufrInput
# Test: copy synop messages # Test: copy synop messages
#---------------------------------------------------- #----------------------------------------------------
rm -f $fBufrTmp | true rm -f $fBufrTmp
echo "Test: copy synop messages " >> $fLog echo "Test: copy synop messages " >> $fLog
${tools_dir}/bufr_copy -w dataCategory=0 $fBufrInput $fBufrTmp >> $fLog ${tools_dir}/bufr_copy -w dataCategory=0 $fBufrInput $fBufrTmp >> $fLog
@ -48,7 +48,7 @@ done
# Test: copy non-synop messages # Test: copy non-synop messages
#---------------------------------------------------- #----------------------------------------------------
rm -f $fBufrTmp | true rm -f $fBufrTmp
echo "Test: copy non-synop messages " >> $fLog echo "Test: copy non-synop messages " >> $fLog
${tools_dir}/bufr_copy -w dataCategory!=0 $fBufrInput $fBufrTmp >> $fLog ${tools_dir}/bufr_copy -w dataCategory!=0 $fBufrInput $fBufrTmp >> $fLog
@ -60,8 +60,8 @@ ${tools_dir}/bufr_copy -w dataCategory!=0 $fBufrInput $fBufrTmp >> $fLog
# Test: use the square brackets to insert the value of a key # Test: use the square brackets to insert the value of a key
#------------------------------------------------------------------- #-------------------------------------------------------------------
rm -f ${fBufrTmp} | true rm -f ${fBufrTmp}
rm -f ${fBufrTmp}_*.bufr | true rm -f ${fBufrTmp}_*.bufr
echo "Test: use the square brackets to insert the value of a key " >> $fLog echo "Test: use the square brackets to insert the value of a key " >> $fLog
${tools_dir}/bufr_copy $fBufrInput ${fBufrTmp}_[dataCategory].bufr >> $fLog ${tools_dir}/bufr_copy $fBufrInput ${fBufrTmp}_[dataCategory].bufr >> $fLog
@ -69,11 +69,9 @@ ${tools_dir}/bufr_copy $fBufrInput ${fBufrTmp}_[dataCategory].bufr >> $fLog
[ -s ${fBufrTmp}_0.bufr ] [ -s ${fBufrTmp}_0.bufr ]
[ -s ${fBufrTmp}_2.bufr ] [ -s ${fBufrTmp}_2.bufr ]
rm -f ${fBufrTmp}_*.bufr | true rm -f ${fBufrTmp}_*.bufr
#Clean up #Clean up
rm -f $fLog rm -f $fLog
rm -f $fBufrTmp | true rm -f $fBufrTmp
rm -f $fBufrInput | true rm -f $fBufrInput

View File

@ -55,7 +55,7 @@ unset ECCODES_LOG_STREAM
#echo "Test: malformed bufr file " >> $fLog #echo "Test: malformed bufr file " >> $fLog
#rm -f $fJsonTmp | true #rm -f $fJsonTmp
#fBufr=${data_dir}/bufr/"bad.bufr" #fBufr=${data_dir}/bufr/"bad.bufr"
# See ECC-276 # See ECC-276
@ -72,7 +72,7 @@ unset ECCODES_LOG_STREAM
# FIND another way to test this operator # FIND another way to test this operator
#echo "Test: operator 207003 " >> $fLog #echo "Test: operator 207003 " >> $fLog
#rm -f $fJsonTmp | true #rm -f $fJsonTmp
#fBufr=${data_dir}/bufr/"207003.bufr" #fBufr=${data_dir}/bufr/"207003.bufr"
#fJsonRef=${data_dir}/bufr/"207003.bufr.json.ref" #fJsonRef=${data_dir}/bufr/"207003.bufr.json.ref"
@ -83,6 +83,6 @@ unset ECCODES_LOG_STREAM
# #
#Clean up #Clean up
#rm -f $fLog #rm -f $fLog
#rm -f $fJsonTmp | true #rm -f $fJsonTmp
rm -f $fLog rm -f $fLog

View File

@ -76,7 +76,7 @@ if (statid == 1003) {
} }
EOF EOF
rm -f $fBufrTmp | true rm -f $fBufrTmp
f="syno_multi.bufr" f="syno_multi.bufr"
echo "Test: filter SYNOP message according to conditions" >> $fLog echo "Test: filter SYNOP message according to conditions" >> $fLog
@ -616,7 +616,7 @@ set year=2001;
set airTemperatureAt2M=234.5; set airTemperatureAt2M=234.5;
EOF EOF
rm -f $fBufrTmp | true rm -f $fBufrTmp
f="syno_1.bufr" f="syno_1.bufr"
echo "Test: setting keys" >> $fLog echo "Test: setting keys" >> $fLog
@ -634,7 +634,7 @@ EOF
#Clean up #Clean up
rm -f ${dSplit}/* rm -f ${dSplit}/*
rm -f $fLog $fRules rm -f $fLog $fRules
rm -f $fBufrTmp | true rm -f $fBufrTmp
#----------------------------------------------------------- #-----------------------------------------------------------
# Test: set unexpandedDescriptors no create new data # Test: set unexpandedDescriptors no create new data

View File

@ -30,7 +30,7 @@ fBufrTmp=${label}".bufr.tmp"
# Test: setting header for single message file # Test: setting header for single message file
#---------------------------------------------------- #----------------------------------------------------
rm -f $fBufrTmp | true rm -f $fBufrTmp
f="syno_1.bufr" f="syno_1.bufr"
echo "Test: setting header for single message file" >> $fLog echo "Test: setting header for single message file" >> $fLog
@ -44,7 +44,7 @@ centre=`${tools_dir}/bufr_get -p bufrHeaderCentre $fBufrTmp`
# Test: setting header for multi-message file # Test: setting header for multi-message file
#---------------------------------------------------- #----------------------------------------------------
rm -f $fBufrTmp | true rm -f $fBufrTmp
f="syno_multi.bufr" f="syno_multi.bufr"
echo "Test: setting header for multi-message file" >> $fLog echo "Test: setting header for multi-message file" >> $fLog
@ -63,7 +63,7 @@ done
#TODO: when ECC-37 is fixed we need to enable it. #TODO: when ECC-37 is fixed we need to enable it.
rm -f $fBufrTmp | true rm -f $fBufrTmp
f="syno_1.bufr" f="syno_1.bufr"
echo "Test: setting data values" >> $fLog echo "Test: setting data values" >> $fLog
@ -80,7 +80,7 @@ echo "file: $f" >> $fLog
#TODO: when ECC-37 is fixed we need to enable it. #TODO: when ECC-37 is fixed we need to enable it.
rm -f $fBufrTmp | true rm -f $fBufrTmp
f="syno_multi.bufr" f="syno_multi.bufr"
echo "Test: setting data values for multi-message file" >> $fLog echo "Test: setting data values for multi-message file" >> $fLog
@ -163,4 +163,4 @@ set -e
#Clean up #Clean up
rm -f $fLog rm -f $fLog
rm -f $fBufrTmp | true rm -f $fBufrTmp

View File

@ -23,7 +23,7 @@ packing2="
grid_simple_matrix" grid_simple_matrix"
temp=temp.grib_ temp=temp.grib_
rm -f $temp || true rm -f $temp
# --- test changing the packing # --- test changing the packing
# arg 1 : input grib file # arg 1 : input grib file
@ -51,7 +51,7 @@ function test_packing() {
shift shift
done done
rm -f $temp || true rm -f $temp
} }
test_packing $grib1 $packing1 test_packing $grib1 $packing1

View File

@ -32,7 +32,7 @@ for f in $files
do do
file=${data_dir}/$f file=${data_dir}/$f
output=${file}.grib1_ output=${file}.grib1_
rm -f ${output} || true rm -f ${output}
${tools_dir}/grib_set -s editionNumber=1 ${file}.grib2 ${output} 2> $REDIRECT > $REDIRECT ${tools_dir}/grib_set -s editionNumber=1 ${file}.grib2 ${output} 2> $REDIRECT > $REDIRECT
grib1Statistics=`${tools_dir}/grib_get -fp numberOfValues,numberOfPoints,max,min,average,numberOfMissing ${output}` grib1Statistics=`${tools_dir}/grib_get -fp numberOfValues,numberOfPoints,max,min,average,numberOfMissing ${output}`
@ -50,7 +50,7 @@ done
# First create a grib2 file with NV () > 255 which should not be convertible to grib1 # First create a grib2 file with NV () > 255 which should not be convertible to grib1
filter=temp.setpv.filt filter=temp.setpv.filt
COUNT=264 COUNT=264
rm -f $filter || true rm -f $filter
echo "set NV=$COUNT;" >> $filter echo "set NV=$COUNT;" >> $filter
echo "set pv={" >> $filter echo "set pv={" >> $filter
i=1 i=1
@ -73,4 +73,4 @@ if [ $? -eq 0 ]; then
exit 1 exit 1
fi fi
set -e set -e
rm -f $filter temp.pv.grib2 || true rm -f $filter temp.pv.grib2

View File

@ -83,6 +83,6 @@ do
false false
exit exit
fi fi
rm -f $tmp | true rm -f $tmp
done done

View File

@ -65,7 +65,7 @@ ${tools_dir}/grib_ls -plevels tmp_rlls.grib1 | grep MISSING>/dev/null
${tools_dir}/grib_set -s typeOfLevel=depthBelowLandLayer,bottomLevel=missing regular_latlon_surface.grib1 tmp_rlls.grib1 ${tools_dir}/grib_set -s typeOfLevel=depthBelowLandLayer,bottomLevel=missing regular_latlon_surface.grib1 tmp_rlls.grib1
${tools_dir}/grib_ls -plevels tmp_rlls.grib1 | grep MISSING>/dev/null ${tools_dir}/grib_ls -plevels tmp_rlls.grib1 | grep MISSING>/dev/null
rm -f tmp_rlls.grib1 | true rm -f tmp_rlls.grib1
# GRIB-305. GRIB edition 1 file with one large message # GRIB-305. GRIB edition 1 file with one large message
if [ -f "sst_globus0083.grib" ]; then if [ -f "sst_globus0083.grib" ]; then

View File

@ -15,11 +15,11 @@ temp=loc.padding.grib1
${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 $temp
cat > $$_f <<EOF cat > $$_f <<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";
assert(0); assert(0);
} }
EOF 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
@ -34,14 +34,16 @@ localDefinitions=`find ${def_dir}/grib1/ -name 'local.98.*def' | sed -e 's:.*/::
for l1 in $localDefinitions for l1 in $localDefinitions
do do
${tools_dir}/grib_set -s localDefinitionNumber=$l1 $temp locx.grib1 ${tools_dir}/grib_set -s localDefinitionNumber=$l1 $temp locx.grib1
${tools_dir}/grib_filter $$_f locx.grib1 ${tools_dir}/grib_filter $$_f locx.grib1
for l2 in $localDefinitions for l2 in $localDefinitions
do do
#echo "$l1 -> $l2" if [ $l1 -ne $l2 ]; then
${tools_dir}/grib_set -s localDefinitionNumber=$l2 locx.grib1 locy.grib1 #echo "$l1 -> $l2"
${tools_dir}/grib_filter $$_f locy.grib1 ${tools_dir}/grib_set -s localDefinitionNumber=$l2 locx.grib1 locy.grib1
done ${tools_dir}/grib_filter $$_f locy.grib1
fi
done
done done
rm -f $$_f locx.grib1 locy.grib1 $temp rm -f $$_f locx.grib1 locy.grib1 $temp

View File

@ -15,7 +15,7 @@ REDIRECT=/dev/null
infile=${data_dir}/regular_gaussian_surface.grib1 infile=${data_dir}/regular_gaussian_surface.grib1
outfile=${data_dir}/set.grib1 outfile=${data_dir}/set.grib1
rm -f $outfile || true rm -f $outfile
${tools_dir}/grib_set -v -p levtype,centre,levtype:l,centre:l -s levtype=pl,centre=80 $infile $outfile >$REDIRECT ${tools_dir}/grib_set -v -p levtype,centre,levtype:l,centre:l -s levtype=pl,centre=80 $infile $outfile >$REDIRECT
@ -31,12 +31,12 @@ levtype=`${tools_dir}/grib_get -p levtype:l $outfile`
centre=`${tools_dir}/grib_get -p centre:l $outfile` centre=`${tools_dir}/grib_get -p centre:l $outfile`
[ $centre -eq 80 ] [ $centre -eq 80 ]
rm -f $outfile || true rm -f $outfile
infile=${data_dir}/regular_gaussian_surface.grib2 infile=${data_dir}/regular_gaussian_surface.grib2
outfile=${data_dir}/set.grib2 outfile=${data_dir}/set.grib2
rm -f $outfile || true rm -f $outfile
${tools_dir}/grib_set -v -p levtype:l,centre:s -s levtype:l=100,centre:s=cnmc $infile $outfile >$REDIRECT ${tools_dir}/grib_set -v -p levtype:l,centre:s -s levtype:l=100,centre:s=cnmc $infile $outfile >$REDIRECT
@ -73,4 +73,4 @@ ${tools_dir}/grib_set -s centre=289 $ECCODES_SAMPLES_PATH/GRIB2.tmpl $outfile
${tools_dir}/grib_dump -O $outfile | grep -q 'centre = 289.*Zambia' ${tools_dir}/grib_dump -O $outfile | grep -q 'centre = 289.*Zambia'
rm -f $outfile || true rm -f $outfile

View File

@ -15,7 +15,7 @@
set +e set +e
tmp_out=tmp_msg.out tmp_out=tmp_msg.out
skip_test=0 skip_test=0
rm -f $tmp_out | true rm -f $tmp_out
# Invoke the grib_to_netcdf command with no options. If NetCDF was enabled # Invoke the grib_to_netcdf command with no options. If NetCDF was enabled
# we get a usage message otherwise we get a specific message. Note: In both cases # we get a usage message otherwise we get a specific message. Note: In both cases
# the command fails. # the command fails.
@ -27,7 +27,7 @@ if [ $? -eq 0 ]; then
fi fi
# Restore the set -e so any error causes us to exit # Restore the set -e so any error causes us to exit
set -e set -e
rm -f $tmp_out | true rm -f $tmp_out
if [ $skip_test -eq 1 ]; then if [ $skip_test -eq 1 ]; then
echo "NetCDF was not enabled. Skipping this test." echo "NetCDF was not enabled. Skipping this test."
exit 0 exit 0
@ -51,7 +51,7 @@ for dt in $ncf_types
do do
for f in $grib_files for f in $grib_files
do do
rm -f $tmp_netcdf | true rm -f $tmp_netcdf
if [ -f "${data_dir}/$f" ]; then if [ -f "${data_dir}/$f" ]; then
${tools_dir}/grib_to_netcdf -D $dt -o $tmp_netcdf ${data_dir}/$f >/dev/null ${tools_dir}/grib_to_netcdf -D $dt -o $tmp_netcdf ${data_dir}/$f >/dev/null
${tools_dir}/grib_to_netcdf -T -o $tmp_netcdf ${data_dir}/$f >/dev/null ${tools_dir}/grib_to_netcdf -T -o $tmp_netcdf ${data_dir}/$f >/dev/null
@ -67,5 +67,4 @@ ${tools_dir}/grib_to_netcdf -k 2 -o $tmp_netcdf $input >/dev/null
#${tools_dir}/grib_to_netcdf -k 3 -o $tmp_netcdf $input >/dev/null #${tools_dir}/grib_to_netcdf -k 3 -o $tmp_netcdf $input >/dev/null
#${tools_dir}/grib_to_netcdf -k 4 -o $tmp_netcdf $input >/dev/null #${tools_dir}/grib_to_netcdf -k 4 -o $tmp_netcdf $input >/dev/null
rm -f $tmp_netcdf | true rm -f $tmp_netcdf

View File

@ -30,6 +30,6 @@ do
${tools_dir}/grib_get -M -p count,shortName,level $infile > $out2 ${tools_dir}/grib_get -M -p count,shortName,level $infile > $out2
diff $out1 $out2 diff $out1 $out2
rm -f $out1 $out2 | true rm -f $out1 $out2
done done

View File

@ -25,7 +25,7 @@ do
ref_num=$file.num.ref ref_num=$file.num.ref
diff_num=$file.num.diff diff_num=$file.num.diff
rm -f $res_num | true rm -f $res_num
set +e set +e
${tools_dir}/codes_bufr_filter bufrdc_num_ref.filter $file 2> $REDIRECT > $res_num ${tools_dir}/codes_bufr_filter bufrdc_num_ref.filter $file 2> $REDIRECT > $res_num

View File

@ -23,23 +23,19 @@ temp2="temp.grib2_"
# --- Do I want to exclude any file pattern from the comparison ? # --- Do I want to exclude any file pattern from the comparison ?
exclusion_pattern="tcw|ssr|str|skt|cap|ci|ttr|st|sm|sd|slhf|sshf" exclusion_pattern="tcw|ssr|str|skt|cap|ci|ttr|st|sm|sd|slhf|sshf"
for file in ${dir}/tigge_*.grib for file in ${dir}/tigge_*.grib; do
do exclude=`echo $file | awk " /$exclusion_pattern/ {print \"found\";} "`
if [ -z "$exclude" ]; then
rm -f ${temp1} ${temp2}
exclude=`echo $file | awk " /$exclusion_pattern/ {print \"found\";} "` # 2 to 1 conversion check
${tools_dir}/grib_set -s editionNumber=1 ${file} ${temp1} 2> $REDIRECT > $REDIRECT
${tools_dir}/grib_compare -P -c data:n,geography:n ${temp1} ${file} 2> $REDIRECT > $REDIRECT
if [ -z "$exclude" ]; then # 1 to 2 conversion check
${tools_dir}/grib_set -s editionNumber=2 ${temp1} ${temp2} 2> $REDIRECT > $REDIRECT
rm -f ${temp1} ${temp2} || true ${tools_dir}/grib_compare -P -c shortName,data:n,geography:n ${temp2} ${file} 2> $REDIRECT > $REDIRECT
fi
# 2 to 1 conversion check
${tools_dir}/grib_set -s editionNumber=1 ${file} ${temp1} 2> $REDIRECT > $REDIRECT
${tools_dir}/grib_compare -P -c data:n,geography:n ${temp1} ${file} 2> $REDIRECT > $REDIRECT
# 1 to 2 conversion check
${tools_dir}/grib_set -s editionNumber=2 ${temp1} ${temp2} 2> $REDIRECT > $REDIRECT
${tools_dir}/grib_compare -P -c shortName,data:n,geography:n ${temp2} ${file} 2> $REDIRECT > $REDIRECT
fi
done done
rm -f ${temp1} ${temp2} || true rm -f ${temp1} ${temp2}