---
name: "g2cprod.c"
section: "3"
platform: "linux"
package: "libg2c-dev"
version: "2.1.0-2"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/g2cprod.c"
---

# g2cprod.c(3)

Product functions for the g2c library.

## NAME

g2cprod.c - Product functions for the g2c library.

## SYNOPSIS

`#include 'grib2_int.h'`\

### Functions

**EXTERN\_MUTEX** (m)\
 If pthreads are enabled, use externally-defined mutex for thread-safety.  int **g2c\_get\_prod** (int g2cid, int msg\_num, int prod\_num, int \*num\_data\_points, float \*data)\
 Read the data for a product.

### Variables

**G2C\_FILE\_INFO\_T** **g2c\_file** \[**G2C\_MAX\_FILES**+1\]\
 Global file information.

## Detailed Description

Product functions for the g2c library.

**Author**

Ed Hartnett

**Date**

Oct 1, 2022

Definition in file **g2cprod.c**.

## Function Documentation

### EXTERN\_MUTEX (m)

If pthreads are enabled, use externally-defined mutex for thread-safety.

### int g2c\_get\_prod (int g2cid, int msg\_num, int prod\_num, int \* num\_data\_points, float \* data)

Read the data for a product.

**Parameters**

*g2cid* File ID. \
 *msg\_num* Message number in file (first message in file is message 0). \
 *prod\_num* Product number in message (first product in message is product 0). \
 *num\_data\_points* Pointer that gets the number of data points in the product. Ignored if NULL. \
 *data* Pointer that gets the data. Ignored if NULL.

**Returns**

- •

  **G2C\_NOERROR** No error.

**Author**

Ed Hartnett

**Date**

Sep 28, 2022

Definition at line **32** of file **g2cprod.c**.

References **g2c\_message\_info::bytes\_to\_msg**, **g2c\_section\_info::bytes\_to\_sec**, **g2c\_section5\_info::data\_def**, **g2c\_file\_info::f**, **G2C\_EBADID**, **G2C\_EFILE**, **G2C\_EINVAL**, **G2C\_ENOMEM**, **G2C\_ENOMSG**, **G2C\_ENOPRODUCT**, **G2C\_ENOSECTION**, **G2C\_ERROR**, **g2c\_file**, **G2C\_MAX\_FILES**, **G2C\_NOERROR**, **g2c\_unpack7()**, **g2c\_section3\_info::grid\_def**, **g2c\_section\_info::msg**, **g2c\_message\_info::msg\_num**, **MUTEX\_LOCK**, **MUTEX\_UNLOCK**, **g2c\_message\_info::next**, **g2c\_section\_info::next**, **g2c\_section5\_info::num\_data\_points**, **g2c\_section\_info::prev**, **g2c\_message\_info::sec**, **g2c\_section\_info::sec\_info**, **g2c\_section\_info::sec\_len**, **g2c\_section\_info::sec\_num**, **g2c\_section\_info::template**, and **g2c\_section\_info::template\_len**.

Referenced by **g2c\_degrib2()**.

## Variable Documentation

### G2C\_FILE\_INFO\_T g2c\_file\[G2C\_MAX\_FILES+1\]` [extern]`

Global file information.

Definition at line **10** of file **g2cfile.c**.

Referenced by **g2c\_get\_prod()**.

## Author

Generated automatically by Doxygen for NCEPLIBS-g2c from the source code.
