Testing: clean up test for ECC-36

This commit is contained in:
Shahram Najm 2018-07-19 11:58:13 +01:00
parent fba00d70fe
commit b4f80b0f8a
1 changed files with 103 additions and 121 deletions

View File

@ -481,8 +481,8 @@ rm -f ${f}.ref ${f}.log
# Test: get string whose value is MISSING (ECC-650) # Test: get string whose value is MISSING (ECC-650)
#----------------------------------------------------------- #-----------------------------------------------------------
cat > $fRules <<EOF cat > $fRules <<EOF
set unpack=1; set unpack=1;
print "[shipOrMobileLandStationIdentifier]"; print "[shipOrMobileLandStationIdentifier]";
EOF EOF
f="btem_109.bufr" f="btem_109.bufr"
@ -496,10 +496,10 @@ rm -f ${f}.ref ${f}.log
# Test: get string array and stringValues # Test: get string array and stringValues
#----------------------------------------------------------- #-----------------------------------------------------------
cat > $fRules <<EOF cat > $fRules <<EOF
set unpack=1; set unpack=1;
print "[stringValues!1]"; print "[stringValues!1]";
print "===="; print "====";
print "[stationOrSiteName!1]"; print "[stationOrSiteName!1]";
EOF EOF
f="synop_multi_subset.bufr" f="synop_multi_subset.bufr"
@ -545,10 +545,8 @@ rm -f ${f}.ref ${f}.log
#----------------------------------------------------------- #-----------------------------------------------------------
# Test: with nonexistent keys. # Test: with nonexistent keys.
#----------------------------------------------------------- #-----------------------------------------------------------
#Here "centre" is misspelled!!!
cat > $fRules <<EOF cat > $fRules <<EOF
set center="98"; set center="98"; #Here centre is misspelled
EOF EOF
# Invoke without -f i.e. should fail if error encountered # Invoke without -f i.e. should fail if error encountered
@ -571,10 +569,8 @@ ${tools_dir}/codes_bufr_filter -f $fRules $f 2>>$fLog 1>>$fLog
#----------------------------------------------------------- #-----------------------------------------------------------
# Test: with not allowed key values # Test: with not allowed key values
#----------------------------------------------------------- #-----------------------------------------------------------
#Here 1024 is out of range for centre (it is 8-bit only)
cat > $fRules <<EOF cat > $fRules <<EOF
set centre=1024; set centre=1024; #1024 is out of range (it is 8-bit only)
EOF EOF
# Invoke without -f i.e. should fail if error encountered # Invoke without -f i.e. should fail if error encountered
@ -597,34 +593,29 @@ ${tools_dir}/codes_bufr_filter -f $fRules $f 2>>$fLog 1>>$fLog
#---------------------------------------------------- #----------------------------------------------------
# Test: format specifier for integer keys # Test: format specifier for integer keys
#---------------------------------------------------- #----------------------------------------------------
#See ECC-36. bufrHeaderCentre is aliased 'centre'
#TODO: when ECC-36 is fixed we need to enable the output check again.
cat > $fRules <<EOF cat > $fRules <<EOF
# Pad center with leading zeroes and heightOfStation with blanks # Pad center with leading zeroes and heightOfStation with blanks
set unpack=1; set unpack=1;
print "centre=[centre%.3d], height=[heightOfStation%5ld]"; print "centre={[centre%.3d',']}, height=[heightOfStation%5ld]";
EOF EOF
f="syno_1.bufr" f="syno_1.bufr"
echo "Test: nformat specifier for integer keys" >> $fLog echo "Test: nformat specifier for integer keys" >> $fLog
echo "file: $f" >> $fLog echo "file: $f" >> $fLog
result=`${tools_dir}/codes_bufr_filter $fRules $f` result=`${tools_dir}/codes_bufr_filter $fRules $f`
#[ "$result" = "centre=098, height= 3" ] [ "$result" = "centre={098,098}, height= 3" ]
#---------------------------------------------------- #----------------------------------------------------
# Test: setting keys # Test: setting keys
#---------------------------------------------------- #----------------------------------------------------
#TODO: when ECC-37 is fixed we need to enable it. #TODO: when ECC-37 is fixed we need to enable it.
#Filter out the message with stationid=1003 #Filter out the message with stationid=1003
cat > $fRules <<EOF cat > $fRules <<EOF
set unpack=1; set unpack=1;
set typicalDate="20010511"; set typicalDate="20010511";
set year=2001; set year=2001;
set airTemperatureAt2M=234.5; set airTemperatureAt2M=234.5;
EOF EOF
rm -f $fBufrTmp rm -f $fBufrTmp
@ -636,8 +627,8 @@ echo "file: $f" >> $fLog
#Check if the resulting bufr message is the right one #Check if the resulting bufr message is the right one
cat > $fRules <<EOF cat > $fRules <<EOF
set unpack=1; set unpack=1;
print "[typicalDate] [year] [airTemperatureAt2M%.1f]"; print "[typicalDate] [year] [airTemperatureAt2M%.1f]";
EOF EOF
#[ `${tools_dir}/codes_bufr_filter $fRules $fBufrTmp` = "20010511 2001 234.5" ] #[ `${tools_dir}/codes_bufr_filter $fRules $fBufrTmp` = "20010511 2001 234.5" ]
@ -656,11 +647,10 @@ echo "Test: set unexpandedDescriptors no create new data" >> $fLog
echo "file: $f" >> $fLog echo "file: $f" >> $fLog
cat >$fRules <<EOF cat >$fRules <<EOF
set unpack=1; set unpack=1;
set createNewData=0; set createNewData=0;
set unexpandedDescriptors={307005,13023,13013,222000,101049,31031,1031,1032,101049,33007}; set unexpandedDescriptors={307005,13023,13013,222000,101049,31031,1031,1032,101049,33007};
write; write;
EOF EOF
${tools_dir}/codes_bufr_filter -o ${f}.out $fRules $f 2>> $fLog 1>> $fLog ${tools_dir}/codes_bufr_filter -o ${f}.out $fRules $f 2>> $fLog 1>> $fLog
@ -678,8 +668,8 @@ echo "Test: set BUFRTemplate" >> $fLog
echo "file: $f" >> $fLog echo "file: $f" >> $fLog
cat >$fRules <<EOF cat >$fRules <<EOF
set BufrTemplate="synopLand"; set BufrTemplate="synopLand";
write; write;
EOF EOF
${tools_dir}/codes_bufr_filter -o $fOut $fRules $f 2>> $fLog 1>> $fLog ${tools_dir}/codes_bufr_filter -o $fOut $fRules $f 2>> $fLog 1>> $fLog
@ -691,8 +681,8 @@ fOut="airep.bufr.out"
fRef="airep.bufr.out.ref" fRef="airep.bufr.out.ref"
cat >$fRules <<EOF cat >$fRules <<EOF
set BufrTemplate="aircraftReportWithSecondsAndPressure"; set BufrTemplate="aircraftReportWithSecondsAndPressure";
write; write;
EOF EOF
${tools_dir}/codes_bufr_filter -o $fOut $fRules $f 2>> $fLog 1>> $fLog ${tools_dir}/codes_bufr_filter -o $fOut $fRules $f 2>> $fLog 1>> $fLog
@ -709,19 +699,18 @@ echo "Test: set keys in data section" >> $fLog
echo "file: $f" >> $fLog echo "file: $f" >> $fLog
cat >$fRules <<EOF cat >$fRules <<EOF
set masterTablesVersionNumber=20; set masterTablesVersionNumber=20;
set localTablesVersionNumber=0; set localTablesVersionNumber=0;
set compressedData=1; set compressedData=1;
set numberOfSubsets=10; set numberOfSubsets=10;
set unexpandedDescriptors={311001}; set unexpandedDescriptors={311001};
set windSpeed={1,2,3,4,5,6,7,8,9,10}; set windSpeed={1,2,3,4,5,6,7,8,9,10};
set windDirection={5,3,4,5,6,7,8,9,10,11}; set windDirection={5,3,4,5,6,7,8,9,10,11};
set aircraftFlightNumber={"ABCD","dfasd","qwerqwe","3241234","ywer","ABCD","dfasd","qwerqwe","3241234","erwe"}; set aircraftFlightNumber={"ABCD","dfasd","qwerqwe","3241234","ywer","ABCD","dfasd","qwerqwe","3241234","erwe"};
set pack=1;
write;
set pack=1;
write;
EOF EOF
${tools_dir}/codes_bufr_filter -o ${fout} $fRules $f 2>> $fLog 1>> $fLog ${tools_dir}/codes_bufr_filter -o ${fout} $fRules $f 2>> $fLog 1>> $fLog
@ -731,11 +720,11 @@ ${tools_dir}/bufr_compare $fout ${fout}.ref 2>> $fLog 1>> $fLog
# ECC-147 # ECC-147
#----------------------------------------------------------- #-----------------------------------------------------------
cat > $fRules <<EOF cat > $fRules <<EOF
set unpack=1; set unpack=1;
set relativeHumidity=27; set relativeHumidity=27;
set horizontalVisibility=1500; set horizontalVisibility=1500;
set pack=1; set pack=1;
write; write;
EOF EOF
f="syno_1.bufr" f="syno_1.bufr"
@ -759,16 +748,16 @@ rm -f $fRules ${fout} $fLog
# Test: access subsets by condition # Test: access subsets by condition
#----------------------------------------------------------- #-----------------------------------------------------------
cat > $fRules <<EOF cat > $fRules <<EOF
set unpack=1; set unpack=1;
print "stationId=[/subsetNumber=6/blockNumber!%.2d][/subsetNumber=6/stationNumber!%.3d]"; print "stationId=[/subsetNumber=6/blockNumber!%.2d][/subsetNumber=6/stationNumber!%.3d]";
print "latitude=[/subsetNumber=6/latitude]"; print "latitude=[/subsetNumber=6/latitude]";
print "longitude=[/subsetNumber=6/longitude]"; print "longitude=[/subsetNumber=6/longitude]";
print "airTemperature=[/subsetNumber=6/airTemperature]"; print "airTemperature=[/subsetNumber=6/airTemperature]";
print "--------"; print "--------";
print "stationId=[/subsetNumber=9/blockNumber!%.2d][/subsetNumber=9/stationNumber!%.3d]"; print "stationId=[/subsetNumber=9/blockNumber!%.2d][/subsetNumber=9/stationNumber!%.3d]";
print "latitude=[/subsetNumber=9/latitude]"; print "latitude=[/subsetNumber=9/latitude]";
print "longitude=[/subsetNumber=9/longitude]"; print "longitude=[/subsetNumber=9/longitude]";
print "airTemperature=[/subsetNumber=9/airTemperature]"; print "airTemperature=[/subsetNumber=9/airTemperature]";
EOF EOF
f="synop_multi_subset.bufr" f="synop_multi_subset.bufr"
@ -797,8 +786,8 @@ rm -f ${f}.ref ${f}.log
# Test: access subsets and attribute by condition # Test: access subsets and attribute by condition
#----------------------------------------------------------- #-----------------------------------------------------------
cat > $fRules <<EOF cat > $fRules <<EOF
set unpack=1; set unpack=1;
print "/subsetNumber=1/airTemperature->percentConfidence=[/subsetNumber=1/airTemperature->percentConfidence] [/subsetNumber=1/airTemperature->percentConfidence->units]"; print "/subsetNumber=1/airTemperature->percentConfidence=[/subsetNumber=1/airTemperature->percentConfidence] [/subsetNumber=1/airTemperature->percentConfidence->units]";
EOF EOF
f="amda_144.bufr" f="amda_144.bufr"
@ -819,9 +808,9 @@ rm -f $fLog $fRules
# Test: set key by rank # Test: set key by rank
#----------------------------------------------------------- #-----------------------------------------------------------
cat > $fRules <<EOF cat > $fRules <<EOF
set unpack=1; set unpack=1;
set #4#airTemperature = 300.1; set #4#airTemperature = 300.1;
print "#4#airTemperature=[#4#airTemperature]"; print "#4#airTemperature=[#4#airTemperature]";
EOF EOF
f="temp_101.bufr" f="temp_101.bufr"
@ -842,30 +831,26 @@ rm -f $fLog $fRules
# Test: initialise with given values of delayed replications # Test: initialise with given values of delayed replications
#----------------------------------------------------------- #-----------------------------------------------------------
cat > $fRules <<EOF cat > $fRules <<EOF
set localTablesVersionNumber=0; set localTablesVersionNumber=0;
set masterTablesVersionNumber=23; set masterTablesVersionNumber=23;
set inputDelayedDescriptorReplicationFactor = {2,3}; set inputDelayedDescriptorReplicationFactor = {2,3};
print "inputDelayedDescriptorReplicationFactor=[inputDelayedDescriptorReplicationFactor]"; print "inputDelayedDescriptorReplicationFactor=[inputDelayedDescriptorReplicationFactor]";
set inputExtendedDelayedDescriptorReplicationFactor = {3,4}; set inputExtendedDelayedDescriptorReplicationFactor = {3,4};
print "inputExtendedDelayedDescriptorReplicationFactor=[inputExtendedDelayedDescriptorReplicationFactor]"; print "inputExtendedDelayedDescriptorReplicationFactor=[inputExtendedDelayedDescriptorReplicationFactor]";
set numberOfSubsets=2; set numberOfSubsets=2;
set unexpandedDescriptors={309052};
print "/subsetNumber=1/delayedDescriptorReplicationFactor=[/subsetNumber=1/delayedDescriptorReplicationFactor]";
print "/subsetNumber=1/extendedDelayedDescriptorReplicationFactor=[/subsetNumber=1/extendedDelayedDescriptorReplicationFactor]";
print "/subsetNumber=2/delayedDescriptorReplicationFactor=[/subsetNumber=2/delayedDescriptorReplicationFactor]";
print "/subsetNumber=2/extendedDelayedDescriptorReplicationFactor=[/subsetNumber=2/extendedDelayedDescriptorReplicationFactor]";
set unexpandedDescriptors={309052}; set pressure={102400,50000,40000,30000,20000,15000,102400,50000,40000,30000,20000,15000};
set pack=1;
print "/subsetNumber=1/delayedDescriptorReplicationFactor=[/subsetNumber=1/delayedDescriptorReplicationFactor]"; print "pressure={[pressure!12',']}";
print "/subsetNumber=1/extendedDelayedDescriptorReplicationFactor=[/subsetNumber=1/extendedDelayedDescriptorReplicationFactor]"; write;
print "/subsetNumber=2/delayedDescriptorReplicationFactor=[/subsetNumber=2/delayedDescriptorReplicationFactor]";
print "/subsetNumber=2/extendedDelayedDescriptorReplicationFactor=[/subsetNumber=2/extendedDelayedDescriptorReplicationFactor]";
set pressure={102400,50000,40000,30000,20000,15000,102400,50000,40000,30000,20000,15000};
set pack=1;
print "pressure={[pressure!12',']}";
write;
EOF EOF
f="syno_1.bufr" f="syno_1.bufr"
@ -896,10 +881,9 @@ rm -f $fLog $fRules ${fOut}
# Test: add section 2 # Test: add section 2
#----------------------------------------------------------- #-----------------------------------------------------------
cat > $fRules <<EOF cat > $fRules <<EOF
set bufrHeaderCentre=98; set bufrHeaderCentre=98;
set section2Present=1; set section2Present=1;
write;
write;
EOF EOF
f="vos308014_v3_26.bufr" f="vos308014_v3_26.bufr"
@ -930,24 +914,24 @@ rm -f $fLog $fRules ${fOut}
# Test: extract subsets uncompressed data # Test: extract subsets uncompressed data
#----------------------------------------------------------- #-----------------------------------------------------------
cat > $fRules <<EOF cat > $fRules <<EOF
set unpack=1; set unpack=1;
set extractSubset=4; set extractSubset=4;
set doExtractSubsets=1; set doExtractSubsets=1;
write; write;
set extractSubset=2; set extractSubset=2;
set doExtractSubsets=1; set doExtractSubsets=1;
write; write;
set extractSubsetIntervalStart=5; set extractSubsetIntervalStart=5;
set extractSubsetIntervalEnd=8; set extractSubsetIntervalEnd=8;
set doExtractSubsets=1; set doExtractSubsets=1;
write; write;
set extractSubsetList={1,3}; set extractSubsetList={1,3};
set doExtractSubsets=1; set doExtractSubsets=1;
write; write;
EOF EOF
f="synop_multi_subset.bufr" f="synop_multi_subset.bufr"
@ -1097,22 +1081,20 @@ rm -f $fLog $fRules
# Test: delayed replication compressed data # Test: delayed replication compressed data
#----------------------------------------------------------- #-----------------------------------------------------------
cat > $fRules <<EOF cat > $fRules <<EOF
set localTablesVersionNumber=1; set localTablesVersionNumber=1;
set masterTablesVersionNumber=13; set masterTablesVersionNumber=13;
set inputDelayedDescriptorReplicationFactor = {5};
set compressedData=1;
set numberOfSubsets=2;
set inputDelayedDescriptorReplicationFactor = {5}; set unexpandedDescriptors={312061};
set compressedData=1;
set numberOfSubsets=2;
set unexpandedDescriptors={312061}; set #1#windSpeedAt10M={10,20};
set #3#windSpeedAt10M={30,40};
set #1#windSpeedAt10M={10,20}; set pack=1;
set #3#windSpeedAt10M={30,40}; write;
set pack=1;
write;
EOF EOF
f="asel_139.bufr" f="asel_139.bufr"
@ -1328,10 +1310,10 @@ rm -f ${f}.log ${f}.log.ref
# Test: Data with two bias correction wrong bitmap # Test: Data with two bias correction wrong bitmap
#----------------------------------------------------------- #-----------------------------------------------------------
cat > $fRules <<EOF cat > $fRules <<EOF
set unpack=1; set unpack=1;
print "[nonCoordinatePressure->percentConfidence]"; print "[nonCoordinatePressure->percentConfidence]";
print "[nonCoordinatePressure->differenceStatisticalValue]"; print "[nonCoordinatePressure->differenceStatisticalValue]";
print "[nonCoordinatePressure->differenceStatisticalValue->differenceStatisticalValue]"; print "[nonCoordinatePressure->differenceStatisticalValue->differenceStatisticalValue]";
EOF EOF
f="metar_with_2_bias.bufr" f="metar_with_2_bias.bufr"