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... | |
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
[in] | gribid | id of the grib loaded in memory |
[in] | key | key name |
[out] | value | value can be a scalar or array of integer(4),real(4),real(8),character |
[out] | status | CODES_SUCCESS if OK, integer value on error |
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.
msgid | id of the message loaded in memory |
key | key name |
value | character(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.
msgid | id of the message loaded in memory |
key | key name |
value | the integer(4) value |
status | CODES_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
msgid | id of the message loaded in memory |
key | key name |
value | integer(4) array value |
status | CODES_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.
msgid | id of the message loaded in memory |
key | key name |
value | the integer(4) value |
status | CODES_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.
msgid | id of the message loaded in memory |
key | key name |
value | the real(4) value |
status | CODES_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
msgid | id of the message loaded in memory |
key | key name |
value | real(4) array value |
status | CODES_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.
msgid | id of the message loaded in memory |
key | key name |
value | the real(8) value |
status | CODES_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
msgid | id of the message loaded in memory |
key | key name |
value | real(8) array value |
status | CODES_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.
msgid | id of the message loaded in memory |
key | key name |
value | the real(8) value |
status | CODES_SUCCESS if OK, integer value on error |