Skip to end of metadata
Go to start of metadata

There are new keys to allow the user to extract an area from BUFR data:

  • extractAreaNorthLatitude
  • extractAreaSouthLatitude
  • extractAreaWestLongitude
  • extractAreaEastLongitude
  • extractAreaLongitudeRank
  • doExtractArea
  • extractedAreaNumberOfSubsets

In release 2.0.0 the implementation of this feature is limited to compressed data. Implementation for uncompressed data will come in a future release.

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 extractAreaNorthLatitude=52.5;
set extractAreaSouthLatitude=51.1;
set extractAreaWestLongitude=155.2;
set extractAreaEastLongitude=160.5;
set extractAreaLongitudeRank=1;

set doExtractArea=1;
if (extractedAreaNumberOfSubsets != 0) {

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

In line 1 we record the current (original) number of subsets. In lines 3 and 4 we specify the north and south latitudes of the bounding box and in lines 5 and 6 we specify the west and east longitudes.
The area extraction criteria are applied by default to latitude and longitude keys with rank=1, but this can be modified using the keys extractAreaLongitudeRank and extractAreaLatitudeRank. As an example if extractAreaLongitudeRank=2 the boundaries for longitude are applied to #2#longitude not to #1#longitude.
Finally in lines 9 to 12 we do the actual extraction and write out the message to the output BUFR file. The output will have just those subsets whose bounds are included in the latitude/longitude specification above (Note: the extraction is made including the box boundaries)

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


  • No labels