diff --git a/tests/bufr_copy.sh b/tests/bufr_copy.sh index 81c3c7afc..751e42f55 100755 --- a/tests/bufr_copy.sh +++ b/tests/bufr_copy.sh @@ -34,7 +34,7 @@ cat syno_multi.bufr temp_101.bufr > $fBufrInput # Test: copy synop messages #---------------------------------------------------- -rm -f $fBufrTmp | true +rm -f $fBufrTmp echo "Test: copy synop messages " >> $fLog ${tools_dir}/bufr_copy -w dataCategory=0 $fBufrInput $fBufrTmp >> $fLog @@ -48,7 +48,7 @@ done # Test: copy non-synop messages #---------------------------------------------------- -rm -f $fBufrTmp | true +rm -f $fBufrTmp echo "Test: copy non-synop messages " >> $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 #------------------------------------------------------------------- -rm -f ${fBufrTmp} | true -rm -f ${fBufrTmp}_*.bufr | true +rm -f ${fBufrTmp} +rm -f ${fBufrTmp}_*.bufr echo "Test: use the square brackets to insert the value of a key " >> $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}_2.bufr ] -rm -f ${fBufrTmp}_*.bufr | true +rm -f ${fBufrTmp}_*.bufr #Clean up rm -f $fLog -rm -f $fBufrTmp | true -rm -f $fBufrInput | true - - +rm -f $fBufrTmp +rm -f $fBufrInput diff --git a/tests/bufr_dump.sh b/tests/bufr_dump.sh index 0cf6b128c..7ea38abff 100755 --- a/tests/bufr_dump.sh +++ b/tests/bufr_dump.sh @@ -55,7 +55,7 @@ unset ECCODES_LOG_STREAM #echo "Test: malformed bufr file " >> $fLog -#rm -f $fJsonTmp | true +#rm -f $fJsonTmp #fBufr=${data_dir}/bufr/"bad.bufr" # See ECC-276 @@ -72,7 +72,7 @@ unset ECCODES_LOG_STREAM # FIND another way to test this operator #echo "Test: operator 207003 " >> $fLog -#rm -f $fJsonTmp | true +#rm -f $fJsonTmp #fBufr=${data_dir}/bufr/"207003.bufr" #fJsonRef=${data_dir}/bufr/"207003.bufr.json.ref" @@ -83,6 +83,6 @@ unset ECCODES_LOG_STREAM # #Clean up #rm -f $fLog -#rm -f $fJsonTmp | true +#rm -f $fJsonTmp rm -f $fLog diff --git a/tests/bufr_filter.sh b/tests/bufr_filter.sh index 37c48aba2..047676844 100755 --- a/tests/bufr_filter.sh +++ b/tests/bufr_filter.sh @@ -76,7 +76,7 @@ if (statid == 1003) { } EOF -rm -f $fBufrTmp | true +rm -f $fBufrTmp f="syno_multi.bufr" echo "Test: filter SYNOP message according to conditions" >> $fLog @@ -616,7 +616,7 @@ set year=2001; set airTemperatureAt2M=234.5; EOF -rm -f $fBufrTmp | true +rm -f $fBufrTmp f="syno_1.bufr" echo "Test: setting keys" >> $fLog @@ -634,7 +634,7 @@ EOF #Clean up rm -f ${dSplit}/* rm -f $fLog $fRules -rm -f $fBufrTmp | true +rm -f $fBufrTmp #----------------------------------------------------------- # Test: set unexpandedDescriptors no create new data diff --git a/tests/bufr_set.sh b/tests/bufr_set.sh index 66230159e..17165f41e 100755 --- a/tests/bufr_set.sh +++ b/tests/bufr_set.sh @@ -30,7 +30,7 @@ fBufrTmp=${label}".bufr.tmp" # Test: setting header for single message file #---------------------------------------------------- -rm -f $fBufrTmp | true +rm -f $fBufrTmp f="syno_1.bufr" 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 #---------------------------------------------------- -rm -f $fBufrTmp | true +rm -f $fBufrTmp f="syno_multi.bufr" 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. -rm -f $fBufrTmp | true +rm -f $fBufrTmp f="syno_1.bufr" 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. -rm -f $fBufrTmp | true +rm -f $fBufrTmp f="syno_multi.bufr" echo "Test: setting data values for multi-message file" >> $fLog @@ -163,4 +163,4 @@ set -e #Clean up rm -f $fLog -rm -f $fBufrTmp | true +rm -f $fBufrTmp diff --git a/tests/change_packing.sh b/tests/change_packing.sh index de559d8f9..94b18c18e 100755 --- a/tests/change_packing.sh +++ b/tests/change_packing.sh @@ -23,7 +23,7 @@ packing2=" grid_simple_matrix" temp=temp.grib_ -rm -f $temp || true +rm -f $temp # --- test changing the packing # arg 1 : input grib file @@ -51,7 +51,7 @@ function test_packing() { shift done - rm -f $temp || true + rm -f $temp } test_packing $grib1 $packing1 diff --git a/tests/grib2to1.sh b/tests/grib2to1.sh index 5697d6a09..add547ac5 100755 --- a/tests/grib2to1.sh +++ b/tests/grib2to1.sh @@ -32,7 +32,7 @@ for f in $files do file=${data_dir}/$f output=${file}.grib1_ - rm -f ${output} || true + rm -f ${output} ${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}` @@ -50,7 +50,7 @@ done # First create a grib2 file with NV () > 255 which should not be convertible to grib1 filter=temp.setpv.filt COUNT=264 -rm -f $filter || true +rm -f $filter echo "set NV=$COUNT;" >> $filter echo "set pv={" >> $filter i=1 @@ -73,4 +73,4 @@ if [ $? -eq 0 ]; then exit 1 fi set -e -rm -f $filter temp.pv.grib2 || true +rm -f $filter temp.pv.grib2 diff --git a/tests/grib_concept.sh b/tests/grib_concept.sh index 59c306014..f55bc74bc 100755 --- a/tests/grib_concept.sh +++ b/tests/grib_concept.sh @@ -83,6 +83,6 @@ do false exit fi - rm -f $tmp | true + rm -f $tmp done diff --git a/tests/grib_ls.sh b/tests/grib_ls.sh index d0fef07e1..2aa71ef07 100755 --- a/tests/grib_ls.sh +++ b/tests/grib_ls.sh @@ -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_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 if [ -f "sst_globus0083.grib" ]; then diff --git a/tests/grib_padding.sh b/tests/grib_padding.sh index ee9c794ca..defef832b 100755 --- a/tests/grib_padding.sh +++ b/tests/grib_padding.sh @@ -15,11 +15,11 @@ temp=loc.padding.grib1 ${tools_dir}/grib_set -s setLocalDefinition=1 ${data_dir}/regular_latlon_surface.grib1 $temp cat > $$_f < $l2" - ${tools_dir}/grib_set -s localDefinitionNumber=$l2 locx.grib1 locy.grib1 - ${tools_dir}/grib_filter $$_f locy.grib1 - done + ${tools_dir}/grib_set -s localDefinitionNumber=$l1 $temp locx.grib1 + ${tools_dir}/grib_filter $$_f locx.grib1 + for l2 in $localDefinitions + do + if [ $l1 -ne $l2 ]; then + #echo "$l1 -> $l2" + ${tools_dir}/grib_set -s localDefinitionNumber=$l2 locx.grib1 locy.grib1 + ${tools_dir}/grib_filter $$_f locy.grib1 + fi + done done rm -f $$_f locx.grib1 locy.grib1 $temp diff --git a/tests/grib_set.sh b/tests/grib_set.sh index e3da95c49..d428f823f 100755 --- a/tests/grib_set.sh +++ b/tests/grib_set.sh @@ -15,7 +15,7 @@ REDIRECT=/dev/null infile=${data_dir}/regular_gaussian_surface.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 @@ -31,12 +31,12 @@ levtype=`${tools_dir}/grib_get -p levtype:l $outfile` centre=`${tools_dir}/grib_get -p centre:l $outfile` [ $centre -eq 80 ] -rm -f $outfile || true +rm -f $outfile infile=${data_dir}/regular_gaussian_surface.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 @@ -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' -rm -f $outfile || true +rm -f $outfile diff --git a/tests/grib_to_netcdf.sh b/tests/grib_to_netcdf.sh index 4e77bd36f..ac111c51e 100755 --- a/tests/grib_to_netcdf.sh +++ b/tests/grib_to_netcdf.sh @@ -15,7 +15,7 @@ set +e tmp_out=tmp_msg.out 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 # we get a usage message otherwise we get a specific message. Note: In both cases # the command fails. @@ -27,7 +27,7 @@ if [ $? -eq 0 ]; then fi # Restore the set -e so any error causes us to exit set -e -rm -f $tmp_out | true +rm -f $tmp_out if [ $skip_test -eq 1 ]; then echo "NetCDF was not enabled. Skipping this test." exit 0 @@ -51,7 +51,7 @@ for dt in $ncf_types do for f in $grib_files do - rm -f $tmp_netcdf | true + rm -f $tmp_netcdf 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 -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 4 -o $tmp_netcdf $input >/dev/null -rm -f $tmp_netcdf | true - +rm -f $tmp_netcdf diff --git a/tests/multi_from_message.sh b/tests/multi_from_message.sh index 4b3b72e09..219c6a20f 100755 --- a/tests/multi_from_message.sh +++ b/tests/multi_from_message.sh @@ -30,6 +30,6 @@ do ${tools_dir}/grib_get -M -p count,shortName,level $infile > $out2 diff $out1 $out2 - rm -f $out1 $out2 | true + rm -f $out1 $out2 done diff --git a/tests/mybufrdc_ref.sh b/tests/mybufrdc_ref.sh index 252295d0d..0b09764f3 100755 --- a/tests/mybufrdc_ref.sh +++ b/tests/mybufrdc_ref.sh @@ -25,7 +25,7 @@ do ref_num=$file.num.ref diff_num=$file.num.diff - rm -f $res_num | true + rm -f $res_num set +e ${tools_dir}/codes_bufr_filter bufrdc_num_ref.filter $file 2> $REDIRECT > $res_num diff --git a/tests/tigge_conversions.sh b/tests/tigge_conversions.sh index eeaf7985b..48957360b 100755 --- a/tests/tigge_conversions.sh +++ b/tests/tigge_conversions.sh @@ -23,23 +23,19 @@ temp2="temp.grib2_" # --- 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" -for file in ${dir}/tigge_*.grib -do +for file in ${dir}/tigge_*.grib; 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 - - rm -f ${temp1} ${temp2} || true - - # 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 + # 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 -rm -f ${temp1} ${temp2} || true +rm -f ${temp1} ${temp2}