...
- Starting from a BUFR file such as the one attached to this page, view its contents in the ECMWF BUFR validator
- Install ECC. No admin rights are necessary if making a local installation (-DCMAKE_INSTALL_PREFIX=<my_installation_path>)
- Using ecCodes, get a text (JSON) dump of the BUFR file above:
- BFILE=IOBD02LFPW070000.20161107000104_81607384_F.BU
- bufr_dump -j a ${BFILE} > ${BFILE}.json
The resulting file (${BFILE}.json) can be opened in a browser.
To create a new BUFR file using PYTHON
bufr_dump -E python ${BFILE} > ${BFILE}.py
This creates a python source (${BFILE}.py, as attached here)Create a new BUFR from the Python source code
export PYTHONPATH=${PYTHONPATH}:<my_installation_path>/lib/python2.7/site-packages
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:<my_installation_path>/lib
python2.7 ${BFILE}.py.txt
This creates a BUFR file (outfile.bufr)
- Compare the contents of this BUFR with the original one:
mv outfile.bufr outfilejson.bufr
bufr_dump -j a outfilejson.bufr > outfilejson.bufrjson.txt
diff outfilejson.bufrjson.txt ${BFILE}.json.txt
No difference should be found.
To create a new BUFR from FORTRAN
bufr_dump -E fortran ${BFILE} > ${BFILE}.F90
This creates a Fortran source (${BFILE}.F90, as attached here)Create a new BUFR from the Fortran source code
gfortran ${BFILE}.F90 -o ${BFILE}.F90.x -L<my_installation_path>/lib -leccodes_f90 -leccodes -I<my_installation_path>/include
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:<my_installation_path>/lib
./${BFILE}.F90.x
This creates a BUFR file (outfile.bufr)
Compare the contents of this BUFR with the original one:
mv outfile.bufr outfileF90.bufr
bufr_dump -j a outfileF90.bufr > outfileF90.bufrjson.txt
diff outfileF90.bufrjson.txt ${BFILE}.json.txt
No difference should be found.