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:
- Change into the
comGSI/util/bufr_tools
- 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 namedsample.bufr
, which includes a single observation. - Running:
./bufr_decode_sample.exe
reads the bufr filesample.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 tosample.bufr
. - Now running
./bufr_decode_sample.exe
a second time, will show that a second observation has been appended to the filesample.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 fileprepbufr
, which includes a sounding observation. - Running
./prepbufr_decode_all.exe
reads the observations from the fileprepbufr
, 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 fileprepbufr
. - Running
./prepbufr_decode_all.exe
reads the observations from the fileprepbufr
, 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 fileprepbufr
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 fileprepbufr
. 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.