ECC-616: BUFR operator 203YYY: implement encoding (Renamed key)

This commit is contained in:
Shahram Najm 2018-04-10 17:17:48 +01:00
parent 30abbdc00f
commit 3db6033a0f
13 changed files with 35 additions and 27 deletions

View File

@ -24,14 +24,16 @@ transient inputShortDelayedDescriptorReplicationFactor={-1} : hidden;
transient inputDataPresentIndicator={-1} : hidden;
# For operator 203YYY: Table B override
transient overriddenReferenceValues={0} : hidden;
transient inputOverriddenReferenceValues={0} : hidden;
transient extractSubset=-1 : hidden;
transient extractSubsetList={-1} : hidden;
transient extractSubsetIntervalStart=-1 : hidden;
transient extractSubsetIntervalEnd=-1 : hidden;
meta doExtractSubsets bufr_extract_subsets(numericValues,pack,numberOfSubsets,extractSubset,extractSubsetIntervalStart,extractSubsetIntervalEnd,extractSubsetList)=0 : hidden;
meta doExtractSubsets bufr_extract_subsets(
numericValues,pack,numberOfSubsets,extractSubset,extractSubsetIntervalStart,extractSubsetIntervalEnd,
extractSubsetList)=0 : hidden;
transient extractAreaWestLongitude=1.1 : hidden;
transient extractAreaEastLongitude=1.1 : hidden;
@ -52,8 +54,9 @@ transient extractDateTimeDayStart=1 : hidden;
transient extractDateTimeHourStart=1 : hidden;
transient extractDateTimeMinuteStart=1 : hidden;
transient extractDateTimeSecondStart=1 : hidden;
meta extractDateTimeStart julian_date(extractDateTimeYearStart,extractDateTimeMonthStart,extractDateTimeDayStart,
extractDateTimeHourStart,extractDateTimeMinuteStart,extractDateTimeSecondStart) : hidden;
meta extractDateTimeStart julian_date(
extractDateTimeYearStart,extractDateTimeMonthStart,extractDateTimeDayStart,
extractDateTimeHourStart,extractDateTimeMinuteStart,extractDateTimeSecondStart) : hidden;
transient extractDateTimeYearEnd=2016 : hidden;
transient extractDateTimeMonthEnd=1 : hidden;
@ -61,8 +64,9 @@ transient extractDateTimeDayEnd=1 : hidden;
transient extractDateTimeHourEnd=1 : hidden;
transient extractDateTimeMinuteEnd=1 : hidden;
transient extractDateTimeSecondEnd=1 : hidden;
meta extractDateTimeEnd julian_date(extractDateTimeYearEnd,extractDateTimeMonthEnd,extractDateTimeDayEnd,
extractDateTimeHourEnd,extractDateTimeMinuteEnd,extractDateTimeSecondEnd) : hidden;
meta extractDateTimeEnd julian_date(
extractDateTimeYearEnd,extractDateTimeMonthEnd,extractDateTimeDayEnd,
extractDateTimeHourEnd,extractDateTimeMinuteEnd,extractDateTimeSecondEnd) : hidden;
transient extractDateTimeYearRank=1 : hidden;
transient extractDateTimeMonthRank=1 : hidden;
@ -77,7 +81,9 @@ meta doExtractDateTime bufr_extract_datetime_subsets(doExtractSubsets,numberOfSu
transient simpleThinningStart=1 : hidden;
transient simpleThinningMissingRadius=0 : hidden;
transient simpleThinningSkip=1 : hidden;
meta doSimpleThinning bufr_simple_thinning(doExtractSubsets,numberOfSubsets,extractSubsetList,simpleThinningStart,simpleThinningMissingRadius,simpleThinningSkip)=0 : hidden;
meta doSimpleThinning bufr_simple_thinning(
doExtractSubsets,numberOfSubsets,extractSubsetList,simpleThinningStart,simpleThinningMissingRadius,
simpleThinningSkip)=0 : hidden;
transient userDateStart = 0 : hidden;
transient userTimeStart = 0 : hidden;

View File

@ -232,6 +232,8 @@ static void init_class(grib_accessor_class* c)
#define PROCESS_NEW_DATA 1
#define PROCESS_ENCODE 2
#define OVERRIDDEN_REFERENCE_VALUES_KEY "inputOverriddenReferenceValues"
#ifdef ECCODES_ON_WINDOWS
#define round(a) ( (a) >=0 ? ((a)+0.5) : ((a)-0.5) )
#endif
@ -331,7 +333,7 @@ static int tableB_override_set_key(grib_handle* h, grib_accessor_bufr_data_array
size = grib_iarray_used_size(refValArray);
if (size > 0) {
refVals = grib_iarray_get_array(refValArray);
err=grib_set_long_array(h, "overriddenReferenceValues", refVals, size);
err=grib_set_long_array(h, OVERRIDDEN_REFERENCE_VALUES_KEY, refVals, size);
grib_context_free(h->context, refVals);
}
grib_iarray_delete(refValArray);
@ -2515,13 +2517,13 @@ static int process_elements(grib_accessor* a,int flag,long onlySubset,long start
self->elementsDescriptorsIndex=grib_viarray_new(c,100,100);
}
if (flag != PROCESS_DECODE) { /* Operator 203YYY: key "overriddenReferenceValues" */
err=grib_get_size(h, "overriddenReferenceValues", &self->refValListSize);
if (flag != PROCESS_DECODE) { /* Operator 203YYY: key OVERRIDDEN_REFERENCE_VALUES_KEY */
err=grib_get_size(h, OVERRIDDEN_REFERENCE_VALUES_KEY, &self->refValListSize);
if (err) return err;
if (self->refValList) grib_context_free(c, self->refValList);
if (self->refValListSize > 0) {
self->refValList=(long*)grib_context_malloc_clear(c, self->refValListSize*sizeof(long));
err=grib_get_long_array(grib_handle_of_accessor(a),"overriddenReferenceValues", self->refValList, &self->refValListSize);
err=grib_get_long_array(grib_handle_of_accessor(a),OVERRIDDEN_REFERENCE_VALUES_KEY, self->refValList, &self->refValListSize);
if (err) return err;
}
}

View File

@ -618,8 +618,8 @@ static void dump_section(grib_dumper* d, grib_accessor* a, grib_block_of_accesso
_dump_long_array(h,self->dumper.out,"delayedDescriptorReplicationFactor","inputDelayedDescriptorReplicationFactor");
_dump_long_array(h,self->dumper.out,"shortDelayedDescriptorReplicationFactor","inputShortDelayedDescriptorReplicationFactor");
_dump_long_array(h,self->dumper.out,"extendedDelayedDescriptorReplicationFactor","inputExtendedDelayedDescriptorReplicationFactor");
/* Do not show the overriddenReferenceValues array. That's more for ENCODING */
/*_dump_long_array(h,self->dumper.out,"overriddenReferenceValues","overriddenReferenceValues");*/
/* Do not show the inputOverriddenReferenceValues array. That's more for ENCODING */
/*_dump_long_array(h,self->dumper.out,"inputOverriddenReferenceValues","inputOverriddenReferenceValues");*/
grib_dump_accessors_block(d,block);
depth-=2;
} else if (!grib_inline_strcmp(a->name,"groupNumber")) {

View File

@ -529,8 +529,8 @@ static void dump_section(grib_dumper* d, grib_accessor* a, grib_block_of_accesso
_dump_long_array(h,self->dumper.out,"delayedDescriptorReplicationFactor","inputDelayedDescriptorReplicationFactor");
_dump_long_array(h,self->dumper.out,"shortDelayedDescriptorReplicationFactor","inputShortDelayedDescriptorReplicationFactor");
_dump_long_array(h,self->dumper.out,"extendedDelayedDescriptorReplicationFactor","inputExtendedDelayedDescriptorReplicationFactor");
/* Do not show the overriddenReferenceValues array. That's more for ENCODING */
/*_dump_long_array(h,self->dumper.out,"overriddenReferenceValues","overriddenReferenceValues");*/
/* Do not show the inputOverriddenReferenceValues array. That's more for ENCODING */
/*_dump_long_array(h,self->dumper.out,"inputOverriddenReferenceValues","inputOverriddenReferenceValues");*/
grib_dump_accessors_block(d,block);
depth-=2;
} else if (!grib_inline_strcmp(a->name,"groupNumber")) {

View File

@ -555,8 +555,8 @@ static void dump_section(grib_dumper* d, grib_accessor* a, grib_block_of_accesso
_dump_long_array(h,self->dumper.out,"delayedDescriptorReplicationFactor","inputDelayedDescriptorReplicationFactor");
_dump_long_array(h,self->dumper.out,"shortDelayedDescriptorReplicationFactor","inputShortDelayedDescriptorReplicationFactor");
_dump_long_array(h,self->dumper.out,"extendedDelayedDescriptorReplicationFactor","inputExtendedDelayedDescriptorReplicationFactor");
/* Do not show the overriddenReferenceValues array. That's more for ENCODING */
/* _dump_long_array(h,self->dumper.out,"overriddenReferenceValues","overriddenReferenceValues"); */
/* Do not show the inputOverriddenReferenceValues array. That's more for ENCODING */
/* _dump_long_array(h,self->dumper.out,"inputOverriddenReferenceValues","inputOverriddenReferenceValues"); */
grib_dump_accessors_block(d,block);
depth-=2;
} else if (!grib_inline_strcmp(a->name,"groupNumber")) {

View File

@ -567,8 +567,8 @@ static void dump_section(grib_dumper* d, grib_accessor* a, grib_block_of_accesso
_dump_long_array(h,self->dumper.out,"delayedDescriptorReplicationFactor","inputDelayedDescriptorReplicationFactor");
_dump_long_array(h,self->dumper.out,"shortDelayedDescriptorReplicationFactor","inputShortDelayedDescriptorReplicationFactor");
_dump_long_array(h,self->dumper.out,"extendedDelayedDescriptorReplicationFactor","inputExtendedDelayedDescriptorReplicationFactor");
/* Do not show the overriddenReferenceValues array. That's more for ENCODING */
/* _dump_long_array(h,self->dumper.out,"overriddenReferenceValues","overriddenReferenceValues"); */
/* Do not show the inputOverriddenReferenceValues array. That's more for ENCODING */
/* _dump_long_array(h,self->dumper.out,"inputOverriddenReferenceValues","inputOverriddenReferenceValues"); */
grib_dump_accessors_block(d,block);
depth-=2;
} else if (!grib_inline_strcmp(a->name,"groupNumber")) {

View File

@ -711,7 +711,7 @@ static void dump_section(grib_dumper* d, grib_accessor* a, grib_block_of_accesso
_dump_long_array(h,self->dumper.out,"delayedDescriptorReplicationFactor","inputDelayedDescriptorReplicationFactor");
_dump_long_array(h,self->dumper.out,"shortDelayedDescriptorReplicationFactor","inputShortDelayedDescriptorReplicationFactor");
_dump_long_array(h,self->dumper.out,"extendedDelayedDescriptorReplicationFactor","inputExtendedDelayedDescriptorReplicationFactor");
_dump_long_array(h,self->dumper.out,"overriddenReferenceValues","overriddenReferenceValues");
_dump_long_array(h,self->dumper.out,"inputOverriddenReferenceValues","inputOverriddenReferenceValues");
grib_dump_accessors_block(d,block);
depth-=2;
} else if (!grib_inline_strcmp(a->name,"groupNumber")) {

View File

@ -672,7 +672,7 @@ static void dump_section(grib_dumper* d, grib_accessor* a, grib_block_of_accesso
_dump_long_array(h,self->dumper.out,"delayedDescriptorReplicationFactor","inputDelayedDescriptorReplicationFactor");
_dump_long_array(h,self->dumper.out,"shortDelayedDescriptorReplicationFactor","inputShortDelayedDescriptorReplicationFactor");
_dump_long_array(h,self->dumper.out,"extendedDelayedDescriptorReplicationFactor","inputExtendedDelayedDescriptorReplicationFactor");
_dump_long_array(h,self->dumper.out,"overriddenReferenceValues","overriddenReferenceValues");
_dump_long_array(h,self->dumper.out,"inputOverriddenReferenceValues","inputOverriddenReferenceValues");
grib_dump_accessors_block(d,block);
depth-=2;
} else if (!grib_inline_strcmp(a->name,"groupNumber")) {

View File

@ -770,7 +770,7 @@ static void dump_section(grib_dumper* d, grib_accessor* a, grib_block_of_accesso
_dump_long_array(h,self->dumper.out,"delayedDescriptorReplicationFactor","inputDelayedDescriptorReplicationFactor");
_dump_long_array(h,self->dumper.out,"shortDelayedDescriptorReplicationFactor","inputShortDelayedDescriptorReplicationFactor");
_dump_long_array(h,self->dumper.out,"extendedDelayedDescriptorReplicationFactor","inputExtendedDelayedDescriptorReplicationFactor");
_dump_long_array(h,self->dumper.out,"overriddenReferenceValues","overriddenReferenceValues");
_dump_long_array(h,self->dumper.out,"inputOverriddenReferenceValues","inputOverriddenReferenceValues");
grib_dump_accessors_block(d,block);
depth-=2;
} else if (!grib_inline_strcmp(a->name,"groupNumber")) {

View File

@ -702,7 +702,7 @@ static void dump_section(grib_dumper* d, grib_accessor* a, grib_block_of_accesso
_dump_long_array(h,self->dumper.out,"delayedDescriptorReplicationFactor","inputDelayedDescriptorReplicationFactor");
_dump_long_array(h,self->dumper.out,"shortDelayedDescriptorReplicationFactor","inputShortDelayedDescriptorReplicationFactor");
_dump_long_array(h,self->dumper.out,"extendedDelayedDescriptorReplicationFactor","inputExtendedDelayedDescriptorReplicationFactor");
_dump_long_array(h,self->dumper.out,"overriddenReferenceValues","overriddenReferenceValues");
_dump_long_array(h,self->dumper.out,"inputOverriddenReferenceValues","inputOverriddenReferenceValues");
grib_dump_accessors_block(d,block);
depth-=2;
} else if (!grib_inline_strcmp(a->name,"groupNumber")) {

View File

@ -690,8 +690,8 @@ static void dump_section(grib_dumper* d, grib_accessor* a, grib_block_of_accesso
_dump_long_array(h,self->dumper.out,"delayedDescriptorReplicationFactor","inputDelayedDescriptorReplicationFactor");
_dump_long_array(h,self->dumper.out,"shortDelayedDescriptorReplicationFactor","inputShortDelayedDescriptorReplicationFactor");
_dump_long_array(h,self->dumper.out,"extendedDelayedDescriptorReplicationFactor","inputExtendedDelayedDescriptorReplicationFactor");
/* Do not show the overriddenReferenceValues array. That's more for ENCODING */
/*_dump_long_array(h,self->dumper.out,"overriddenReferenceValues","overriddenReferenceValues");*/
/* Do not show the inputOverriddenReferenceValues array. That's more for ENCODING */
/*_dump_long_array(h,self->dumper.out,"inputOverriddenReferenceValues","inputOverriddenReferenceValues");*/
grib_dump_accessors_block(d,block);
depth-=2;
} else if (!grib_inline_strcmp(a->name,"groupNumber")) {

View File

@ -33,7 +33,7 @@ cat > $tempRules <<EOF
set unpack=1;
print "h1=[heightOfStationGroundAboveMeanSeaLevel]";
print "h2=[heightOfBarometerAboveMeanSeaLevel]";
print "rv=[overriddenReferenceValues]";
print "rv=[inputOverriddenReferenceValues]";
print "rf1=[#1#heightOfStationGroundAboveMeanSeaLevel->reference]";
EOF

View File

@ -39,7 +39,7 @@ ${tools_dir}/codes_bufr_filter -o $tempBufr $tempRules $input
cat > $tempRules <<EOF
set unpack=1;
print " numSubs=[numberOfSubsets]";
print " refVals={[overriddenReferenceValues',']}";
print " refVals={[inputOverriddenReferenceValues',']}";
print " height=[heightOfStationGroundAboveMeanSeaLevel]";
print " height->ref=[heightOfStationGroundAboveMeanSeaLevel->reference]";
EOF