Scroll to navigation

g2_create.c(3) NCEPLIBS-g2c g2_create.c(3)

NAME

g2_create.c - Initializes a new GRIB2 message and packs GRIB2 sections 0 (Indicator Section) and 1 (Identification Section).

SYNOPSIS

#include <stdio.h>
#include 'grib2.h'

Macros


#define MAPSEC1LEN 13
Length of Map Section 1.

Functions


g2int g2_create (unsigned char *cgrib, g2int *listsec0, g2int *listsec1)
This routine initializes a new GRIB2 message and packs GRIB2 sections 0 (Indicator Section) and 1 (Identification Section).

Detailed Description

Initializes a new GRIB2 message and packs GRIB2 sections 0 (Indicator Section) and 1 (Identification Section).

Author

Stephen Gilbeert

Date

2002-10-31

Definition in file g2_create.c.

Macro Definition Documentation

#define MAPSEC1LEN 13

Length of Map Section 1.

Definition at line 9 of file g2_create.c.

Function Documentation

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

This routine initializes a new GRIB2 message and packs GRIB2 sections 0 (Indicator Section) and 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. Also, a call to g2_gribend() is required to complete GRIB2 message after all fields have been added.

Parameters

cgrib Character array to contain the GRIB2 message. Must be allocated large enough to store the entire GRIB2 message.
listsec0 Contains information needed for GRIB Indicator Section 0. Must be dimensioned >= 2.
  • listsec0[0]=Discipline-GRIB Master Table Number (see Code Table 0.0)
  • listsec0[1]=GRIB Edition Number (currently 2)

listsec1 Contains information needed for GRIB Identification Section 1. Must be dimensioned >= 13.

  • listsec1[0] Id of orginating centre (Common Code Table C-1)
  • listsec1[1] Id of orginating sub-centre (local table)
  • listsec1[2] GRIB Master Tables Version Number (Code Table 1.0)
  • listsec1[3] GRIB Local Tables Version Number (Code Table 1.1)
  • listsec1[4] Significance of Reference Time (Code Table 1.2)
  • listsec1[5] Reference Time - Year (4 digits)
  • listsec1[6] Reference Time - Month
  • listsec1[7] Reference Time - Day
  • listsec1[8] Reference Time - Hour
  • listsec1[9] Reference Time - Minute
  • listsec1[10] Reference Time - Second
  • listsec1[11] Production status of data (Code Table 1.3)
  • listsec1[12] Type of processed data (Code Table 1.4)

Returns

- > 0 Current size of new GRIB2 message
-1 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 52 of file g2_create.c.

References MAPSEC1LEN, and sbit().

Author

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

Tue May 3 2022 Version 1.6.4