NCEPLIBS-g2c  1.8.0
g2cparams.c File Reference

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

#include "grib2_int.h"

Go to the source code of this file.

Macros

#define CSV_FILE   "noaa_grib2_params.csv"
 The name of the CSV file which contains the NOAA abbreviations. More...
 

Functions

int g2c_param_abbrev (int g2disc, int g2cat, int g2num, char *abbrev)
 Get NOAA abbreviation for a GRIB2 parameter. More...
 
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. More...
 
int g2c_param_g1tog2 (int g1num, int g1ver, int *g2disc, int *g2cat, int *g2num)
 Translate GRIB1 parameter to GRIB2 parameter. More...
 
int g2c_param_g2tog1 (int g2disc, int g2cat, int g2num, int *g1num, int *g1ver)
 Translate GRIB2 parameter to GRIB1 parameter. More...
 

Variables

static G2C_PARAM_T param [G2C_MAX_NOAA_PARAMS]
 An array of parameter information. More...
 

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

◆ CSV_FILE

#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

◆ g2c_param_abbrev()

int g2c_param_abbrev ( int  g2disc,
int  g2cat,
int  g2num,
char *  abbrev 
)

Get NOAA abbreviation for a GRIB2 parameter.

Parameters
g2discThe GRIB2 discipline number.
g2catThe GRIB2 category number.
g2numThe GRIB2 parameter number.
abbrevPointer that gets the abbreviation. Ignored if NULL.
Returns
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().

◆ g2c_param_all()

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_idxParameter index between 0 and G2C_MAX_NOAA_PARAMS.
g1numPointer that gets the GRIB1 parameter. Ignored if NULL.
g1verPointer that gets the GRIB1 parameter table version number. Ignored if NULL.
g2discPointer that gets the GRIB2 discipline number. Ignored if NULL.
g2catPointer that gets the GRIB2 category number. Ignored if NULL.
g2numPointer that gets the GRIB2 parameter number. Ignored if NULL.
abbrevPointer that gets the abbreviation.
Returns
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.

◆ g2c_param_g1tog2()

int g2c_param_g1tog2 ( int  g1num,
int  g1ver,
int *  g2disc,
int *  g2cat,
int *  g2num 
)

Translate GRIB1 parameter to GRIB2 parameter.

Parameters
g1numThe GRIB1 parameter.
g1verThe GRIB1 parameter table version number.
g2discPointer that gets the GRIB2 discipline number. Ignored if NULL.
g2catPointer that gets the GRIB2 category number. Ignored if NULL.
g2numPointer that gets the GRIB2 parameter number. Ignored if NULL.
Returns
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.

◆ g2c_param_g2tog1()

int g2c_param_g2tog1 ( int  g2disc,
int  g2cat,
int  g2num,
int *  g1num,
int *  g1ver 
)

Translate GRIB2 parameter to GRIB1 parameter.

Parameters
g2discThe GRIB2 discipline number.
g2catThe GRIB2 category number.
g2numThe GRIB2 parameter number.
g1numPointer that gets the GRIB1 parameter. Ignored if NULL.
g1verPointer that gets the GRIB1 parameter table version number. Ignored if NULL.
Returns
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

◆ param

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().