Skip to end of metadata
Go to start of metadata

The following keys allow the user to extract a set of BUFR subsets that pertain to a time interval:

  • extractDateTimeYearStart
  • extractDateTimeMonthStart
  • extractDateTimeDayStart
  • extractDateTimeHourStart
  • extractDateTimeMinuteStart
  • extractDateTimeSecondStart
  • extractDateTimeYearEnd
  • extractDateTimeMonthEnd
  • extractDateTimeDayEnd
  • extractDateTimeHourEnd
  • extractDateTimeMinuteEnd
  • extractDateTimeSecondEnd
  • doExtractDateTime
  • extractedDateTimeNumberOfSubsets

To explain the use of these keys the following example using the bufr_filter is provided, but please note that these same keys can be set using the Fortran and Python interfaces as well and no special functions have been implemented in the bufr_filter for this feature.

The following file "extract.filter" with bufr_filter can be used to perform the extraction of subsets from a BUFR message:

transient originalNumberOfSubsets = numberOfSubsets;
set unpack=1;
transient extractDateTimeYearStart=2012;
transient extractDateTimeMonthStart=10;
transient extractDateTimeDayStart=31;
transient extractDateTimeHourStart=0;
transient extractDateTimeMinuteStart=1;
transient extractDateTimeSecondStart=31.6;

transient extractDateTimeYearEnd=2012;
transient extractDateTimeMonthEnd=10;
transient extractDateTimeDayEnd=31;
transient extractDateTimeHourEnd=0;
transient extractDateTimeMinuteEnd=1;
transient extractDateTimeSecondEnd=39.6;

set doExtractDateTime=1; # This does an implicit 'pack'
if (extractedDateTimeNumberOfSubsets != 0) {

print "extracted [extractDateTimeNumberOfSubsets] of [originalNumberOfSubsets] subsets";

In line 1 we record the current (original) number of subsets. In lines 3 to 8 we specify the start of the time period and in lines 10 to 15 we specify the end of the period.
Finally in lines 17 to 20 we do the actual extraction and write out the message to the output BUFR file. The output will have just those subsets whose date/time are included in the time range specification above.

The final print message informs the user how many subsets were actually extracted during this process out of the original set. No output BUFR is written (the "write" statement not executed) unless there was at least one extracted subset.

This example can be used on any multi-subset input file in compressed form as follows:

> bufr_filter -o out.bufr extract.filter in.bufr