ECC-1235: Fortran examples: Show how to convert an error code into a string

This commit is contained in:
Shahram Najm 2021-04-26 14:10:58 +01:00
parent ec67e1293a
commit b07bc640b6
4 changed files with 9 additions and 9 deletions

View File

@ -34,7 +34,7 @@ if( HAVE_BUILD_TOOLS )
grib_count_messages_multi grib_count_messages_multi
grib_copy_namespace grib_copy_namespace
grib_read_message grib_read_message
read_from_file grib_read_from_file
grib_get_set_uuid grib_get_set_uuid
grib_clone grib_clone
bufr_attributes bufr_attributes
@ -75,7 +75,7 @@ else()
grib_samples grib_samples
grib_count_messages grib_count_messages
grib_count_messages_multi grib_count_messages_multi
read_from_file grib_read_from_file
grib_clone grib_clone
bufr_attributes bufr_attributes
bufr_clone bufr_clone

View File

@ -6,7 +6,7 @@ TESTS = grib_copy_message.sh grib_get_keys.sh grib_get_data.sh grib_get_pl.sh gr
grib_print_data.sh grib_set_keys.sh \ grib_print_data.sh grib_set_keys.sh \
grib_set_bitmap.sh grib_set_missing.sh grib_set_pv.sh grib_samples.sh grib_count_messages.sh \ grib_set_bitmap.sh grib_set_missing.sh grib_set_pv.sh grib_samples.sh grib_count_messages.sh \
grib_read_message.sh grib_count_messages_multi.sh \ grib_read_message.sh grib_count_messages_multi.sh \
read_from_file.sh grib_index.sh grib_get_set_uuid.sh \ grib_read_from_file.sh grib_index.sh grib_get_set_uuid.sh \
bufr_attributes.sh grib_clone.sh bufr_clone.sh \ bufr_attributes.sh grib_clone.sh bufr_clone.sh \
bufr_expanded.sh bufr_get_keys.sh bufr_get_string_array.sh \ bufr_expanded.sh bufr_get_keys.sh bufr_get_string_array.sh \
bufr_read_header.sh bufr_read_synop.sh \ bufr_read_header.sh bufr_read_synop.sh \
@ -35,7 +35,7 @@ noinst_PROGRAMS = eccodes_f_grib_index \
eccodes_f_grib_count_messages \ eccodes_f_grib_count_messages \
eccodes_f_grib_count_messages_multi \ eccodes_f_grib_count_messages_multi \
eccodes_f_grib_read_message \ eccodes_f_grib_read_message \
eccodes_f_read_from_file \ eccodes_f_grib_read_from_file \
eccodes_f_new_from_file \ eccodes_f_new_from_file \
eccodes_f_grib_copy_namespace \ eccodes_f_grib_copy_namespace \
eccodes_f_grib_get_set_uuid \ eccodes_f_grib_get_set_uuid \
@ -77,7 +77,7 @@ eccodes_f_grib_samples_SOURCES=grib_samples.f90
eccodes_f_grib_count_messages_SOURCES=grib_count_messages.f90 eccodes_f_grib_count_messages_SOURCES=grib_count_messages.f90
eccodes_f_grib_count_messages_multi_SOURCES=grib_count_messages_multi.f90 eccodes_f_grib_count_messages_multi_SOURCES=grib_count_messages_multi.f90
eccodes_f_grib_read_message_SOURCES=grib_read_message.f90 eccodes_f_grib_read_message_SOURCES=grib_read_message.f90
eccodes_f_read_from_file_SOURCES=read_from_file.f90 eccodes_f_grib_read_from_file_SOURCES=grib_read_from_file.f90
eccodes_f_new_from_file_SOURCES=new_from_file.f90 eccodes_f_new_from_file_SOURCES=new_from_file.f90
eccodes_f_grib_copy_namespace_SOURCES=grib_copy_namespace.f90 eccodes_f_grib_copy_namespace_SOURCES=grib_copy_namespace.f90
eccodes_f_grib_get_set_uuid_SOURCES=grib_get_set_uuid.f90 eccodes_f_grib_get_set_uuid_SOURCES=grib_get_set_uuid.f90

View File

@ -9,7 +9,7 @@
! Get message lengths using two different interfaces ! Get message lengths using two different interfaces
! See GRIB-292 ! See GRIB-292
! !
program read_from_file program grib_read_from_file
use eccodes use eccodes
implicit none implicit none
character(len=32) :: input_grib_file character(len=32) :: input_grib_file
@ -57,7 +57,7 @@ contains
if (iret /= CODES_END_OF_FILE) then if (iret /= CODES_END_OF_FILE) then
call codes_get_error_string(iret, error_message) call codes_get_error_string(iret, error_message)
write (*, *) 'error message: ', error_message write (*, *) 'error message: ', error_message
call codes_check(iret, 'read_from_file', '') call codes_check(iret, 'grib_read_from_file', '')
end if end if
call codes_close_file(ifile) call codes_close_file(ifile)
@ -94,7 +94,7 @@ contains
if (iret /= CODES_END_OF_FILE) then if (iret /= CODES_END_OF_FILE) then
call codes_get_error_string(iret, error_message) call codes_get_error_string(iret, error_message)
write (*, *) 'error message: ', error_message write (*, *) 'error message: ', error_message
call codes_check(iret, 'read_from_file', '') call codes_check(iret, 'grib_read_from_file', '')
end if end if
call codes_close_file(ifile) call codes_close_file(ifile)

View File

@ -13,4 +13,4 @@
# Check program completed successfully. We have to resort to testing # Check program completed successfully. We have to resort to testing
# the output as there is no way in Fortran to set the exit code # the output as there is no way in Fortran to set the exit code
# #
${examples_dir}/eccodes_f_read_from_file | grep 'Passed' ${examples_dir}/eccodes_f_grib_read_from_file | grep 'Passed'