mirror of https://github.com/ecmwf/eccodes.git
Testing: clean up test for ECC-36
This commit is contained in:
parent
fba00d70fe
commit
b4f80b0f8a
|
@ -481,8 +481,8 @@ rm -f ${f}.ref ${f}.log
|
|||
# Test: get string whose value is MISSING (ECC-650)
|
||||
#-----------------------------------------------------------
|
||||
cat > $fRules <<EOF
|
||||
set unpack=1;
|
||||
print "[shipOrMobileLandStationIdentifier]";
|
||||
set unpack=1;
|
||||
print "[shipOrMobileLandStationIdentifier]";
|
||||
EOF
|
||||
|
||||
f="btem_109.bufr"
|
||||
|
@ -496,10 +496,10 @@ rm -f ${f}.ref ${f}.log
|
|||
# Test: get string array and stringValues
|
||||
#-----------------------------------------------------------
|
||||
cat > $fRules <<EOF
|
||||
set unpack=1;
|
||||
print "[stringValues!1]";
|
||||
print "====";
|
||||
print "[stationOrSiteName!1]";
|
||||
set unpack=1;
|
||||
print "[stringValues!1]";
|
||||
print "====";
|
||||
print "[stationOrSiteName!1]";
|
||||
EOF
|
||||
|
||||
f="synop_multi_subset.bufr"
|
||||
|
@ -545,10 +545,8 @@ rm -f ${f}.ref ${f}.log
|
|||
#-----------------------------------------------------------
|
||||
# Test: with nonexistent keys.
|
||||
#-----------------------------------------------------------
|
||||
|
||||
#Here "centre" is misspelled!!!
|
||||
cat > $fRules <<EOF
|
||||
set center="98";
|
||||
set center="98"; #Here centre is misspelled
|
||||
EOF
|
||||
|
||||
# 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
|
||||
#-----------------------------------------------------------
|
||||
|
||||
#Here 1024 is out of range for centre (it is 8-bit only)
|
||||
cat > $fRules <<EOF
|
||||
set centre=1024;
|
||||
set centre=1024; #1024 is out of range (it is 8-bit only)
|
||||
EOF
|
||||
|
||||
# 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
|
||||
#----------------------------------------------------
|
||||
|
||||
#TODO: when ECC-36 is fixed we need to enable the output check again.
|
||||
|
||||
#See ECC-36. bufrHeaderCentre is aliased 'centre'
|
||||
cat > $fRules <<EOF
|
||||
# Pad center with leading zeroes and heightOfStation with blanks
|
||||
set unpack=1;
|
||||
print "centre=[centre%.3d], height=[heightOfStation%5ld]";
|
||||
# Pad center with leading zeroes and heightOfStation with blanks
|
||||
set unpack=1;
|
||||
print "centre={[centre%.3d',']}, height=[heightOfStation%5ld]";
|
||||
EOF
|
||||
|
||||
f="syno_1.bufr"
|
||||
echo "Test: nformat specifier for integer keys" >> $fLog
|
||||
echo "file: $f" >> $fLog
|
||||
result=`${tools_dir}/codes_bufr_filter $fRules $f`
|
||||
#[ "$result" = "centre=098, height= 3" ]
|
||||
|
||||
[ "$result" = "centre={098,098}, height= 3" ]
|
||||
|
||||
#----------------------------------------------------
|
||||
# Test: setting keys
|
||||
#----------------------------------------------------
|
||||
|
||||
#TODO: when ECC-37 is fixed we need to enable it.
|
||||
|
||||
#Filter out the message with stationid=1003
|
||||
cat > $fRules <<EOF
|
||||
set unpack=1;
|
||||
set typicalDate="20010511";
|
||||
set year=2001;
|
||||
set airTemperatureAt2M=234.5;
|
||||
set unpack=1;
|
||||
set typicalDate="20010511";
|
||||
set year=2001;
|
||||
set airTemperatureAt2M=234.5;
|
||||
EOF
|
||||
|
||||
rm -f $fBufrTmp
|
||||
|
@ -636,8 +627,8 @@ echo "file: $f" >> $fLog
|
|||
|
||||
#Check if the resulting bufr message is the right one
|
||||
cat > $fRules <<EOF
|
||||
set unpack=1;
|
||||
print "[typicalDate] [year] [airTemperatureAt2M%.1f]";
|
||||
set unpack=1;
|
||||
print "[typicalDate] [year] [airTemperatureAt2M%.1f]";
|
||||
EOF
|
||||
|
||||
#[ `${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
|
||||
|
||||
cat >$fRules <<EOF
|
||||
set unpack=1;
|
||||
set createNewData=0;
|
||||
set unexpandedDescriptors={307005,13023,13013,222000,101049,31031,1031,1032,101049,33007};
|
||||
set unpack=1;
|
||||
set createNewData=0;
|
||||
set unexpandedDescriptors={307005,13023,13013,222000,101049,31031,1031,1032,101049,33007};
|
||||
write;
|
||||
|
||||
EOF
|
||||
|
||||
${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
|
||||
|
||||
cat >$fRules <<EOF
|
||||
set BufrTemplate="synopLand";
|
||||
write;
|
||||
set BufrTemplate="synopLand";
|
||||
write;
|
||||
EOF
|
||||
|
||||
${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"
|
||||
|
||||
cat >$fRules <<EOF
|
||||
set BufrTemplate="aircraftReportWithSecondsAndPressure";
|
||||
write;
|
||||
set BufrTemplate="aircraftReportWithSecondsAndPressure";
|
||||
write;
|
||||
EOF
|
||||
|
||||
${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
|
||||
|
||||
cat >$fRules <<EOF
|
||||
set masterTablesVersionNumber=20;
|
||||
set localTablesVersionNumber=0;
|
||||
set compressedData=1;
|
||||
set numberOfSubsets=10;
|
||||
set unexpandedDescriptors={311001};
|
||||
set masterTablesVersionNumber=20;
|
||||
set localTablesVersionNumber=0;
|
||||
set compressedData=1;
|
||||
set numberOfSubsets=10;
|
||||
set unexpandedDescriptors={311001};
|
||||
|
||||
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 aircraftFlightNumber={"ABCD","dfasd","qwerqwe","3241234","ywer","ABCD","dfasd","qwerqwe","3241234","erwe"};
|
||||
|
||||
set pack=1;
|
||||
write;
|
||||
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 aircraftFlightNumber={"ABCD","dfasd","qwerqwe","3241234","ywer","ABCD","dfasd","qwerqwe","3241234","erwe"};
|
||||
|
||||
set pack=1;
|
||||
write;
|
||||
EOF
|
||||
|
||||
${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
|
||||
#-----------------------------------------------------------
|
||||
cat > $fRules <<EOF
|
||||
set unpack=1;
|
||||
set relativeHumidity=27;
|
||||
set horizontalVisibility=1500;
|
||||
set pack=1;
|
||||
write;
|
||||
set unpack=1;
|
||||
set relativeHumidity=27;
|
||||
set horizontalVisibility=1500;
|
||||
set pack=1;
|
||||
write;
|
||||
EOF
|
||||
|
||||
f="syno_1.bufr"
|
||||
|
@ -759,16 +748,16 @@ rm -f $fRules ${fout} $fLog
|
|||
# Test: access subsets by condition
|
||||
#-----------------------------------------------------------
|
||||
cat > $fRules <<EOF
|
||||
set unpack=1;
|
||||
print "stationId=[/subsetNumber=6/blockNumber!%.2d][/subsetNumber=6/stationNumber!%.3d]";
|
||||
print "latitude=[/subsetNumber=6/latitude]";
|
||||
print "longitude=[/subsetNumber=6/longitude]";
|
||||
print "airTemperature=[/subsetNumber=6/airTemperature]";
|
||||
print "--------";
|
||||
print "stationId=[/subsetNumber=9/blockNumber!%.2d][/subsetNumber=9/stationNumber!%.3d]";
|
||||
print "latitude=[/subsetNumber=9/latitude]";
|
||||
print "longitude=[/subsetNumber=9/longitude]";
|
||||
print "airTemperature=[/subsetNumber=9/airTemperature]";
|
||||
set unpack=1;
|
||||
print "stationId=[/subsetNumber=6/blockNumber!%.2d][/subsetNumber=6/stationNumber!%.3d]";
|
||||
print "latitude=[/subsetNumber=6/latitude]";
|
||||
print "longitude=[/subsetNumber=6/longitude]";
|
||||
print "airTemperature=[/subsetNumber=6/airTemperature]";
|
||||
print "--------";
|
||||
print "stationId=[/subsetNumber=9/blockNumber!%.2d][/subsetNumber=9/stationNumber!%.3d]";
|
||||
print "latitude=[/subsetNumber=9/latitude]";
|
||||
print "longitude=[/subsetNumber=9/longitude]";
|
||||
print "airTemperature=[/subsetNumber=9/airTemperature]";
|
||||
EOF
|
||||
|
||||
f="synop_multi_subset.bufr"
|
||||
|
@ -797,8 +786,8 @@ rm -f ${f}.ref ${f}.log
|
|||
# Test: access subsets and attribute by condition
|
||||
#-----------------------------------------------------------
|
||||
cat > $fRules <<EOF
|
||||
set unpack=1;
|
||||
print "/subsetNumber=1/airTemperature->percentConfidence=[/subsetNumber=1/airTemperature->percentConfidence] [/subsetNumber=1/airTemperature->percentConfidence->units]";
|
||||
set unpack=1;
|
||||
print "/subsetNumber=1/airTemperature->percentConfidence=[/subsetNumber=1/airTemperature->percentConfidence] [/subsetNumber=1/airTemperature->percentConfidence->units]";
|
||||
EOF
|
||||
|
||||
f="amda_144.bufr"
|
||||
|
@ -819,9 +808,9 @@ rm -f $fLog $fRules
|
|||
# Test: set key by rank
|
||||
#-----------------------------------------------------------
|
||||
cat > $fRules <<EOF
|
||||
set unpack=1;
|
||||
set #4#airTemperature = 300.1;
|
||||
print "#4#airTemperature=[#4#airTemperature]";
|
||||
set unpack=1;
|
||||
set #4#airTemperature = 300.1;
|
||||
print "#4#airTemperature=[#4#airTemperature]";
|
||||
EOF
|
||||
|
||||
f="temp_101.bufr"
|
||||
|
@ -842,30 +831,26 @@ rm -f $fLog $fRules
|
|||
# Test: initialise with given values of delayed replications
|
||||
#-----------------------------------------------------------
|
||||
cat > $fRules <<EOF
|
||||
set localTablesVersionNumber=0;
|
||||
set masterTablesVersionNumber=23;
|
||||
set localTablesVersionNumber=0;
|
||||
set masterTablesVersionNumber=23;
|
||||
|
||||
set inputDelayedDescriptorReplicationFactor = {2,3};
|
||||
print "inputDelayedDescriptorReplicationFactor=[inputDelayedDescriptorReplicationFactor]";
|
||||
set inputExtendedDelayedDescriptorReplicationFactor = {3,4};
|
||||
print "inputExtendedDelayedDescriptorReplicationFactor=[inputExtendedDelayedDescriptorReplicationFactor]";
|
||||
set inputDelayedDescriptorReplicationFactor = {2,3};
|
||||
print "inputDelayedDescriptorReplicationFactor=[inputDelayedDescriptorReplicationFactor]";
|
||||
set inputExtendedDelayedDescriptorReplicationFactor = {3,4};
|
||||
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 "/subsetNumber=1/extendedDelayedDescriptorReplicationFactor=[/subsetNumber=1/extendedDelayedDescriptorReplicationFactor]";
|
||||
|
||||
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;
|
||||
print "pressure={[pressure!12',']}";
|
||||
write;
|
||||
EOF
|
||||
|
||||
f="syno_1.bufr"
|
||||
|
@ -896,10 +881,9 @@ rm -f $fLog $fRules ${fOut}
|
|||
# Test: add section 2
|
||||
#-----------------------------------------------------------
|
||||
cat > $fRules <<EOF
|
||||
set bufrHeaderCentre=98;
|
||||
set section2Present=1;
|
||||
|
||||
write;
|
||||
set bufrHeaderCentre=98;
|
||||
set section2Present=1;
|
||||
write;
|
||||
EOF
|
||||
|
||||
f="vos308014_v3_26.bufr"
|
||||
|
@ -930,24 +914,24 @@ rm -f $fLog $fRules ${fOut}
|
|||
# Test: extract subsets uncompressed data
|
||||
#-----------------------------------------------------------
|
||||
cat > $fRules <<EOF
|
||||
set unpack=1;
|
||||
set unpack=1;
|
||||
|
||||
set extractSubset=4;
|
||||
set doExtractSubsets=1;
|
||||
write;
|
||||
set extractSubset=4;
|
||||
set doExtractSubsets=1;
|
||||
write;
|
||||
|
||||
set extractSubset=2;
|
||||
set doExtractSubsets=1;
|
||||
write;
|
||||
set extractSubset=2;
|
||||
set doExtractSubsets=1;
|
||||
write;
|
||||
|
||||
set extractSubsetIntervalStart=5;
|
||||
set extractSubsetIntervalEnd=8;
|
||||
set doExtractSubsets=1;
|
||||
write;
|
||||
set extractSubsetIntervalStart=5;
|
||||
set extractSubsetIntervalEnd=8;
|
||||
set doExtractSubsets=1;
|
||||
write;
|
||||
|
||||
set extractSubsetList={1,3};
|
||||
set doExtractSubsets=1;
|
||||
write;
|
||||
set extractSubsetList={1,3};
|
||||
set doExtractSubsets=1;
|
||||
write;
|
||||
EOF
|
||||
|
||||
f="synop_multi_subset.bufr"
|
||||
|
@ -1097,22 +1081,20 @@ rm -f $fLog $fRules
|
|||
# Test: delayed replication compressed data
|
||||
#-----------------------------------------------------------
|
||||
cat > $fRules <<EOF
|
||||
set localTablesVersionNumber=1;
|
||||
set masterTablesVersionNumber=13;
|
||||
set localTablesVersionNumber=1;
|
||||
set masterTablesVersionNumber=13;
|
||||
|
||||
set inputDelayedDescriptorReplicationFactor = {5};
|
||||
set compressedData=1;
|
||||
set numberOfSubsets=2;
|
||||
|
||||
set inputDelayedDescriptorReplicationFactor = {5};
|
||||
set compressedData=1;
|
||||
set numberOfSubsets=2;
|
||||
set unexpandedDescriptors={312061};
|
||||
|
||||
set unexpandedDescriptors={312061};
|
||||
set #1#windSpeedAt10M={10,20};
|
||||
set #3#windSpeedAt10M={30,40};
|
||||
|
||||
set #1#windSpeedAt10M={10,20};
|
||||
set #3#windSpeedAt10M={30,40};
|
||||
|
||||
set pack=1;
|
||||
|
||||
write;
|
||||
set pack=1;
|
||||
write;
|
||||
EOF
|
||||
|
||||
f="asel_139.bufr"
|
||||
|
@ -1328,10 +1310,10 @@ rm -f ${f}.log ${f}.log.ref
|
|||
# Test: Data with two bias correction wrong bitmap
|
||||
#-----------------------------------------------------------
|
||||
cat > $fRules <<EOF
|
||||
set unpack=1;
|
||||
print "[nonCoordinatePressure->percentConfidence]";
|
||||
print "[nonCoordinatePressure->differenceStatisticalValue]";
|
||||
print "[nonCoordinatePressure->differenceStatisticalValue->differenceStatisticalValue]";
|
||||
set unpack=1;
|
||||
print "[nonCoordinatePressure->percentConfidence]";
|
||||
print "[nonCoordinatePressure->differenceStatisticalValue]";
|
||||
print "[nonCoordinatePressure->differenceStatisticalValue->differenceStatisticalValue]";
|
||||
EOF
|
||||
|
||||
f="metar_with_2_bias.bufr"
|
||||
|
|
Loading…
Reference in New Issue