---
name: "g2_unpack5.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_unpack5.c"
---

# g2\_unpack5.c(3)

Unpack Section 5 (Data Representation Section) of a GRIB2 message.

## NAME

g2\_unpack5.c - Unpack Section 5 (Data Representation Section) of a GRIB2 message.

## SYNOPSIS

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

### Functions

**g2int** **g2\_unpack5** (unsigned char \*cgrib, **g2int** \*iofst, **g2int** \*ndpts, **g2int** \*idrsnum, **g2int** \*\*idrstmpl, **g2int** \*mapdrslen)\
 Unpack Section 5 (Data Representation Section) of a GRIB2 message.

## Detailed Description

Unpack Section 5 (Data Representation Section) of a GRIB2 message.

**Author**

Stephen Gilbert

**Date**

2002-10-31

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

## Function Documentation

### g2int g2\_unpack5 (unsigned char \* cgrib, g2int \* iofst, g2int \* ndpts, g2int \* idrsnum, g2int \*\* idrstmpl, g2int \* mapdrslen)

Unpack Section 5 (Data Representation 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* char array containing Section 5 of the GRIB2 message. \
 *iofst* Bit offset for the beginning of Section 5 in cgrib. Returned with bit offset at the end of Section 5. \
 *ndpts* Number of data points unpacked and returned. \
 *idrsnum* Data Representation Template Number (see Code Table 5.0). \
 *idrstmpl* Pointer to an integer array containing the data values for the specified Data Representation Template (N=idrsnum). Each element of this integer array contains an entry (in the order specified) of Data Representation Template 5.N. \
 *mapdrslen-* Number of elements in idrstmpl. i.e. number of entries in Data Representation Template 5.N (N=idrsnum).

**Returns**

- •

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

- •

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

- •

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

- •

  **G2\_UNPACK5\_BAD\_DRT** 'GRIB' message contains an undefined Data Representation Template.

**Author**

Stephen Gilbert

**Date**

2002-10-31

Definition at line **40** of file **g2\_unpack5.c**.

References **gtemplate::ext**, **extdrstemplate()**, **gtemplate::extlen**, **G2\_NO\_ERROR**, **G2\_UNPACK5\_BAD\_DRT**, **G2\_UNPACK\_BAD\_SEC**, **G2\_UNPACK\_NO\_MEM**, **gbit()**, **getdrstemplate()**, **gtemplate::map**, **gtemplate::maplen**, and **gtemplate::needext**.

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

## Author

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