mirror of https://github.com/ecmwf/eccodes.git
Examples: cleanup
This commit is contained in:
parent
26c9dc736e
commit
c87a7496d6
|
@ -16,27 +16,29 @@ program multi
|
||||||
use eccodes
|
use eccodes
|
||||||
implicit none
|
implicit none
|
||||||
|
|
||||||
integer :: iret
|
integer :: iret, counter
|
||||||
integer(kind=4) :: step
|
integer(kind=4) :: step
|
||||||
integer :: ifile, igrib
|
integer :: ifile, igrib
|
||||||
|
|
||||||
call codes_open_file(ifile, '../../data/multi_created.grib2', 'r')
|
call codes_open_file(ifile, '../../data/multi_created.grib2', 'r')
|
||||||
|
|
||||||
! turn on support for multi-field messages */
|
! Turn off support for multi-field messages
|
||||||
call codes_grib_multi_support_on()
|
call codes_grib_multi_support_off()
|
||||||
|
|
||||||
! turn off support for multi-field messages */
|
! Turn on support for multi-field messages
|
||||||
!call codes_grib_multi_support_off()
|
call codes_grib_multi_support_on()
|
||||||
|
|
||||||
! Loop on all the messages in a file
|
! Loop on all the messages in a file
|
||||||
write (*, *) 'step'
|
write (*, *) 'step'
|
||||||
do while (.true.)
|
do while (.true.)
|
||||||
call codes_grib_new_from_file(ifile, igrib, iret)
|
call codes_grib_new_from_file(ifile, igrib, iret)
|
||||||
if (iret == CODES_END_OF_FILE) exit
|
if (iret == CODES_END_OF_FILE) exit
|
||||||
|
counter = counter + 1
|
||||||
|
|
||||||
call codes_get(igrib, 'step', step)
|
call codes_get(igrib, 'step', step)
|
||||||
write (*, '(i3)') step
|
write (*, '(i3)') step
|
||||||
end do
|
end do
|
||||||
call codes_close_file(ifile)
|
call codes_close_file(ifile)
|
||||||
|
!write(*,*) 'Message count =', counter
|
||||||
|
|
||||||
end program multi
|
end program multi
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
|
|
||||||
. ./include.ctest.sh
|
. ./include.ctest.sh
|
||||||
|
|
||||||
${examples_dir}/eccodes_f_grib_multi > multi.out
|
temp='temp.eccodes_f_grib_multi.txt'
|
||||||
diff multi.out ${data_dir}/multi.ok
|
|
||||||
rm -f multi.out
|
${examples_dir}/eccodes_f_grib_multi > $temp
|
||||||
|
diff $temp ${data_dir}/multi.ok
|
||||||
|
rm -f $temp
|
||||||
|
|
|
@ -41,7 +41,7 @@ program precision
|
||||||
|
|
||||||
allocate (values1(size1), stat=iret)
|
allocate (values1(size1), stat=iret)
|
||||||
allocate (values2(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)
|
call codes_get(igrib, "values", values1)
|
||||||
|
|
||||||
! setting decimal precision=2 means that 2 decimal digits
|
! setting decimal precision=2 means that 2 decimal digits
|
||||||
|
|
|
@ -30,7 +30,7 @@ program set
|
||||||
call codes_set(igrib, 'dataDate', date1)
|
call codes_set(igrib, 'dataDate', date1)
|
||||||
call codes_set(igrib, 'type', marsType)
|
call codes_set(igrib, 'type', marsType)
|
||||||
|
|
||||||
! set centre as a integer */
|
! set centre as a integer
|
||||||
call codes_set(igrib, 'centre', centre)
|
call codes_set(igrib, 'centre', centre)
|
||||||
|
|
||||||
! check if it is correct in the actual GRIB message
|
! check if it is correct in the actual GRIB message
|
||||||
|
|
|
@ -17,23 +17,25 @@ program multi
|
||||||
use eccodes
|
use eccodes
|
||||||
implicit none
|
implicit none
|
||||||
|
|
||||||
integer :: iret
|
integer :: iret
|
||||||
integer(kind=4) :: parameterCategory, parameterNumber, discipline
|
integer(kind=4) :: parameterCategory, parameterNumber, discipline
|
||||||
integer :: ifile, igrib
|
integer :: ifile, igrib, counter
|
||||||
|
|
||||||
call codes_open_file(ifile, '../../data/multi.grib2', 'r')
|
call codes_open_file(ifile, '../../data/multi.grib2', 'r')
|
||||||
|
|
||||||
! Turn on support for multi-field messages */
|
! Turn off support for multi-field messages
|
||||||
call codes_grib_multi_support_on()
|
call codes_grib_multi_support_off()
|
||||||
|
|
||||||
! Turn off support for multi-field messages */
|
! Turn on support for multi-field messages
|
||||||
!call codes_grib_multi_support_off()
|
call codes_grib_multi_support_on()
|
||||||
|
|
||||||
call codes_grib_new_from_file(ifile, igrib)
|
call codes_grib_new_from_file(ifile, igrib)
|
||||||
! Loop on all the messages in a file.
|
! Loop on all the messages in a file.
|
||||||
|
|
||||||
do while (igrib .ne. -1)
|
do while (igrib .ne. -1)
|
||||||
|
|
||||||
|
counter = counter + 1
|
||||||
|
|
||||||
! get as a integer*4
|
! get as a integer*4
|
||||||
call codes_get(igrib, 'discipline', discipline)
|
call codes_get(igrib, 'discipline', discipline)
|
||||||
write (*, *) 'discipline=', discipline
|
write (*, *) 'discipline=', discipline
|
||||||
|
@ -63,4 +65,6 @@ program multi
|
||||||
end do
|
end do
|
||||||
call codes_close_file(ifile)
|
call codes_close_file(ifile)
|
||||||
|
|
||||||
|
write(*,*) 'Message count =',counter
|
||||||
|
|
||||||
end program multi
|
end program multi
|
||||||
|
|
|
@ -40,7 +40,7 @@ program precision
|
||||||
|
|
||||||
allocate (values1(size), stat=iret)
|
allocate (values1(size), stat=iret)
|
||||||
allocate (values2(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)
|
call codes_get(igrib, "values", values1)
|
||||||
|
|
||||||
! setting decimal precision=2 means that 2 decimal digits
|
! setting decimal precision=2 means that 2 decimal digits
|
||||||
|
|
|
@ -33,7 +33,7 @@ program set
|
||||||
! igrib is the grib id to be used in subsequent calls
|
! igrib is the grib id to be used in subsequent calls
|
||||||
call codes_grib_new_from_file(infile, igrib)
|
call codes_grib_new_from_file(infile, igrib)
|
||||||
|
|
||||||
! set centre as a long */
|
! set centre as a long
|
||||||
centre = 80
|
centre = 80
|
||||||
call codes_set(igrib, 'centre', centre)
|
call codes_set(igrib, 'centre', centre)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue