ECC-1136: Add to API

This commit is contained in:
Shahram Najm 2020-12-07 16:43:08 +00:00
parent 352f65852a
commit b60e717c59
3 changed files with 14 additions and 1 deletions

View File

@ -195,6 +195,7 @@ static int bufr_decode_rdb_keys(const void* message, long offset_section2, codes
hdr->rectimeHour = (long)grib_decode_unsigned_long(p, &start, 5);
hdr->rectimeMinute = (long)grib_decode_unsigned_long(p, &start, 6);
hdr->rectimeSecond = (long)grib_decode_unsigned_long(p, &start, 6);
hdr->restricted = (long)grib_decode_unsigned_long(p, &start, 1);
hdr->qualityControl = (long)grib_decode_unsigned_long(pMessage, &pos_qualityControl, nbits_qualityControl);
hdr->newSubtype = (long)grib_decode_unsigned_long(pMessage, &pos_newSubtype, nbits_newSubtype);
@ -1010,6 +1011,12 @@ int codes_bufr_header_get_string(codes_bufr_header* bh, const char* key, char* v
else
strcpy(val, NOT_FOUND);
}
else if (strcmp(key, "restricted") == 0) {
if (isEcmwfLocal)
*len = sprintf(val, "%ld", bh->restricted);
else
strcpy(val, NOT_FOUND);
}
else if (strcmp(key, "isSatellite") == 0) {
if (isEcmwfLocal)
*len = sprintf(val, "%ld", bh->isSatellite);

View File

@ -1636,6 +1636,7 @@ typedef struct codes_bufr_header
long rectimeHour;
long rectimeMinute;
long rectimeSecond;
long restricted;
long isSatellite;
double localLongitude1;

View File

@ -203,7 +203,7 @@ tropical_cyclone.bufr
tros_31.bufr
"
KEYS='localLongitude1,localLatitude1,localLongitude2,localLatitude2,localNumberOfObservations,satelliteID'
KEYS='localLongitude1,localLatitude1,localLongitude2,localLatitude2,localNumberOfObservations,satelliteID,restricted'
for bf in ${bufr_files}; do
input=${data_dir}/bufr/$bf
$EXEC ${test_dir}/bufr_extract_headers $KEYS $input > $temp1
@ -211,6 +211,11 @@ for bf in ${bufr_files}; do
diff $temp1 $temp2
done
# Test restricted
${tools_dir}/bufr_set -s restricted=1 ${data_dir}/bufr/aaen_55.bufr $temp1
r=`$EXEC ${test_dir}/bufr_extract_headers restricted $temp1`
[ "$r" = "1" ]
echo "Test with invalid inputs..."
# ---------------------------------