.TH "g2_addgrid.c" 3 "Tue May 3 2022" "Version 1.6.4" "NCEPLIBS-g2c" \" -*- nroff -*- .ad l .nh .SH NAME g2_addgrid.c \- Pack up a Grid Definition Section (Section 3) and adds it to a GRIB2 message\&. .SH SYNOPSIS .br .PP \fC#include \fP .br \fC#include \fP .br \fC#include 'grib2\&.h'\fP .br .SS "Functions" .in +1c .ti -1c .RI "\fBg2int\fP \fBg2_addgrid\fP (unsigned char *cgrib, \fBg2int\fP *igds, \fBg2int\fP *igdstmpl, \fBg2int\fP *ideflist, \fBg2int\fP idefnum)" .br .RI "This routine packs up a Grid Definition Section (Section 3) and adds it to a GRIB2 message\&. " .in -1c .SH "Detailed Description" .PP Pack up a Grid Definition Section (Section 3) and adds it to a GRIB2 message\&. .PP \fBAuthor\fP .RS 4 Stephen Gilbeert .RE .PP \fBDate\fP .RS 4 2002-11-01 .RE .PP .PP Definition in file \fBg2_addgrid\&.c\fP\&. .SH "Function Documentation" .PP .SS "\fBg2int\fP g2_addgrid (unsigned char * cgrib, \fBg2int\fP * igds, \fBg2int\fP * igdstmpl, \fBg2int\fP * ideflist, \fBg2int\fP idefnum)" .PP This routine packs up a Grid Definition Section (Section 3) and adds it to a GRIB2 message\&. It is used with routines \fBg2_create()\fP, \fBg2_addlocal()\fP, \fBg2_addfield()\fP, and \fBg2_gribend()\fP to create a complete GRIB2 message\&. \fBg2_create()\fP must be called first to initialize a new GRIB2 message\&. .PP \fBParameters\fP .RS 4 \fIcgrib\fP Char array that contains the GRIB2 message to which section should be added\&. Must be allocated large enough to store the entire GRIB2 message\&. .br \fIigds\fP Contains information needed for GRIB Grid Definition Section 3\&. Must be dimensioned >= 5\&. .IP "\(bu" 2 igds[0] Source of grid definition (see Code Table 3\&.0) .IP "\(bu" 2 igds[1] Number of grid points in the defined grid\&. .IP "\(bu" 2 igds[2] Number of octets needed for each additional grid points definition\&. Used to define number of points in each row (or column) for non-regular grids\&. = 0, if using regular grid\&. .IP "\(bu" 2 igds[3] Interpretation of list for optional points definition\&. (Code Table 3\&.11) .IP "\(bu" 2 igds[4] Grid Definition Template Number (Code Table 3\&.1) .PP .br \fIigdstmpl\fP Contains the data values for the specified Grid Definition Template (NN=igds[4])\&. Each element of this integer array contains an entry (in the order specified) of Grid Defintion Template 3\&.NN .br \fIideflist\fP (Used if igds[2] != 0) This array contains the number of grid points contained in each row (or column)\&. .br \fIidefnum\fP (Used if igds[2] != 0) The number of entries in array ideflist\&. i\&.e\&. number of rows (or columns) for which optional grid points are defined\&. .RE .PP \fBReturns\fP .RS 4 .IP "\(bu" 2 > 0 Current size of updated GRIB2 message .IP "\(bu" 2 -1 GRIB message was not initialized\&. Need to call routine gribcreate first\&. .IP "\(bu" 2 -2 GRIB message already complete\&. Cannot add new section\&. .IP "\(bu" 2 -3 Sum of Section byte counts doesn't add to total byte count .IP "\(bu" 2 -4 Previous Section was not 1, 2 or 7\&. .IP "\(bu" 2 -5 Could not find requested Grid Definition Template\&. .PP .RE .PP \fBNote\fP .RS 4 The Grid Def Section ( Section 3 ) can only follow Section 1, 2 or Section 7 in a GRIB2 message\&. .RE .PP PROGRAM HISTORY LOG .IP "\(bu" 2 2002-11-01 Gilbert .IP "\(bu" 2 2009-01-14 Vuong Changed structure name template to gtemplate .PP .PP \fBAuthor\fP .RS 4 Stephen Gilbeert .RE .PP \fBDate\fP .RS 4 2002-11-01 .RE .PP .PP Definition at line 60 of file g2_addgrid\&.c\&. .PP References gtemplate::ext, extgridtemplate(), gtemplate::extlen, gbit(), getgridtemplate(), gtemplate::map, gtemplate::maplen, gtemplate::needext, sbit(), and sbits()\&. .SH "Author" .PP Generated automatically by Doxygen for NCEPLIBS-g2c from the source code\&.