mirror of https://github.com/ecmwf/eccodes.git
Examples: Fortran is_defined
This commit is contained in:
parent
1aaf720183
commit
8d6b11772a
|
@ -26,7 +26,7 @@ program grib_get_keys
|
|||
real, dimension(:), allocatable :: values
|
||||
integer :: numberOfValues
|
||||
real :: average, min_val, max_val
|
||||
integer :: is_missing
|
||||
integer :: is_missing, is_defined
|
||||
character(len=10) :: open_mode = 'r'
|
||||
|
||||
call codes_open_file(ifile, '../../data/reduced_latlon_surface.grib1', open_mode)
|
||||
|
@ -38,9 +38,14 @@ program grib_get_keys
|
|||
call codes_grib_new_from_file(ifile, igrib, iret)
|
||||
if (iret == CODES_END_OF_FILE) exit LOOP
|
||||
|
||||
! check key is defined
|
||||
is_defined = 0
|
||||
call codes_is_defined(igrib, 'Ni', is_defined)
|
||||
write (*, *) 'Key Ni is defined? ', is_defined
|
||||
|
||||
! check if the value of the key is MISSING
|
||||
is_missing = 0;
|
||||
call codes_is_missing(igrib, 'Ni', is_missing);
|
||||
is_missing = 0
|
||||
call codes_is_missing(igrib, 'Ni', is_missing)
|
||||
if (is_missing /= 1) then
|
||||
! key value is not missing so get as an integer
|
||||
call codes_get(igrib, 'Ni', numberOfPointsAlongAParallel)
|
||||
|
|
|
@ -9,4 +9,4 @@
|
|||
|
||||
. ./include.ctest.sh
|
||||
|
||||
${examples_dir}/eccodes_f_grib_get_keys > /dev/null
|
||||
${examples_dir}/eccodes_f_grib_get_keys
|
||||
|
|
Loading…
Reference in New Issue