eccodes

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

- File List
- Globals

All Data Structures Namespaces Files Functions Groups Pages
Macros | Functions
eccodes.h File Reference

The ecCodes C header file. More...

## Macros
#define | CODES_KEYS_ITERATOR_ALL_KEYS 0
#define | CODES_KEYS_ITERATOR_SKIP_READ_ONLY (1<<0)
#define | CODES_KEYS_ITERATOR_SKIP_OPTIONAL (1<<1)
#define | CODES_KEYS_ITERATOR_SKIP_EDITION_SPECIFIC (1<<2)
#define | CODES_KEYS_ITERATOR_SKIP_CODED (1<<3)
#define | CODES_KEYS_ITERATOR_SKIP_COMPUTED (1<<4)
#define | CODES_KEYS_ITERATOR_SKIP_DUPLICATES (1<<5)
#define | CODES_KEYS_ITERATOR_SKIP_FUNCTION (1<<6)
#define | CODES_KEYS_ITERATOR_DUMP_ONLY (1<<7)
#define | CODES_SUCCESS 0
| No error. More...
#define | CODES_END_OF_FILE -1
| End of resource reached. More...
#define | CODES_INTERNAL_ERROR -2
| Internal error. More...
#define | CODES_BUFFER_TOO_SMALL -3
| Passed buffer is too small. More...
#define | CODES_NOT_IMPLEMENTED -4
| Function not yet implemented. More...
#define | CODES_7777_NOT_FOUND -5
| Missing 7777 at end of message. More...
#define | CODES_ARRAY_TOO_SMALL -6
| Passed array is too small. More...
#define | CODES_FILE_NOT_FOUND -7
| File not found. More...
#define | CODES_CODE_NOT_FOUND_IN_TABLE -8
| Code not found in code table. More...
#define | CODES_WRONG_ARRAY_SIZE -9
| Array size mismatch. More...
#define | CODES_NOT_FOUND -10
| Key/value not found. More...
#define | CODES_IO_PROBLEM -11
| Input output problem. More...
#define | CODES_INVALID_MESSAGE -12
| Message invalid. More...
#define | CODES_DECODING_ERROR -13
| Decoding invalid. More...
#define | CODES_ENCODING_ERROR -14
| Encoding invalid. More...
#define | CODES_NO_MORE_IN_SET -15
| Code cannot unpack because of string too small. More...
#define | CODES_GEOCALCULUS_PROBLEM -16
| Problem with calculation of geographic attributes. More...
#define | CODES_OUT_OF_MEMORY -17
| Memory allocation error. More...
#define | CODES_READ_ONLY -18
| Value is read only. More...
#define | CODES_INVALID_ARGUMENT -19
| Invalid argument. More...
#define | CODES_NULL_HANDLE -20
| Null handle. More...
#define | CODES_INVALID_SECTION_NUMBER -21
| Invalid section number. More...
#define | CODES_VALUE_CANNOT_BE_MISSING -22
| Value cannot be missing. More...
#define | CODES_WRONG_LENGTH -23
| Wrong message length. More...
#define | CODES_INVALID_TYPE -24
| Invalid key type. More...
#define | CODES_WRONG_STEP -25
| Unable to set step. More...
#define | CODES_WRONG_STEP_UNIT -26
| Wrong units for step (step must be integer) More...
#define | CODES_INVALID_FILE -27
| Invalid file id. More...
#define | CODES_INVALID_GRIB -28
| Invalid grib id. More...
#define | CODES_INVALID_INDEX -29
| Invalid index id. More...
#define | CODES_INVALID_ITERATOR -30
| Invalid iterator id. More...
#define | CODES_INVALID_KEYS_ITERATOR -31
| Invalid keys iterator id. More...
#define | CODES_INVALID_NEAREST -32
| Invalid nearest id. More...
#define | CODES_INVALID_ORDERBY -33
| Invalid order by. More...
#define | CODES_MISSING_KEY -34
| Missing a key from the fieldset. More...
#define | CODES_OUT_OF_AREA -35
| The point is out of the grid area. More...
#define | CODES_CONCEPT_NO_MATCH -36
| Concept no match. More...
#define | CODES_HASH_ARRAY_NO_MATCH -37
| Hash array no match. More...
#define | CODES_NO_DEFINITIONS -38
| Definitions files not found. More...
#define | CODES_WRONG_TYPE -39
| Wrong type while packing. More...
#define | CODES_END -40
| End of resource. More...
#define | CODES_NO_VALUES -41
| Unable to code a field without values. More...
#define | CODES_WRONG_GRID -42
| Grid description is wrong or inconsistent. More...
#define | CODES_END_OF_INDEX -43
| End of index reached. More...
#define | CODES_NULL_INDEX -44
| Null index. More...
#define | CODES_PREMATURE_END_OF_FILE -45
| End of resource reached when reading message. More...
#define | CODES_INTERNAL_ARRAY_TOO_SMALL -46
| An internal array is too small. More...
#define | CODES_MESSAGE_TOO_LARGE -47
| Message is too large for the current architecture. More...
#define | CODES_CONSTANT_FIELD -48
| Constant field. More...
#define | CODES_SWITCH_NO_MATCH -49
| Switch unable to find a matching case. More...
#define | CODES_UNDERFLOW -50
| Underflow. More...
#define | CODES_MESSAGE_MALFORMED -51
| Message malformed. More...
#define | CODES_CORRUPTED_INDEX -52
| Index is corrupted. More...
#define | CODES_INVALID_BPV -53
| Invalid number of bits per value. More...
#define | CODES_DIFFERENT_EDITION -54
| Edition of two messages is different. More...
#define | CODES_VALUE_DIFFERENT -55
| Value is different. More...
#define | CODES_INVALID_KEY_VALUE -56
| Invalid key value. More...
#define | CODES_STRING_TOO_SMALL -57
| String is smaller than requested. More...
#define | CODES_WRONG_CONVERSION -58
| Wrong type conversion. More...
#define | CODES_MISSING_BUFR_ENTRY -59
| Missing BUFR table entry for descriptor. More...
#define | CODES_NULL_POINTER -60
| Null pointer. More...
#define | CODES_ATTRIBUTE_CLASH -61
| Attribute is already present, cannot add. More...
#define | CODES_TOO_MANY_ATTRIBUTES -62
| Too many attributes. More...
#define | CODES_ATTRIBUTE_NOT_FOUND -63
| Attribute not found. More...
#define | CODES_UNSUPPORTED_EDITION -64
| Edition not supported. More...
#define | CODES_OUT_OF_RANGE -65
| Value out of coding range. More...
#define | CODES_WRONG_BITMAP_SIZE -66
| Size of bitmap is incorrect. More...

