Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

For the moment there is no simple way of knowing what the type of a key value is. However, the library provides a function that can be used to find out what the native type of a key value is.
The function, available only in In the C API, there is a function called 'grib"codes_get_native_type'. It " which returns an integer which can be checked against the following macros:

CODES_TYPE_UNDEFINED
CODES_TYPE_LONG
CODES_TYPE_DOUBLE
CODES_TYPE_STRING
CODES_TYPE_BYTES
CODES_TYPE_SECTION
CODES_TYPE_LABEL
CODES_TYPE_MISSING

In the Python interface, the same function "codes_get_native_type" has a simpler interface and returns one of: "int", "float" or "str".


As of version 2.14.0, one can use the grib_dump tool with the "-p" option to dump a given key and query its type with the "-t" option.
E.g.

...