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 1: Basic skills

Introduction

This practice is to help first-time BUFR users to start compiling and running BUFR processing code.

Getting the Sample Codes

Please go to Examples/basic to download the first two examples and its BUFR table to a location space:

  • encode_temperature.f90
  • decode_temperature.f90
  • bufrtable.txt

Here we assume the above files have be copied to a directory under comGSI/util/test. So the BUFRLIB library is located at ../../lib/libbufr_i4r8.a related to this test directory.

Encode/Write to a BUFR file

This example is to open a BUFR file called "t.bufr" and write a temperature observation 10.15 into it. We can use the following two steps to compile the code:

pgf90 -c encode_temperature.f90
pgf90 -o encodeT.exe encode_temperature.o -L../../lib -lbufr_i4r8

 

User may notice that these two steps are standard fortran code compiling process. The special point of the compiling BUFR code is to link the BUFRLIB library at the link step.

 

Also, please note we are using PGI compiler here as an example. Users should use the same compiler as used for compiling BUFRLIB or community GSI.

After got the executable encodeT.exe. We can run it as:

./encodeT.exe

A new BUFR file called "t.bufr" will show up in the working directory. Please note that the BUFR encoding needs an existing BUFR table, which is text file bufrtable.txt we have downloaded with the code and saved in the same directory.

Decode/Read from a BUFR file

This example is to read the temperature observation 10.15 out from the BUFR file "t.bufr", which we created in the practice before. We can use the same two steps to compile the code:

pgf90 -c decode_temperature.f90
pgf90 -o decodeT.exe decode_temperature.o -L../../lib -lbufr_i4r8

After got the executable decodeT.exe. We can run it as:

./decodeT.exe

A line will show up on screen to give the temperature observation that just reading in:

10.10000000000000