## Functions
codes_index * | codes_index_new_from_file (codes_context *c, char *filename, const char *keys, int *err)
| Create a new index form a file. More...
codes_index * | codes_index_new (codes_context *c, const char *keys, int *err)
| Create a new index based on a set of keys. More...
int | codes_index_add_file (grib_index *index, const char *filename)
| Indexes the file given in argument in the index given in argument. More...
int | codes_index_get_size (codes_index *index, const char *key, size_t *size)
| Get the number of distinct values of the key in argument contained in the index. More...
int | codes_index_get_long (codes_index *index, const char *key, long *values, size_t *size)
| Get the distinct values of the key in argument contained in the index. More...
int | codes_index_get_double (codes_index *index, const char *key, double *values, size_t *size)
| Get the distinct values of the key in argument contained in the index. More...
int | codes_index_get_string (codes_index *index, const char *key, char **values, size_t *size)
| Get the distinct values of the key in argument contained in the index. More...
int | codes_index_select_long (codes_index *index, const char *key, long value)
| Select the message subset with key==value. More...
int | codes_index_select_double (codes_index *index, const char *key, double value)
| Select the message subset with key==value. More...
int | codes_index_select_string (codes_index *index, const char *key, char *value)
| Select the message subset with key==value. More...
codes_handle * | codes_handle_new_from_index (codes_index *index, int *err)
| Create a new handle from an index after having selected the key values. More...
void | codes_index_delete (codes_index *index)
| Delete the index. More...
int | codes_count_in_file (codes_context *c, FILE *f, int *n)
| Counts the messages contained in a file resource. More...
grib_handle * | codes_handle_new_from_file (grib_context *c, FILE *f, ProductKind product, int *error)
| Create a handle from a file resource. More...
grib_handle * | codes_grib_handle_new_from_file (grib_context *c, FILE *f, int *error)
| Create a GRIB handle from a file resource. More...
grib_handle * | codes_bufr_handle_new_from_file (grib_context *c, FILE *f, int *error)
| Create a BUFR handle from a file resource. More...
int | codes_write_message (codes_handle *h, const char *file, const char *mode)
| Write a coded message to a file. More...
codes_handle * | codes_handle_new_from_message (codes_context *c, const void *data, size_t data_len)
| Create a handle from a user message in memory. More...
codes_handle * | codes_grib_handle_new_from_multi_message (codes_context *c, void **data, size_t *data_len, int *error)
| Create a handle from a user message in memory. More...
codes_handle * | codes_handle_new_from_message_copy (codes_context *c, const void *data, size_t data_len)
| Create a handle from a user message. More...
codes_handle * | codes_grib_handle_new_from_samples (codes_context *c, const char *res_name)
| Create a handle from a GRIB message contained in a samples directory. More...
codes_handle * | codes_bufr_handle_new_from_samples (codes_context *c, const char *res_name)
| Create a handle from a BUFR message contained in a samples directory. More...
codes_handle * | codes_handle_clone (codes_handle *h)
| Clone an existing handle using the context of the original handle, The message is copied and reparsed. More...
int | codes_handle_delete (codes_handle *h)
| Frees a handle, also frees the message if it is not a user message. More...
codes_multi_handle * | codes_grib_multi_handle_new (codes_context *c)
| Create an empty multi-field GRIB handle. More...
int | codes_grib_multi_handle_append (codes_handle *h, int start_section, codes_multi_handle *mh)
| Append the sections starting with start_section of the message pointed by h at the end of the multi-field GRIB handle mh. More...
int | codes_grib_multi_handle_delete (codes_multi_handle *mh)
| Delete multi-field GRIB handle. More...
int | codes_grib_multi_handle_write (codes_multi_handle *mh, FILE *f)
| Write a multi-field GRIB handle in a file. More...
int | codes_get_message (codes_handle *h, const void **message, size_t *message_length)
| getting the message attached to a handle More...
int | codes_get_message_copy (codes_handle *h, void *message, size_t *message_length)
| getting a copy of the message attached to a handle More...
codes_iterator * | codes_grib_iterator_new (codes_handle *h, unsigned long flags, int *error)
| Create a new iterator from a GRIB handle, using current geometry and values. More...
int | codes_grib_get_data (codes_handle *h, double *lats, double *lons, double *values)
| Get latitude/longitude and data values. More...
int | codes_grib_iterator_next (codes_iterator *i, double *lat, double *lon, double *value)
| Get the next value from an iterator. More...
int | codes_grib_iterator_previous (codes_iterator *i, double *lat, double *lon, double *value)
| Get the previous value from an iterator. More...
int | codes_grib_iterator_has_next (codes_iterator *i)
| Test procedure for values in an iterator. More...
int | codes_grib_iterator_reset (codes_iterator *i)
| Test procedure for values in an iterator. More...
int | codes_grib_iterator_delete (codes_iterator *i)
| Frees an iterator from memory. More...
codes_nearest * | codes_grib_nearest_new (codes_handle *h, int *error)
| Create a new nearest from a handle, using current geometry . More...
int | codes_grib_nearest_find (codes_nearest *nearest, codes_handle *h, double inlat, double inlon, unsigned long flags, double *outlats, double *outlons, double *values, double *distances, int *indexes, size_t *len)
| Find the 4 nearest points of a latitude longitude point. More...
int | codes_grib_nearest_delete (codes_nearest *nearest)
| Frees an nearest from memory. More...
int | codes_grib_nearest_find_multiple (codes_handle *h, int is_lsm, double *inlats, double *inlons, long npoints, double *outlats, double *outlons, double *values, double *distances, int *indexes)
| Find the nearest point of a set of points whose latitudes and longitudes are given in the inlats, inlons arrays respectively. More...
int | codes_get_offset (codes_handle *h, const char *key, size_t *offset)
| Get the number offset of a key, in a message if several keys of the same name are present, the offset of the last one is returned. More...
int | codes_get_size (codes_handle *h, const char *key, size_t *size)
| Get the number of coded value from a key, if several keys of the same name are present, the total sum is returned. More...
int | codes_get_length (codes_handle *h, const char *key, size_t *length)
| Get the length of the string representation of the key, if several keys of the same name are present, the maximum length is returned. More...
int | codes_get_long (codes_handle *h, const char *key, long *value)
| Get a long value from a key, if several keys of the same name are present, the last one is returned. More...
int | codes_get_double (codes_handle *h, const char *key, double *value)
| Get a double value from a key, if several keys of the same name are present, the last one is returned. More...
int | codes_get_double_element (codes_handle *h, const char *key, int i, double *value)
| Get as double the i-th element of the "key" array. More...
int | codes_get_double_elements (codes_handle *h, const char *key, int *i, long size, double *value)
| Get as double array the elements of the "key" array whose indexes are listed in the input array i. More...
int | codes_get_string (codes_handle *h, const char *key, char *mesg, size_t *length)
| Get a string value from a key, if several keys of the same name are present, the last one is returned. More...
int | codes_get_bytes (codes_handle *h, const char *key, unsigned char *bytes, size_t *length)
| Get raw bytes values from a key. More...
int | codes_get_double_array (codes_handle *h, const char *key, double *vals, size_t *length)
| Get double array values from a key. More...
int | codes_get_long_array (codes_handle *h, const char *key, long *vals, size_t *length)
| Get long array values from a key. More...
int | codes_copy_namespace (codes_handle *dest, const char *name, codes_handle *src)
| Copy the keys belonging to a given namespace from a source handle to a destination handle. More...
int | codes_set_long (codes_handle *h, const char *key, long val)
| Set a long value from a key. More...
int | codes_set_double (codes_handle *h, const char *key, double val)
| Set a double value from a key. More...
int | codes_set_string (codes_handle *h, const char *key, const char *mesg, size_t *length)
| Set a string value from a key. More...
int | codes_set_bytes (codes_handle *h, const char *key, const unsigned char *bytes, size_t *length)
| Set a bytes array from a key. More...
int | codes_set_double_array (codes_handle *h, const char *key, const double *vals, size_t length)
| Set a double array from a key. More...
int | codes_set_force_double_array (codes_handle *h, const char *key, const double *vals, size_t length)
| Same as codes_set_double_array but allows setting of READ-ONLY keys like codedValues. More...
int | codes_set_long_array (codes_handle *h, const char *key, const long *vals, size_t length)
| Set a long array from a key. More...
int | codes_set_string_array (codes_handle *h, const char *key, const char **vals, size_t length)
| Set a string array from a key. More...
void | codes_dump_content (codes_handle *h, FILE *out, const char *mode, unsigned long option_flags, void *arg)
| Print all keys, with the context print procedure and dump mode to a resource. More...
void | codes_dump_action_tree (codes_context *c, FILE *f)
| Print all keys from the parsed definition files available in a context. More...
codes_context * | codes_context_get_default (void)
| Get the static default context. More...
void | codes_context_delete (codes_context *c)
| Frees the cached definition files of the context. More...
void | codes_gts_header_on (codes_context *c)
| Set the GTS header mode on. More...
void | codes_gts_header_off (codes_context *c)
| Set the GTS header mode off. More...
void | codes_gribex_mode_on (codes_context *c)
| Set the GRIBEX mode on. More...
int | codes_get_gribex_mode (codes_context *c)
| Get the GRIBEX mode. More...
void | codes_gribex_mode_off (codes_context *c)
| Set the GRIBEX mode off. More...
void | codes_context_set_definitions_path (grib_context *c, const char *path)
| Sets the search path for definition files. More...
void | codes_context_set_samples_path (grib_context *c, const char *path)
| Sets the search path for sample files. More...
void | codes_grib_multi_support_on (codes_context *c)
| Turn on support for multiple fields in single GRIB messages. More...
void | codes_grib_multi_support_off (codes_context *c)
| Turn off support for multiple fields in single GRIB messages. More...
void | codes_grib_multi_support_reset_file (codes_context *c, FILE *f)
| Reset file handle in multiple GRIB field support mode. More...
long | codes_get_api_version (void)
| Get the API version. More...
const char * | codes_get_git_sha1 (void)
| Get the Git version control SHA1 identifier. More...
const char * | codes_get_package_name (void)
| Get the package name. More...
void | codes_print_api_version (FILE *out)
| Prints the API version. More...
codes_keys_iterator * | codes_keys_iterator_new (codes_handle *h, unsigned long filter_flags, const char *name_space)
int | codes_keys_iterator_next (codes_keys_iterator *kiter)
const char * | codes_keys_iterator_get_name (codes_keys_iterator *kiter)
int | codes_keys_iterator_delete (codes_keys_iterator *kiter)
int | codes_keys_iterator_rewind (codes_keys_iterator *kiter)
const char * | codes_get_error_message (int code)
| Convert an error code into a string. More...

