---
name: "g2_unpack1.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_unpack1.c"
---

# g2\_unpack1.c(3)

Unpack Section 1 (Identification Section) of a GRIB2 message.

## NAME

g2\_unpack1.c - Unpack Section 1 (Identification Section) of a GRIB2 message.

## SYNOPSIS

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

### Functions

**g2int** **g2\_unpack1** (unsigned char \*cgrib, **g2int** \*iofst, **g2int** \*\*ids, **g2int** \*idslen)\
 Unpacks `Section 1 - Identification Section` of a GRIB2 message.

## Detailed Description

Unpack Section 1 (Identification Section) of a GRIB2 message.

**Author**

Stephen Gilbert

**Date**

2002-10-29

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

## Function Documentation

### g2int g2\_unpack1 (unsigned char \* cgrib, g2int \* iofst, g2int \*\* ids, g2int \* idslen)

Unpacks `Section 1 - Identification Section` of a GRIB2 message.

**Parameters**

*cgrib* char array containing Section 1 of the GRIB2 message. \
 *iofst* Bit offset for the beginning of Section 1 in cgrib.\
 *ids* Pointer that gets an array which contians the information read from Section 1, the Identification section. This array is allocated by this function, and must be freed by caller (using **g2\_free()**).

- •

  ids\[0\] Identification of originating Centre (see `Table 0`).

- •

  ids\[1\] Identification of originating Sub-centre (see `Table C`).

- •

  ids\[2\] GRIB Master Tables Version Number (see `Table 1.0`).

- •

  ids\[3\] GRIB Local Tables Version Number (see `Table 1.1`).

- •

  ids\[4\] Significance of Reference Time (see `Table 1.2`).

- •

  ids\[5\] Year (4 digits)

- •

  ids\[6\] Month

- •

  ids\[7\] Day

- •

  ids\[8\] Hour

- •

  ids\[9\] Minute

- •

  ids\[10\] Second

- •

  ids\[11\] Production status of processed data (see `Table 1.3`).

- •

  ids\[12\] Type of processed data (see `Table 1.4`).

*idslen* Number of elements in ids.

**Returns**

- •

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

- •

  **G2\_UNPACK\_BAD\_SEC** Array passed is not section 1.

- •

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

**Author**

Stephen Gilbert

**Date**

2002-10-29

Definition at line **55** of file **g2\_unpack1.c**.

References **G2\_NO\_ERROR**, **G2\_UNPACK\_BAD\_SEC**, **G2\_UNPACK\_NO\_MEM**, and **gbit()**.

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

## Author

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