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

# g2cparams.c(3)

Functions for serving up NOAA parameter abbreviations and GRIB1/GRIB2 translations.

## NAME

g2cparams.c - Functions for serving up NOAA parameter abbreviations and GRIB1/GRIB2 translations.

## SYNOPSIS

`#include 'grib2_int.h'`\

### Macros

\#define **CSV\_FILE**   'noaa\_grib2\_params.csv'\
 The name of the CSV file which contains the NOAA abbreviations.

### Functions

int **g2c\_param\_abbrev** (int g2disc, int g2cat, int g2num, char \*abbrev)\
 Get NOAA abbreviation for a GRIB2 parameter.  int **g2c\_param\_all** (int param\_idx, int \*g1num, int \*g1ver, int \*g2disc, int \*g2cat, int \*g2num, char \*abbrev)\
 Return all the information about a parameter.  int **g2c\_param\_g1tog2** (int g1num, int g1ver, int \*g2disc, int \*g2cat, int \*g2num)\
 Translate GRIB1 parameter to GRIB2 parameter.  int **g2c\_param\_g2tog1** (int g2disc, int g2cat, int g2num, int \*g1num, int \*g1ver)\
 Translate GRIB2 parameter to GRIB1 parameter.

### Variables

static **G2C\_PARAM\_T** **param** \[**G2C\_MAX\_NOAA\_PARAMS**\]\
 An array of parameter information.

## Detailed Description

Functions for serving up NOAA parameter abbreviations and GRIB1/GRIB2 translations.

**Author**

Ed Hartnett

**Date**

9/19/22

Definition in file **g2cparams.c**.

## Macro Definition Documentation

### #define CSV\_FILE 'noaa\_grib2\_params.csv'

The name of the CSV file which contains the NOAA abbreviations.

Definition at line **11** of file **g2cparams.c**.

## Function Documentation

### int g2c\_param\_abbrev (int g2disc, int g2cat, int g2num, char \* abbrev)

Get NOAA abbreviation for a GRIB2 parameter.

**Parameters**

*g2disc* The GRIB2 discipline number. \
 *g2cat* The GRIB2 category number. \
 *g2num* The GRIB2 parameter number. \
 *abbrev* Pointer that gets the abbreviation. Ignored if NULL.

**Returns**

- •

  **G2C\_NOERROR** No error.

- •

  **G2C\_EFILE** Error reading CSV file.

- •

  **G2C\_ENOPARAM** Parameter not found.

**Author**

Ed Hartnett

**Date**

9/19/22

Definition at line **1091** of file **g2cparams.c**.

References **G2C\_MAX\_NOAA\_ABBREV\_LEN**, **G2C\_MAX\_NOAA\_PARAMS**, **G2C\_NOERROR**, **LOG**, and **param**.

Referenced by **g2c\_degrib2()**, and **g2c\_log\_section()**.

### int g2c\_param\_all (int param\_idx, int \* g1num, int \* g1ver, int \* g2disc, int \* g2cat, int \* g2num, char \* abbrev)

Return all the information about a parameter.

**Parameters**

*param\_idx* Parameter index between 0 and **G2C\_MAX\_NOAA\_PARAMS**. \
 *g1num* Pointer that gets the GRIB1 parameter. Ignored if NULL. \
 *g1ver* Pointer that gets the GRIB1 parameter table version number. Ignored if NULL. \
 *g2disc* Pointer that gets the GRIB2 discipline number. Ignored if NULL. \
 *g2cat* Pointer that gets the GRIB2 category number. Ignored if NULL. \
 *g2num* Pointer that gets the GRIB2 parameter number. Ignored if NULL. \
 *abbrev* Pointer that gets the abbreviation.

**Returns**

- •

  **G2C\_NOERROR** No error.

- •

  **G2C\_EINVAL** Invalid input.

- •

  **G2C\_EFILE** Error reading CSV file.

- •

  **G2C\_ENOPARAM** Parameter not found.

**Author**

Ed Hartnett

**Date**

9/19/22

Definition at line **1185** of file **g2cparams.c**.

References **g2c\_param::g1num**, **g2c\_param::g1ver**, **G2C\_EINVAL**, **G2C\_MAX\_NOAA\_ABBREV\_LEN**, **G2C\_MAX\_NOAA\_PARAMS**, **G2C\_NOERROR**, **g2c\_param::g2cat**, **g2c\_param::g2disc**, **g2c\_param::g2num**, and **param**.

### int g2c\_param\_g1tog2 (int g1num, int g1ver, int \* g2disc, int \* g2cat, int \* g2num)

Translate GRIB1 parameter to GRIB2 parameter.

**Parameters**

*g1num* The GRIB1 parameter. \
 *g1ver* The GRIB1 parameter table version number. \
 *g2disc* Pointer that gets the GRIB2 discipline number. Ignored if NULL. \
 *g2cat* Pointer that gets the GRIB2 category number. Ignored if NULL. \
 *g2num* Pointer that gets the GRIB2 parameter number. Ignored if NULL.

**Returns**

- •

  **G2C\_NOERROR** No error.

- •

  **G2C\_EFILE** Error reading CSV file.

- •

  **G2C\_ENOPARAM** Parameter not found.

**Author**

Ed Hartnett

**Date**

9/19/22

Definition at line **1051** of file **g2cparams.c**.

References **G2C\_ENOPARAM**, **G2C\_MAX\_NOAA\_PARAMS**, **G2C\_NOERROR**, **g2c\_param::g2cat**, **g2c\_param::g2disc**, **g2c\_param::g2num**, and **param**.

### int g2c\_param\_g2tog1 (int g2disc, int g2cat, int g2num, int \* g1num, int \* g1ver)

Translate GRIB2 parameter to GRIB1 parameter.

**Parameters**

*g2disc* The GRIB2 discipline number. \
 *g2cat* The GRIB2 category number. \
 *g2num* The GRIB2 parameter number. \
 *g1num* Pointer that gets the GRIB1 parameter. Ignored if NULL. \
 *g1ver* Pointer that gets the GRIB1 parameter table version number. Ignored if NULL.

**Returns**

- •

  **G2C\_NOERROR** No error.

- •

  **G2C\_EFILE** Error reading CSV file.

- •

  **G2C\_ENOPARAM** Parameter not found.

**Author**

Ed Hartnett

**Date**

9/19/22

Definition at line **1136** of file **g2cparams.c**.

References **g2c\_param::g1num**, **g2c\_param::g1ver**, **G2C\_ENOPARAM**, **G2C\_MAX\_NOAA\_PARAMS**, **G2C\_NOERROR**, **LOG**, and **param**.

## Variable Documentation

### G2C\_PARAM\_T param\[G2C\_MAX\_NOAA\_PARAMS\]` [static]`

An array of parameter information.

Definition at line **14** of file **g2cparams.c**.

Referenced by **g2c\_param\_abbrev()**, **g2c\_param\_all()**, **g2c\_param\_g1tog2()**, and **g2c\_param\_g2tog1()**.

## Author

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