Examples: cleanup

This commit is contained in:
Shahram Najm 2023-08-25 18:44:07 +01:00
parent 26c9dc736e
commit c87a7496d6
7 changed files with 26 additions and 18 deletions

View File

@ -16,27 +16,29 @@ program multi
use eccodes
implicit none
integer :: iret
integer :: iret, counter
integer(kind=4) :: step
integer :: ifile, igrib
call codes_open_file(ifile, '../../data/multi_created.grib2', 'r')
! turn on support for multi-field messages */
call codes_grib_multi_support_on()
! Turn off support for multi-field messages
call codes_grib_multi_support_off()
! turn off support for multi-field messages */
!call codes_grib_multi_support_off()
! Turn on support for multi-field messages
call codes_grib_multi_support_on()
! Loop on all the messages in a file
write (*, *) 'step'
do while (.true.)
call codes_grib_new_from_file(ifile, igrib, iret)
if (iret == CODES_END_OF_FILE) exit
counter = counter + 1
call codes_get(igrib, 'step', step)
write (*, '(i3)') step
end do
call codes_close_file(ifile)
!write(*,*) 'Message count =', counter
end program multi

View File

@ -9,6 +9,8 @@
. ./include.ctest.sh
${examples_dir}/eccodes_f_grib_multi > multi.out
diff multi.out ${data_dir}/multi.ok
rm -f multi.out
temp='temp.eccodes_f_grib_multi.txt'
${examples_dir}/eccodes_f_grib_multi > $temp
diff $temp ${data_dir}/multi.ok
rm -f $temp

View File

@ -41,7 +41,7 @@ program precision
allocate (values1(size1), stat=iret)
allocate (values2(size1), stat=iret)
! get data values before changing the packing parameters*/
! get data values before changing the packing parameters
call codes_get(igrib, "values", values1)
! setting decimal precision=2 means that 2 decimal digits

View File

@ -30,7 +30,7 @@ program set
call codes_set(igrib, 'dataDate', date1)
call codes_set(igrib, 'type', marsType)
! set centre as a integer */
! set centre as a integer
call codes_set(igrib, 'centre', centre)
! check if it is correct in the actual GRIB message

View File

@ -17,23 +17,25 @@ program multi
use eccodes
implicit none
integer :: iret
integer :: iret
integer(kind=4) :: parameterCategory, parameterNumber, discipline
integer :: ifile, igrib
integer :: ifile, igrib, counter
call codes_open_file(ifile, '../../data/multi.grib2', 'r')
! Turn on support for multi-field messages */
call codes_grib_multi_support_on()
! Turn off support for multi-field messages
call codes_grib_multi_support_off()
! Turn off support for multi-field messages */
!call codes_grib_multi_support_off()
! Turn on support for multi-field messages
call codes_grib_multi_support_on()
call codes_grib_new_from_file(ifile, igrib)
! Loop on all the messages in a file.
do while (igrib .ne. -1)
counter = counter + 1
! get as a integer*4
call codes_get(igrib, 'discipline', discipline)
write (*, *) 'discipline=', discipline
@ -63,4 +65,6 @@ program multi
end do
call codes_close_file(ifile)
write(*,*) 'Message count =',counter
end program multi

View File

@ -40,7 +40,7 @@ program precision
allocate (values1(size), stat=iret)
allocate (values2(size), stat=iret)
! get data values before changing the packing parameters*/
! get data values before changing the packing parameters
call codes_get(igrib, "values", values1)
! setting decimal precision=2 means that 2 decimal digits

View File

@ -33,7 +33,7 @@ program set
! igrib is the grib id to be used in subsequent calls
call codes_grib_new_from_file(infile, igrib)
! set centre as a long */
! set centre as a long
centre = 80
call codes_set(igrib, 'centre', centre)