BUFR operator 206YYY not working
@@ -584,6 +584,7 @@ static int expand(grib_accessor* a)
bufr_descriptors_array* expanded=NULL;
grib_context* c=a->context;
grib_handle* h=grib_handle_of_accessor(a);
+ int operator206yyy_width = 0; /* width specified by operator 206YYY */
if (!self->do_expand) {
return err;
@@ -631,8 +632,22 @@ static int expand(grib_accessor* a)
unexpanded=grib_bufr_descriptors_array_new(c,unexpandedSize,100);
unexpanded_copy=grib_bufr_descriptors_array_new(c,unexpandedSize,100);
for (i=0;i<unexpandedSize;i++) {
- grib_bufr_descriptors_array_push(unexpanded,grib_bufr_descriptor_new(self->tablesAccessor,u[i],&err));
- grib_bufr_descriptors_array_push(unexpanded_copy,grib_bufr_descriptor_new(self->tablesAccessor,u[i],&err));
+ bufr_descriptor* aDescriptor = grib_bufr_descriptor_new(self->tablesAccessor, u[i], &err);
+ /* ECC-433: Operator 206YYY */
+ if (aDescriptor->F == 2 && aDescriptor->X == 6) {
+ Assert(aDescriptor->type == BUFR_DESCRIPTOR_TYPE_OPERATOR);
+ operator206yyy_width = aDescriptor->Y; /* Store the width for the following descriptor */
+ }
+ else if (operator206yyy_width>0 && aDescriptor->type == BUFR_DESCRIPTOR_TYPE_UNKNOWN && aDescriptor->width == 0) {
+ Assert(err); /* There must have been an error processing the unknown descriptor */
+ err = 0; /* Clear the error because we have the width from Op206YYY */
+ aDescriptor->width = operator206yyy_width;
+ aDescriptor->nokey = 1; /* Do not show this descriptor in dump */
+ operator206yyy_width = 0; /* Restore. Operator no longer in scope */
+ }
+
+ grib_bufr_descriptors_array_push(unexpanded, aDescriptor);
+ grib_bufr_descriptors_array_push(unexpanded_copy, aDescriptor);
}
grib_context_free(c,u);
