There are new keys to allow the user to extract an area from BUFR data:
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:
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: