eccodes
 All Data Structures Namespaces Files Functions Groups Pages
Public Member Functions
eccodes::codes_get Interface Reference

Get the value for a key from a grib message. More...

Public Member Functions

subroutine codes_get_int (msgid, key, value, status)
 Get the integer value of a key from a message. More...
 
subroutine codes_get_long (msgid, key, value, status)
 Get the integer value of a key from a message. More...
 
subroutine codes_get_real4 (msgid, key, value, status)
 Get the real(4) value of a key from a message. More...
 
subroutine codes_get_real8 (msgid, key, value, status)
 Get the real(8) value of a key from a message. More...
 
subroutine codes_get_string (msgid, key, value, status)
 Get the character value of a key from a message. More...
 
subroutine codes_get_byte_array (msgid, key, value, length, status)
 Get the array of bytes (character) for a key from a message. More...
 
subroutine codes_get_int_array (msgid, key, value, status)
 Get the integer array of values for a key from a message. More...
 
subroutine codes_get_real4_array (msgid, key, value, status)
 Get the real(4) array of values for a key from a message. More...
 
subroutine codes_get_real8_array (msgid, key, value, status)
 Get the real(8) array of values for a key from a message. More...
 

Detailed Description

Get the value for a key from a grib message.

Given a gribid and key as input a value for the key is returned. In some cases the value can be an array rather than a scalar. As examples of array keys we have "values","pl", "pv" respectively the data values, the list of number of points for each latitude in a reduced grid and the list of vertical levels. In these cases the value array must be allocated by the caller and their required dimension can be obtained with codes_get_size.
The value can be integer(4), real(4), real(8), character. Although each key has its own native type, a key of type integer can be retrieved (with codes_get) as real(4), real(8) or character. Analogous conversions are always provided when possible. Illegal conversions are real to integer and character to any other type.

The gribid references to a grib message loaded in memory.

In case of error, if the status parameter (optional) is not given, the program will exit with an error message.
Otherwise the error message can be gathered with codes_get_error_string.

Examples: grib_get_keys.f90, grib_print_data.f90

See Also
codes_new_from_file, codes_release, codes_set
Parameters
[in]gribidid of the message loaded in memory
[in]keykey name
[out]valuevalue can be a scalar or array of integer(4),real(4),real(8),character
[out]statusCODES_SUCCESS if OK, integer value on error

Member Function/Subroutine Documentation

subroutine codes_get_byte_array ( integer(kind=kindofint), intent(in)  msgid,
character(len=*), intent(in)  key,
character(len=1), dimension(:), intent(inout)  value,
integer(kind=kindofint), intent(out), optional  length,
integer(kind=kindofint), intent(out), optional  status 
)

Get the array of bytes (character) for a key from a message.

In case of error, if the status parameter (optional) is not given, the program will exit with an error message.
Otherwise the error message can be gathered with codes_get_error_string.

Parameters
msgidid of the message loaded in memory
keykey name
valuecharacter(len=1) array of byte values
length(optional) output: number of values retrieved
status(optional) CODES_SUCCESS if OK, integer value on error
subroutine codes_get_int ( integer(kind=kindofint), intent(in)  msgid,
character(len=*), intent(in)  key,
integer(kind = kindofint), intent(out)  value,
integer(kind=kindofint), intent(out), optional  status 
)

Get the integer value of a key from a message.

In case of error, if the status parameter (optional) is not given, the program will exit with an error message.
Otherwise the error message can be gathered with codes_get_error_string.

Parameters
msgidid of the message loaded in memory
keykey name
valuethe integer(4) value
statusCODES_SUCCESS if OK, integer value on error
subroutine codes_get_int_array ( integer(kind=kindofint), intent(in)  msgid,
character(len=*), intent(in)  key,
integer(kind=kindofint), dimension(:), intent(inout), allocatable  value,
integer(kind=kindofint), intent(out), optional  status 
)

Get the integer array of values for a key from a message.

In case of error, if the status parameter (optional) is not given, the program will exit with an error message.
Otherwise the error message can be gathered with codes_get_error_string.
Note: This function supports the allocatable array attribute

Parameters
msgidid of the message loaded in memory
keykey name
valueinteger(4) array value
statusCODES_SUCCESS if OK, integer value on error
subroutine codes_get_long ( integer(kind=kindofint), intent(in)  msgid,
character(len=*), intent(in)  key,
integer(kind = kindoflong), intent(out)  value,
integer(kind=kindofint), intent(out), optional  status 
)

Get the integer value of a key from a message.

In case of error, if the status parameter (optional) is not given, the program will exit with an error message.
Otherwise the error message can be gathered with codes_get_error_string.

Parameters
msgidid of the message loaded in memory
keykey name
valuethe integer(4) value
statusCODES_SUCCESS if OK, integer value on error
subroutine codes_get_real4 ( integer(kind=kindofint), intent(in)  msgid,
character(len=*), intent(in)  key,
real(kind = kindoffloat), intent(out)  value,
integer(kind=kindofint), intent(out), optional  status 
)

Get the real(4) value of a key from a message.

In case of error, if the status parameter (optional) is not given, the program will exit with an error message.
Otherwise the error message can be gathered with codes_get_error_string.

Parameters
msgidid of the message loaded in memory
keykey name
valuethe real(4) value
statusCODES_SUCCESS if OK, integer value on error
subroutine codes_get_real4_array ( integer(kind=kindofint), intent(in)  msgid,
character(len=*), intent(in)  key,
real(kind = kindoffloat), dimension(:), intent(inout), allocatable  value,
integer(kind=kindofint), intent(out), optional  status 
)

Get the real(4) array of values for a key from a message.

In case of error, if the status parameter (optional) is not given, the program will exit with an error message.
Otherwise the error message can be gathered with codes_get_error_string.
Note: This function supports the allocatable array attribute

Parameters
msgidid of the message loaded in memory
keykey name
valuereal(4) array value
statusCODES_SUCCESS if OK, integer value on error
subroutine codes_get_real8 ( integer(kind=kindofint), intent(in)  msgid,
character(len=*), intent(in)  key,
real(kind = kindofdouble), intent(out)  value,
integer(kind=kindofint), intent(out), optional  status 
)

Get the real(8) value of a key from a message.

In case of error, if the status parameter (optional) is not given, the program will exit with an error message.
Otherwise the error message can be gathered with codes_get_error_string.

Parameters
msgidid of the message loaded in memory
keykey name
valuethe real(8) value
statusCODES_SUCCESS if OK, integer value on error
subroutine codes_get_real8_array ( integer(kind=kindofint), intent(in)  msgid,
character(len=*), intent(in)  key,
real(kind = kindofdouble), dimension(:), intent(inout), allocatable  value,
integer(kind=kindofint), intent(out), optional  status 
)

Get the real(8) array of values for a key from a message.

In case of error, if the status parameter (optional) is not given, the program will exit with an error message.
Otherwise the error message can be gathered with codes_get_error_string.
Note: This function supports the allocatable array attribute

Parameters
msgidid of the message loaded in memory
keykey name
valuereal(8) array value
statusCODES_SUCCESS if OK, integer value on error
subroutine codes_get_string ( integer(kind=kindofint), intent(in)  msgid,
character(len=*), intent(in)  key,
character(len=*), intent(out)  value,
integer(kind=kindofint), intent(out), optional  status 
)

Get the character value of a key from a message.

In case of error, if the status parameter (optional) is not given, the program will exit with an error message.
Otherwise the error message can be gathered with codes_get_error_string.

Parameters
msgidid of the message loaded in memory
keykey name
valuethe character value
statusCODES_SUCCESS if OK, integer value on error

The documentation for this interface was generated from the following file: