This commit is contained in:
Enrico Fucile 2016-04-26 09:48:48 +01:00
parent a1da8c2a31
commit 128ee3e43d
3 changed files with 32 additions and 3 deletions

View File

@ -386,3 +386,4 @@ syno.bufr.out.ref
airep.bufr.out.ref airep.bufr.out.ref
new_replication.bufr.ref new_replication.bufr.ref
metar_with_2_bias.bufr metar_with_2_bias.bufr
temp-land-with-substituted-values.bufr

View File

@ -1040,7 +1040,7 @@ static int build_bitmap(grib_accessor_bufr_data_array *self,unsigned char* data,
ECC-243 ECC-243
*/ */
while (iel>0) { while (iel>0) {
while ( descriptors[edi[iel]]->code!=236000 && descriptors[edi[iel]]->code!=222000 && iel!=0) iel--; while ( descriptors[edi[iel]]->code!=236000 && descriptors[edi[iel]]->code!=222000 && descriptors[edi[iel]]->code!=223000 && iel!=0) iel--;
if (iel!=0) { if (iel!=0) {
while (descriptors[edi[iel]]->code>=100000 && iel!=0) iel--; while (descriptors[edi[iel]]->code>=100000 && iel!=0) iel--;
bitmapEndElementsDescriptorsIndex=iel; bitmapEndElementsDescriptorsIndex=iel;
@ -1589,6 +1589,7 @@ static int bitmap_ref_skip(grib_accessors_list* al,int* err)
switch (code[0]) { switch (code[0]) {
case 222000: case 222000:
case 223000:
case 224000: case 224000:
case 225000: case 225000:
case 232000: case 232000:
@ -1786,7 +1787,7 @@ static int create_keys(grib_accessor* a,long onlySubset,long startSubset,long en
dump=1; dump=1;
bitmapSize[bitmapIndex]++; bitmapSize[bitmapIndex]++;
bitmap.cursor=0; bitmap.cursor=0;
} else if (descriptor->code == 222000 || descriptor->code == 224000 || descriptor->code == 225000 ) { } else if (descriptor->code == 222000 || descriptor->code == 223000 || descriptor->code == 224000 || descriptor->code == 225000 ) {
bitmap.referredElement=NULL; bitmap.referredElement=NULL;
qualityPresent=1; qualityPresent=1;
incrementBitmapIndex=1; incrementBitmapIndex=1;
@ -1834,7 +1835,7 @@ static int create_keys(grib_accessor* a,long onlySubset,long startSubset,long en
elementAccessor=create_accessor_from_descriptor(a,associatedFieldAccessor,section,ide,iss,dump,count); elementAccessor=create_accessor_from_descriptor(a,associatedFieldAccessor,section,ide,iss,dump,count);
associatedFieldAccessor=NULL; associatedFieldAccessor=NULL;
if (elementFromBitmap && self->unpackMode==CODES_BUFR_UNPACK_STRUCTURE) { if (elementFromBitmap && self->unpackMode==CODES_BUFR_UNPACK_STRUCTURE) {
if (descriptor->code != 33007) { if (descriptor->code != 33007 && descriptor->code != 223255 ) {
grib_accessor* newAccessor=grib_accessor_clone(elementAccessor,section,&err); grib_accessor* newAccessor=grib_accessor_clone(elementAccessor,section,&err);
newAccessor->parent=groupSection; newAccessor->parent=groupSection;
newAccessor->name=grib_context_strdup(c,elementFromBitmap->name); newAccessor->name=grib_context_strdup(c,elementFromBitmap->name);

View File

@ -1338,3 +1338,30 @@ diff ${f}.log.ref ${f}.log
rm -f ${f}.log ${f}.log.ref rm -f ${f}.log ${f}.log.ref
#-----------------------------------------------------------
# Test: Data with substituted value
#-----------------------------------------------------------
cat > $fRules <<EOF
set unpack=1;
print "[#1#geopotential]";
print "[#1#geopotential->percentConfidence]";
print "[#1#geopotential->substitutedValue]";
EOF
f="temp-land-with-substituted-values.bufr"
echo "Test: Data with substituted value" >> $fLog
echo "file: $f" >> $fLog
${tools_dir}bufr_filter $fRules $f > ${f}.log
cat > ${f}.log.ref <<EOF
110
70
3
EOF
diff ${f}.log.ref ${f}.log
rm -f ${f}.log ${f}.log.ref