Revert changes made for ECC-313. See branch 'bugfix/ECC-313-Operator203'

This commit is contained in:
Shahram Najm 2017-01-16 11:10:13 +00:00
parent 9495fccfec
commit fd292b2d4b
1 changed files with 11 additions and 36 deletions

View File

@ -65,7 +65,6 @@
MEMBERS = grib_trie* dataAccessorsTrie
MEMBERS = grib_trie* dataAccessorsRank
MEMBERS = grib_sarray* tempStrings
MEMBERS = int change_ref_value_operand
END_CLASS_DEF
@ -140,7 +139,6 @@ typedef struct grib_accessor_bufr_data_array {
grib_trie* dataAccessorsTrie;
grib_trie* dataAccessorsRank;
grib_sarray* tempStrings;
int change_ref_value_operand;
} grib_accessor_bufr_data_array;
extern grib_accessor_class* grib_accessor_class_gen;
@ -297,7 +295,6 @@ static void init(grib_accessor* a,const long v, grib_arguments* params)
self->expandedAccessor=0;
self->dataAccessorsTrie=0;
self->dataAccessorsRank=0;
self->change_ref_value_operand=0; /* 0, 255 or YYY */
a->length=0;
self->bitsToEndData=get_length(a)*8;
@ -341,10 +338,9 @@ static void self_clear(grib_context* c,grib_accessor_bufr_data_array* self)
if (self->inputReplications) grib_context_free(c,self->inputReplications);
if (self->inputExtendedReplications) grib_context_free(c,self->inputExtendedReplications);
if (self->inputShortReplications) grib_context_free(c,self->inputShortReplications);
self->change_ref_value_operand = 0;
}
static int get_native_type(grib_accessor* a)
static int get_native_type(grib_accessor* a)
{
return GRIB_TYPE_DOUBLE;
}
@ -906,19 +902,10 @@ static int decode_element(grib_context* c,grib_accessor_bufr_data_array* self,in
dar=decode_double_array(c,data,pos,bd,self->canBeMissing[i],self,&err);
grib_vdarray_push(c,self->numericValues,dar);
} else {
/* Uncompressed */
if (self->change_ref_value_operand > 0 && self->change_ref_value_operand != 255) {
/* Change Reference Values: Definition phase */
const int number_of_bits = self->change_ref_value_operand;
double new_ref_val = (double)grib_decode_signed_longb(data, pos, number_of_bits);
grib_context_log(c, GRIB_LOG_DEBUG, "BUFR data decoding: 203YYY (uncomp)", bd->code, new_ref_val);
/* store in dict: code => new_ref_val */
} else {
cdval=decode_double_value(c,data,pos,bd,self->canBeMissing[i],self,&err);
grib_context_log(c, GRIB_LOG_DEBUG,"BUFR data decoding: \t %s = %g",
bd->shortName,cdval);
grib_darray_push(c,dval,cdval);
}
cdval=decode_double_value(c,data,pos,bd,self->canBeMissing[i],self,&err);
grib_context_log(c, GRIB_LOG_DEBUG,"BUFR data decoding: \t %s = %g",
bd->shortName,cdval);
grib_darray_push(c,dval,cdval);
}
}
return err;
@ -1364,6 +1351,7 @@ static int get_next_bitmap_descriptor_index(grib_accessor_bufr_data_array *self,
int i;
bufr_descriptor** descriptors=self->expanded->v;
if (self->compressedData) {
if (self->numericValues->n==0)
return get_next_bitmap_descriptor_index_new_bitmap(self,elementsDescriptorsIndex,1);
@ -2385,21 +2373,7 @@ static int process_elements(grib_accessor* a,int flag,long onlySubset,long start
case 2:
/* Operator */
switch(descriptors[i]->X) {
#ifdef IMPL_OP203YYY
case 3:
/* TODO: 203YYY Change reference values */
if (descriptors[i]->Y == 255) {
printf("Debug: operator 203YYY: Termination\n");
self->change_ref_value_operand = 255;
} else if (descriptors[i]->Y == 0) {
printf("Debug: operator 203YYY: Clearing override of table B\n");
self->change_ref_value_operand = 0;
} else {
self->change_ref_value_operand = descriptors[i]->Y;/* num bits for ref vals */
}
break;
#endif
case 5: /* Signify character */
case 5:
descriptors[i]->width=descriptors[i]->Y*8;
descriptors[i]->type=BUFR_DESCRIPTOR_TYPE_STRING;
err=codec_element(c,self,iss,buffer,data,&pos,i,0,elementIndex,dval,sval);
@ -2407,7 +2381,7 @@ static int process_elements(grib_accessor* a,int flag,long onlySubset,long start
if (flag!=PROCESS_ENCODE) grib_iarray_push(elementsDescriptorsIndex,i);
elementIndex++;
break;
case 22: /* Quality information follows */
case 22:
if (descriptors[i]->Y==0) {
if (flag==PROCESS_DECODE) {
grib_iarray_push(elementsDescriptorsIndex,i);
@ -2540,7 +2514,7 @@ static int process_elements(grib_accessor* a,int flag,long onlySubset,long start
default :
grib_context_log(c,GRIB_LOG_ERROR,"process_elements: unsupported operator %d\n",descriptors[i]->X);
return GRIB_INTERNAL_ERROR;
} /* F == 2 */
}
break;
case 9:
/* associated field */
@ -2556,7 +2530,7 @@ static int process_elements(grib_accessor* a,int flag,long onlySubset,long start
default:
err=GRIB_INTERNAL_ERROR;
return err;
} /* switch F */
}
/* delayed repetition check */
innr=numberOfNestedRepetitions-1;
@ -2588,6 +2562,7 @@ static int process_elements(grib_accessor* a,int flag,long onlySubset,long start
}
}
}
}
if (flag!=PROCESS_ENCODE) grib_viarray_push(c,self->elementsDescriptorsIndex,elementsDescriptorsIndex);
if (decoding && !self->compressedData) {