Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Starting from a BUFR file such as the one attached to this page, view its contents in the ECMWF BUFR validator
  2. Install ECC. No admin rights are necessary if making a local installation (-DCMAKE_INSTALL_PREFIX=<my_installation_path>)
  3. Using ecCodes, get a text (JSON) dump of the BUFR file above:
    1. BFILE=IOBD02LFPW070000.20161107000104_81607384_F.BU
    2. bufr_dump -j a ${BFILE} > ${BFILE}.json
      The resulting file (${BFILE}.json) can be opened in a browser.
  4. To create a new BUFR file using PYTHON

    1. bufr_dump -E python ${BFILE} > ${BFILE}.py
      This creates a python source (${BFILE}.py, as attached here)

    2. Create a new BUFR from the Python source code

      1. export PYTHONPATH=${PYTHONPATH}:<my_installation_path>/lib/python2.7/site-packages

      2. export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:<my_installation_path>/lib

      3. python2.7 ${BFILE}.py.txt
        This creates a BUFR file (outfile.bufr)

    3. Compare the contents of this BUFR with the original one:
      1. mv outfile.bufr outfilejson.bufr

      2. bufr_dump -j a outfilejson.bufr > outfilejson.bufrjson.txt

      3. diff outfilejson.bufrjson.txt ${BFILE}.json.txt
        No difference should be found.

  5. To create a new BUFR from FORTRAN

    1. bufr_dump -E fortran ${BFILE} > ${BFILE}.F90
      This creates a Fortran source (${BFILE}.F90, as attached here)

    2. Create a new BUFR from the Fortran source code

      1. gfortran ${BFILE}.F90 -o ${BFILE}.F90.x -L<my_installation_path>/lib -leccodes_f90 -leccodes -I<my_installation_path>/include

      2. export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:<my_installation_path>/lib

      3. ./${BFILE}.F90.x
        This creates a BUFR file (outfile.bufr)

    3. Compare the contents of this BUFR with the original one:

      1. mv outfile.bufr outfileF90.bufr

      2. bufr_dump -j a outfileF90.bufr > outfileF90.bufrjson.txt

      3. diff outfileF90.bufrjson.txt ${BFILE}.json.txt
        No difference should be found.