Loading...
Searching...
No Matches
g2cutil.c File Reference

Internal utility functions for the NCEPLIBS-g2c library for the new g2c API. More...

`#include "grib2_int.h"`
`#include <stdarg.h>`

Go to the source code of this file.

## Functions

int | g2c_log_file (int g2cid)
| Print a summary of the contents of an open GRIB2 file.
int | g2c_log_section (G2C_SECTION_INFO_T *sec)
| Log info about a section.
int | g2c_log_section1 (G2C_MESSAGE_INFO_T *msg)
| Log section 0 information.
const char * | g2c_strerror (int g2cerr)
| Given an error code, return an error message.

## Variables

G2C_FILE_INFO_T | g2c_file [G2C_MAX_FILES+1]
| Global file information.
G2C_CODE_TABLE_T * | g2c_table
| Pointer to the list of code tables.

## Detailed Description

Internal utility functions for the NCEPLIBS-g2c library for the new g2c API.

Author
  Ed Hartnett

Date
  Oct 11, 2023

Definition in file g2cutil.c.

## Function Documentation

## g2c_log_file()

int g2c_log_file | ( | int | g2cid | ) |

Print a summary of the contents of an open GRIB2 file.

If the NCEPLIBS-g2c library is built without the LOGGING option, this function will do nothing.

Parameters

  g2cid | The file ID, returned by g2c_open() or g2c_create().

Returns
  - G2C_NOERROR No error.
  - G2C_EBADID g2cid not found.

Author
  Ed Hartnett 8/22/22

Definition at line 189 of file g2cutil.c.

References g2c_message_info::bytes_in_msg, g2c_message_info::bytes_to_msg, g2c_message_info::center, g2c_message_info::day, g2c_csv_init(), G2C_EBADID, g2c_file, g2c_free_tables(), g2c_log_section(), g2c_log_section1(), G2C_NOERROR, g2c_table, g2c_message_info::hour, g2c_message_info::local_version, LOG, g2c_message_info::master_version, g2c_message_info::minute, g2c_message_info::month, g2c_message_info::msg_num, g2c_message_info::next, g2c_section_info::next, g2c_message_info::num_fields, g2c_message_info::num_local, g2c_message_info::sec, g2c_message_info::sec1_len, g2c_message_info::second, g2c_message_info::sig_ref_time, g2c_message_info::status, g2c_message_info::subcenter, g2c_message_info::type, and g2c_message_info::year.

Referenced by read_metadata().

## g2c_log_section()

int g2c_log_section | ( | G2C_SECTION_INFO_T * | sec | ) |

Log info about a section.

Parameters

  sec | Pointer to G2C_SECTION_INFO_T.

Returns
  - G2C_NOERROR No error.

Author
  Ed Hartnett 10/20/22

Definition at line 152 of file g2cutil.c.

References g2c_section_info::bytes_to_sec, g2c_message_info::discipline, G2C_MAX_NOAA_ABBREV_LEN, G2C_NOERROR, g2c_param_abbrev(), LOG, g2c_section_info::msg, g2c_section_info::sec_id, g2c_section_info::sec_len, g2c_section_info::sec_num, and g2c_section_info::template.

Referenced by g2c_log_file().

## g2c_log_section1()

int g2c_log_section1 | ( | G2C_MESSAGE_INFO_T * | msg | ) |

Log section 0 information.

Parameters

  msg | Pointer to G2C_MESSAGE_INFO_T which contains section 0 information.

Returns
  - G2C_NOERROR No error.

Author
  Ed Hartnett

Date
  10/16/22

Definition at line 101 of file g2cutil.c.

References g2c_message_info::center, g2c_message_info::day, g2c_message_info::discipline, g2c_csv_init(), g2c_find_desc(), G2C_MAX_GRIB_DESC_LEN, G2C_NOERROR, g2c_message_info::hour, g2c_message_info::local_version, LOG, g2c_message_info::master_version, g2c_message_info::minute, g2c_message_info::month, g2c_message_info::second, g2c_message_info::sig_ref_time, g2c_message_info::status, g2c_message_info::subcenter, g2c_message_info::type, and g2c_message_info::year.

Referenced by g2c_log_file(), and g2c_open_index().

## g2c_strerror()

const char * g2c_strerror | ( | int | g2cerr | ) |

Given an error code, return an error message.

Parameters

  g2cerr | An error number returned by one of the g2c_* functions.

Returns
  The error message.

Author
  Ed Hartnett

Definition at line 29 of file g2cutil.c.

References G2C_EBADEND, G2C_EBADID, G2C_EBADSECTION, G2C_EBADTEMPLATE, G2C_EBADTYPE, G2C_EFILE, G2C_EINVAL, G2C_EJPEG, G2C_EMSG, G2C_EMSGCOMPLETE, G2C_ENAMETOOLONG, G2C_ENOEND, G2C_ENOMEM, G2C_ENOMSG, G2C_ENOPARAM, G2C_ENOPRODUCT, G2C_ENOSECTION, G2C_ENOTEMPLATE, G2C_ENOTFOUND, G2C_ENOTGRIB, G2C_ENOTGRIB2, G2C_EPNG, G2C_ETOOMANYFILES, G2C_EXML, and G2C_NOERROR.

## Variable Documentation

## g2c_file

G2C_FILE_INFO_T g2c_file[G2C_MAX_FILES+1]

extern

Global file information.

Definition at line 10 of file g2cfile.c.

Referenced by find_available_g2cid(), free_metadata(), g2c_add_file(), g2c_close(), g2c_find_msg2(), g2c_get_msg(), g2c_log_file(), g2c_seekmsg(), and read_metadata().

## g2c_table

G2C_CODE_TABLE_T* g2c_table

extern

Pointer to the list of code tables.

Definition at line 16 of file g2ccsv.c.

Referenced by g2c_csv_init(), g2c_find_desc_str(), g2c_find_table(), g2c_free_tables(), g2c_log_file(), and g2c_print_tables().