Testing: F90 get_elements

This commit is contained in:
Shahram Najm 2023-12-30 17:56:53 +00:00
parent abd4d80d2a
commit 96edabfea1
4 changed files with 57 additions and 6 deletions

View File

@ -33,6 +33,7 @@ if( HAVE_BUILD_TOOLS )
grib_keys_iterator_skip
grib_multi_write
grib_multi
grib_elements
grib_nearest
grib_nearest_single
grib_precision
@ -86,6 +87,7 @@ else()
grib_keys_iterator_skip
grib_multi
grib_nearest
grib_elements
grib_nearest_single
grib_precision
grib_print_data

View File

@ -0,0 +1,37 @@
! (C) Copyright 2005- ECMWF.
!
! This software is licensed under the terms of the Apache Licence Version 2.0
! which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
!
! In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
! virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
!
!
program grib_get_elements
use eccodes
implicit none
integer :: infile
integer :: igrib, i
real(4) :: values_real4(4)
real(8) :: values_real8(4)
integer :: array_of_indexes(4)
call codes_open_file(infile, '../../data/reduced_gaussian_pressure_level.grib1', 'r')
call codes_grib_new_from_file(infile, igrib)
array_of_indexes = [1, 0, 2, 4]
call codes_get_element(igrib, "values", array_of_indexes, values_real4)
do i = 1, 4
print *, i, array_of_indexes(i), values_real4(i)
end do
call codes_get_element(igrib, "values", array_of_indexes, values_real8)
do i = 1, 4
print *, i, array_of_indexes(i), values_real8(i)
end do
call codes_release(igrib)
call codes_close_file(infile)
end program

12
examples/F90/grib_elements.sh Executable file
View File

@ -0,0 +1,12 @@
#!/bin/sh
# (C) Copyright 2005- ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
#
# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
. ./include.ctest.sh
${examples_dir}/eccodes_f_grib_elements

View File

@ -2316,7 +2316,7 @@
if (present(status)) then
status = iret
else
call grib_check(iret, 'get', key)
call grib_check(iret, 'get_real4_elements', key)
end if
end subroutine grib_get_real4_elements
@ -2348,7 +2348,7 @@
if (present(status)) then
status = iret
else
call grib_check(iret, 'get', key)
call grib_check(iret, 'get_real8_elements', key)
end if
end subroutine grib_get_real8_elements
@ -2649,7 +2649,7 @@
if (present(status)) then
status = iret
else
call grib_check(iret, 'set', key)
call grib_check(iret, 'set_force_real4_array', key)
end if
end subroutine grib_set_force_real4_array
@ -2680,7 +2680,7 @@
if (present(status)) then
status = iret
else
call grib_check(iret, 'set', key)
call grib_check(iret, 'set_force_real8_array', key)
end if
end subroutine grib_set_force_real8_array
@ -3057,7 +3057,7 @@
if (present(status)) then
status = iret
else
call grib_check(iret, 'grib_gribex_mode_on', '')
call grib_check(iret, 'gribex_mode_on', '')
end if
end subroutine grib_gribex_mode_on
@ -3077,7 +3077,7 @@
if (present(status)) then
status = iret
else
call grib_check(iret, 'grib_gribex_mode_off', '')
call grib_check(iret, 'gribex_mode_off', '')
end if
end subroutine grib_gribex_mode_off