Page tree

GRIB-API support is being discontinued at the end of 2018. Please consider upgrading to ecCodes


Skip to end of metadata
Go to start of metadata

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

Public Member Functions

subroutine  grib_get_int (gribid, key, value, status)
  Get the integer value of a key from a grib message.
subroutine  grib_get_long (gribid, key, value, status)
  Get the integer value of a key from a grib message.
subroutine  grib_get_real4 (gribid, key, value, status)
  Get the real(4) value of a key from a grib message.
subroutine  grib_get_real8 (gribid, key, value, status)
  Get the real(8) value of a key from a grib message.
subroutine  grib_get_string (gribid, key, value, status)
  Get the character value of a key from a grib message.
subroutine  grib_get_int_array (gribid, key, value, status)
  Get the integer array of values for a key from a grib message.
subroutine  grib_get_real4_array (gribid, key, value, status)
  Get the real(4) array of values for a key from a grib message.
subroutine  grib_get_real8_array (gribid, key, value, status)
  Get the real(8) array of values for a key from a grib message.

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 grib_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 grib_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 grib_get_error_string.

Examples: get.f90, print_data.f90

See also:
grib_new_from_file, grib_release, grib_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 GRIB_SUCCESS if OK, integer value on error

Member Function Documentation

subroutine grib_get_int ( integer(kind=kindOfInt),intent(in)  gribid,
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 grib 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 grib_get_error_string.

Parameters:
gribid id of the grib loaded in memory
key key name
value the integer(4) value
status GRIB_SUCCESS if OK, integer value on error
subroutine grib_get_int_array ( integer(kind=kindOfInt),intent(in)  gribid,
character(len=*),intent(in)  key,
integer(kind=kindOfInt),dimension(:),intent(out)  value,
integer(kind=kindOfInt),intent(out),optional  status 
)

Get the integer array of values for a key from a grib 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 grib_get_error_string.

Parameters:
gribid id of the grib loaded in memory
key key name
value integer(4) array value
status GRIB_SUCCESS if OK, integer value on error
subroutine grib_get_long ( integer(kind=kindOfInt),intent(in)  gribid,
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 grib 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 grib_get_error_string.

Parameters:
gribid id of the grib loaded in memory
key key name
value the integer(4) value
status GRIB_SUCCESS if OK, integer value on error
subroutine grib_get_real4 ( integer(kind=kindOfInt),intent(in)  gribid,
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 grib 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 grib_get_error_string.

Parameters:
gribid id of the grib loaded in memory
key key name
value the real(4) value
status GRIB_SUCCESS if OK, integer value on error
subroutine grib_get_real4_array ( integer(kind=kindOfInt),intent(in)  gribid,
character(len=*),intent(in)  key,
real(kind = kindOfFloat),dimension(:),intent(out)  value,
integer(kind=kindOfInt),intent(out),optional  status 
)

Get the real(4) array of values for a key from a grib 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 grib_get_error_string.

Parameters:
gribid id of the grib loaded in memory
key key name
value real(4) array value
status GRIB_SUCCESS if OK, integer value on error
subroutine grib_get_real8 ( integer(kind=kindOfInt),intent(in)  gribid,
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 grib 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 grib_get_error_string.

Parameters:
gribid id of the grib loaded in memory
key key name
value the real(8) value
status GRIB_SUCCESS if OK, integer value on error
subroutine grib_get_real8_array ( integer(kind=kindOfInt),intent(in)  gribid,
character(len=*),intent(in)  key,
real(kind = kindOfDouble),dimension(:),intent(out)  value,
integer(kind=kindOfInt),intent(out),optional  status 
)

Get the real(8) array of values for a key from a grib 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 grib_get_error_string.

Parameters:
gribid id of the grib loaded in memory
key key name
value real(8) array value
status GRIB_SUCCESS if OK, integer value on error
subroutine grib_get_string ( integer(kind=kindOfInt),intent(in)  gribid,
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 grib 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 grib_get_error_string.

Parameters:
gribid id of the grib loaded in memory
key key name
value the real(8) value
status GRIB_SUCCESS if OK, integer value on error

The documentation for this interface was generated from the following file:
  • grib_f90.f90
  • No labels

1 Comment

  1. The value parameter for subroutine `grib_get_string` should be character(len=*), not real(8).