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

# g2\_unpack4.c(3)

Unpack Section 4 (Product Definition Section) of a GRIB2 message.

## NAME

g2\_unpack4.c - Unpack Section 4 (Product Definition Section) of a GRIB2 message.

## SYNOPSIS

`#include 'grib2_int.h'`\
 `#include <stdio.h>`\
 `#include <stdlib.h>`\

### Functions

**g2int** **g2\_unpack4** (unsigned char \*cgrib, **g2int** \*iofst, **g2int** \*ipdsnum, **g2int** \*\*ipdstmpl, **g2int** \*mappdslen, float \*\*coordlist, **g2int** \*numcoord)\
 Unpack `Section 4 (Product Definition Section)` of a GRIB2 message.

## Detailed Description

Unpack Section 4 (Product Definition Section) of a GRIB2 message.

**Author**

Stephen Gilbert

**Date**

2002-10-31

Definition in file **g2\_unpack4.c**.

## Function Documentation

### g2int g2\_unpack4 (unsigned char \* cgrib, g2int \* iofst, g2int \* ipdsnum, g2int \*\* ipdstmpl, g2int \* mappdslen, float \*\* coordlist, g2int \* numcoord)

Unpack `Section 4 (Product Definition Section)` of a GRIB2 message.

### Program History Log

Date   Programmer   Comments    2002-10-31   Gilbert   Initial    2009-01-14   Vuong   Changed structure name template to gtemplate

**Parameters**

*cgrib* Array containing Section 4 of the GRIB2 message. \
 *iofst* Bit offset of the beginning of Section 4 in cgrib. Returned with updated bit offset. \
 *ipdsnum* Product Definition Template Number (see `Table 4.0`). \
 *ipdstmpl* Pointer that gets an integer array containing the data values for the Product Definition Template specified by ipdsnum. \
 *mappdslen* Number of elements in ipdstmpl - i.e. number of entries in Product Defintion Template specified by ipdsnum. \
 *coordlist* Pointer that gets an array containing floating point values intended to document the vertical discretisation associated to model data on hybrid coordinate vertical levels. \
 *numcoord* number of values in array coordlist.

**Returns**

- •

  **G2\_NO\_ERROR** No error.

- •

  **G2\_UNPACK\_BAD\_SEC** Array passed had incorrect section number.

- •

  **G2\_UNPACK4\_BAD\_PDT** message contains an undefined Product Definition Template.

- •

  **G2\_UNPACK\_NO\_MEM** Memory allocation error.

**Author**

Stephen Gilbert

**Date**

2002-10-31

Definition at line **45** of file **g2\_unpack4.c**.

References **gtemplate::ext**, **gtemplate::extlen**, **extpdstemplate()**, **G2\_NO\_ERROR**, **G2\_UNPACK4\_BAD\_PDT**, **G2\_UNPACK\_BAD\_SEC**, **G2\_UNPACK\_NO\_MEM**, **gbit()**, **gbits()**, **getpdstemplate()**, **gtemplate::map**, **gtemplate::maplen**, **gtemplate::needext**, and **rdieee()**.

Referenced by **g2\_getfld()**.

## Author

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