Examples: Fortran dump both GRIB and BUFR

This commit is contained in:
Shahram Najm 2023-08-22 16:39:14 +01:00
parent 08989dde14
commit cf3ea9b924
2 changed files with 14 additions and 11 deletions

View File

@ -10,22 +10,25 @@
program grib_dump_test
use eccodes
implicit none
integer :: ifile
integer :: iret
integer :: count1 = 0
integer :: msgid
integer :: ifile, iret, msgid
integer :: product_kind
character(len=10) :: product_string
character(len=100) :: infile_name
call getarg(1, infile_name)
call getarg(1, product_string)
product_kind = CODES_PRODUCT_GRIB
if (product_string == "bufr") product_kind = CODES_PRODUCT_BUFR
call getarg(2, infile_name)
call codes_open_file(ifile, infile_name, 'r')
print *, "===== FILE:", infile_name
do while (.true.)
call codes_any_new_from_file(ifile, msgid, iret)
call codes_new_from_file(ifile, msgid, product_kind, iret)
!call codes_any_new_from_file(ifile, msgid, iret)
if (iret == CODES_END_OF_FILE) exit
count1 = count1 + 1
print *, "===== Message #", count1
call codes_dump(msgid)
call codes_release(msgid)

View File

@ -9,5 +9,5 @@
. ./include.ctest.sh
${examples_dir}/eccodes_f_codes_dump ${data_dir}/sample.grib2
${examples_dir}/eccodes_f_codes_dump ${data_dir}/bufr/airs_57.bufr
${examples_dir}/eccodes_f_codes_dump grib ${data_dir}/sample.grib2
${examples_dir}/eccodes_f_codes_dump bufr ${data_dir}/bufr/airs_57.bufr