ECC-1316: added test

This commit is contained in:
Shahram Najm 2021-12-01 22:03:19 +00:00
parent d3b83b44fc
commit 356dc20280
4 changed files with 63 additions and 1 deletions

View File

@ -38,6 +38,7 @@ if( HAVE_BUILD_TOOLS )
grib_read_from_file
grib_get_set_uuid
grib_clone
grib_ecc-1316
bufr_attributes
bufr_copy_data
bufr_clone

View File

@ -0,0 +1,48 @@
! (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_ecc_1316
use eccodes
implicit none
integer :: iret, ostep, olevel, onumber
character(len=80) :: parameterName
integer :: idx, igrib, count1 = 0
! create an index from a grib file using some keys
call codes_index_create(idx, '../../data/tigge_cf_ecmwf.grib2', &
'parameterName,number,level,step')
call codes_index_select(idx, 'step', 96)
call codes_index_select(idx, 'level', 0)
call codes_index_select(idx, 'number', 0)
call codes_index_select(idx, 'parameterName', 'Soil moisture')
call codes_new_from_index(idx, igrib, iret)
do while (iret /= CODES_END_OF_INDEX)
count1 = count1 + 1
call codes_get(igrib, 'parameterName', parameterName)
call codes_get(igrib, 'number', onumber)
call codes_get(igrib, 'level', olevel)
call codes_get(igrib, 'step', ostep)
write (*, '(A,A,A,i3,A,i4,A,i3)') 'parameterName=', parameterName, &
' number=', onumber, &
' level=', olevel, &
' step=', ostep
call codes_release(igrib)
call codes_new_from_index(idx, igrib, iret)
end do
call codes_release(igrib)
write (*, '(i4,a)') count1, ' messages selected'
if (count1 /= 1) stop 1
call codes_index_release(idx)
end program grib_ecc_1316

13
examples/F90/grib_ecc-1316.sh Executable file
View File

@ -0,0 +1,13 @@
#!/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.sh
exec ${examples_dir}/eccodes_f_grib_ecc-1316

View File

@ -30,4 +30,4 @@ ${tools_dir}/grib_compare -c data:n $tempSimple $tempCCSDS
${tools_dir}/grib_compare -c data:n $tempSimple $tempSecond
rm -f $tempSimple $tempCCSDS
rm -f $tempSimple $tempCCSDS $tempSecond