Removal of Content Advisory - April 2024

Advisory to Gridpoint Statistical Interpolation (GSI) users: As of the beginning of April 2024, all support assets for Gridpoint Statistical Interpolation (GSI) will be removed from the DTC website. Users should download all reference materials of interest prior to April 2024.

BUFR/PREPBUFR Tutorial | Practice 2: BUFR tools with GSI release version 3.0

Introduction

This practice is to learn the use of the BUFR tools within the community GSI release version 3. The practice is adopted from the similar exercise for the Summer 2011 Tutoral.

Building the Sample Codes

The source code for this exercise is contained in the community GSI package under directory: comGSI_v3/util/bufr_tools . Or you can download the single file from: Examples. For practice, you should have already compiled the community GSI release version 3.0, which gave a BUFRLIB library. The source code for the BUFR tools should then be located in: comGSI_v3/util/bufr_tools

Now, user can following the next two steps to compile all the examples:

  1. Change into the comGSI/util/bufr_tools
  2. Compile the source: ./make

During compiling, the following message will show up on screen and repeat for each BUFR files:

pgf90 -O2 -c bufr_encode_sample.f90
pgf90 -o bufr_encode_sample.exe -O2 bufr_encode_sample.o -L../../lib -lbufr_i4r8
rm bufr_encode_sample.o

The users can compile a single file using the above compile command.

Once compiled, you will see 10 executables, with .exe suffixes. There are two sets of executables:

The first set ends with the _sample suffix. These codes illustrate basic code structures of fortran code for BUFR file encoding, decoding, and appending:

  • bufr_encode_sample.exe
  • bufr_decode_sample.exe
  • bufr_append_sample.exe

The second set either starts with the prepbufr_ prefix or the _radiance suffix, and is an extension of the first set to PrepBUFR and/or radiance BUFR files.

The second group of codes illustrates how to process BUFR/PrepBUFR files that GSI can use:

  • prepbufr_encode_upperair.exe
  • prepbufr_encode_surface.exe
  • prepbufr_decode_all.exe
  • bufr_decode_radiance.exe
  • prepbufr_append_upperair.exe
  • prepbufr_append_surface.exe
  • prepbufr_append_retrieve.exe

Running the simple examples

To illustrate the processing of BUFR/PrepBUFR files, consider the following three simple examples:

  • Running ./bufr_encode_sample.exe generates a bufr file named sample.bufr, which includes a single observation.
  • Running: ./bufr_decode_sample.exe reads the bufr file sample.bufr, and displays the single observation in it. when run it should display:

    2008120100 1 ADPUPA
    1 1 75.0 30.0 -0.1 287.1

  • Running the code ./bufr_append_sample.exe appends a new observation to sample.bufr.
  • Now running ./bufr_decode_sample.exe a second time, will show that a second observation has been appended to the file sample.bufr by running ./bufr_append_sample.exe .

    2008120100 1 ADPUPA
    1 1 75.0 30.0 -0.1 287.1
    2008120101 2 ADPSFC
    1 1 85.0 50.0 0.2 300.0

Running the BUFR/PrepBUFR samples

The exact same steps can be taken with the PrepBUFR executables.

  • Running ./prepbufr_encode_upperair.exe generates a PrepBUFR file prepbufr, which includes a sounding observation.
  • Running ./prepbufr_decode_all.exe reads the observations from the file prepbufr, and displays the observation information. Please compare your standard out with that at the link. Notice that two observations have been appended to the file.
  • Running ./prepbufr_append_surface.exe appends a surface observation to the PrepBUFR file prepbufr.
  • Running ./prepbufr_decode_all.exe reads the observations from the file prepbufr, and displays the observation information. Please compare your standard out with that at the link. Note that the two new surface observations have been added to the file.
  • Running ./prepbufr_encode_surface.exe will encode the PrepBUFR file prepbufr with a completely new surface observation, wiping out the previous observations. Check this by running ./prepbufr_decode_all.exe.
  • Likewise, running ./prepbufr_append_upperair.exe will append a sounding observation to the file prepbufr. Once again, running ./prepbufr_decode_all.exe display the contents of PrepBufr file. Please compare your standard out with that at the link.
  • To append a retrieved data to an existing PrepBUFR file, we can use ./prepbufr_append_retrieve.exe. Once again, use ./prepbufr_decode_all.exe to check the content. The correct output is here.

Please pay attention to the the message type in the BUFR file. This indicates the observation type. Running ./prepbufr_decode_all.exe and ./bufr_decode_radiance.exe can be used to check the content of the real BUFR/PrepBUFR files, with the difference being that these executables dump out a greater amount of information than the sample files.