eccodes: eccodes::codes_get Interface Reference

eccodes

- Main Page
- C Interface
- F90 Interface
- Python Interface

- Data Structures
- Data Fields

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] | 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

## 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

  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.

Parameters

  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

Parameters

  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.

Parameters

  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.

Parameters

  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

Parameters

  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.

Parameters

  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

Parameters

  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.

Parameters

  msgid | id of the message loaded in memory
  key | key name
  value | the character value
  status | CODES_SUCCESS if OK, integer value on error

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

- eccodes_f90.f90