NCEPLIBS-g2c 1.9.0
Loading...
Searching...
No Matches
g2_create.c File Reference

Initialize a new GRIB2 message and pack GRIB2 sections 0 (Indicator Section) and 1 (Identification Section). More...

#include <stdio.h>
#include "grib2_int.h"

Go to the source code of this file.

Macros

#define LENSEC0   16
 Length of GRIB Section 0.
 
#define MAPSEC1LEN   13
 Length of Map Section 1.
 

Functions

g2int g2_create (unsigned char *cgrib, g2int *listsec0, g2int *listsec1)
 Initialize a new GRIB2 message and pack GRIB2 Section 0 (Indicator Section) and Section 1 (Identification Section).
 

Detailed Description

Initialize a new GRIB2 message and pack GRIB2 sections 0 (Indicator Section) and 1 (Identification Section).

Author
Stephen Gilbert
Date
2002-10-31

Definition in file g2_create.c.

Macro Definition Documentation

◆ LENSEC0

#define LENSEC0   16

Length of GRIB Section 0.

Definition at line 11 of file g2_create.c.

◆ MAPSEC1LEN

#define MAPSEC1LEN   13

Length of Map Section 1.

Definition at line 10 of file g2_create.c.

Function Documentation

◆ g2_create()

g2int g2_create ( unsigned char *  cgrib,
g2int listsec0,
g2int listsec1 
)

Initialize a new GRIB2 message and pack GRIB2 Section 0 (Indicator Section) and Section 1 (Identification Section).

This routine is used with routines g2_addlocal(), g2_addgrid(), g2_addfield(), and g2_gribend() to create a complete GRIB2 message. g2_create() must be called first to initialize a new GRIB2 message. A call to g2_gribend() is required to complete GRIB2 message after all fields have been added.

Parameters
[in]cgribCharacter array to contain the GRIB2 message. Must be allocated large enough to store the entire GRIB2 message.
[in]listsec0Contains information needed for GRIB Indicator Section 0. Must be dimensioned >= 2.
[in]listsec1Contains information needed for GRIB Identification Section 1. Must be dimensioned >= 13.
Returns
  • > 0 Current size of new GRIB2 message
  • G2_CREATE_GRIB_VERSION Tried to use for version other than GRIB Edition 2

This routine is intended for use with routines g2_addlocal(), g2_addgrid(), g2_addfield(), and g2_gribend() to create a complete GRIB2 message.

Author
Stephen Gilbeert
Date
2002-10-31

Definition at line 68 of file g2_create.c.

References G2_CREATE_GRIB_VERSION, LENSEC0, MAPSEC1LEN, and sbit().