## Detailed Description

The ecCodes C header file.

This is the only file that must be included to use the ecCodes library from C.

## Function Documentation

void codes_dump_action_tree | ( | codes_context * | c,
|  | FILE * | f
| ) |  |

Print all keys from the parsed definition files available in a context.

Parameters

  f | : the File used to print the keys on
  c | : the context that contains the cached definition files to be printed

void codes_dump_content | ( | codes_handle * | h,
|  | FILE * | out,
|  | const char * | mode,
|  | unsigned long | option_flags,
|  | void * | arg
| ) |  |

Print all keys, with the context print procedure and dump mode to a resource.

Parameters

  h | : the handle to be printed
  out | : output file handle
  mode | : Examples of available dump modes: debug wmo
  option_flags | : all the CODES_DUMP_FLAG_x flags can be used
  arg | : used to provide a format to output data (experimental)

long codes_get_api_version | ( | void |  | ) |

Get the API version.

Returns
  API version

Get the API version.

Returns the version of the api as a string in the format "major.minor.revision".

Referenced by ecCodes::codes_index_get().

const char* codes_get_error_message | ( | int | code | ) |

Convert an error code into a string.

Parameters

  code | : the error code

Returns
  the error message

const char* codes_get_git_sha1 | ( | void |  | ) |

Get the Git version control SHA1 identifier.

Returns
  character string with SHA1 identifier

const char* codes_get_package_name | ( | void |  | ) |

Get the package name.

Returns
  character string with package name

void codes_print_api_version | ( | FILE * | out | ) |

Prints the API version.