Testing: skip keys in Fortran

This commit is contained in:
shahramn 2024-08-17 12:22:17 +01:00
parent d13e558288
commit ef589bca1c
1 changed files with 9 additions and 7 deletions

View File

@ -15,13 +15,12 @@ program keys_iterator_skip
character(len=256) :: key
character(len=256) :: value
character(len=512) :: all1
integer :: grib_count
integer :: grib_count = 0
call codes_open_file(ifile, &
'../../data/regular_latlon_surface.grib1', 'r')
! Loop on all the messages in a file
grib_count = 0
do while (.true.)
call codes_grib_new_from_file(ifile, igrib, iret)
if (iret == CODES_END_OF_FILE) exit
@ -40,12 +39,15 @@ program keys_iterator_skip
do
call codes_keys_iterator_next(kiter, iret)
if (iret .ne. CODES_SUCCESS) exit !terminate the loop
if (iret .ne. CODES_SUCCESS) exit ! Terminate the loop
call codes_keys_iterator_get_name(kiter, key)
call codes_get(igrib, trim(key), value)
all1 = trim(key)//' = '//trim(value)
write (*, *) trim(all1)
! All keys should be skipped so should not get here
call codes_check(CODES_INTERNAL_ERROR, 'Error', 'iterator next should have failed')
!call codes_keys_iterator_get_name(kiter, key)
!call codes_get(igrib, trim(key), value)
!all1 = trim(key)//' = '//trim(value)
!write (*, *) trim(all1)
end do
call codes_keys_iterator_delete(kiter)