.TH "drstemplates.c" 3 "Version 2.2.0" "NCEPLIBS-g2c" \" -*- nroff -*-
.ad l
.nh
.SH NAME
drstemplates.c \- Functions, Structures, and Data for Data Representation Templates (DRT)\&.  

.SH SYNOPSIS
.br
.PP
\fC#include 'grib2_int\&.h'\fP
.br

.SS "Functions"

.in +1c
.ti -1c
.RI "\fBgtemplate\fP * \fBextdrstemplate\fP (\fBg2int\fP number, \fBg2int\fP *list)"
.br
.RI "This subroutine generates the remaining octet map for a given Data Representation Template, if required\&. "
.ti -1c
.RI "int \fBg2c_get_drs_template\fP (int drs_template_num, int *maplen, int *map, int *needext)"
.br
.RI "Get DRS template information\&. "
.ti -1c
.RI "static \fBg2int\fP \fBgetdrsindex\fP (\fBg2int\fP number)"
.br
.RI "This function returns the index of specified Data Representation Template\&. "
.ti -1c
.RI "\fBgtemplate\fP * \fBgetdrstemplate\fP (\fBg2int\fP number)"
.br
.RI "This subroutine returns DRS template information for a specified Data Representation Template\&. "
.in -1c
.SS "Variables"

.in +1c
.ti -1c
.RI "static const struct drstemplate \fBtemplatesdrs\fP [\fBG2C_MAX_DRS_TEMPLATE\fP]"
.br
.RI "Stuct holding data for GRIB2 Data Representation Section (DRS) template\&. "
.in -1c
.SH "Detailed Description"
.PP 
Functions, Structures, and Data for Data Representation Templates (DRT)\&. 

Each Template has three parts:
.IP "1." 4
The number of entries in the template (mapdrslen)\&.
.IP "2." 4
A map of the template (mapdrs), which contains the number of octets in which to pack each of the template values\&.
.IP "3." 4
A logical value (needext) that indicates whether the Template needs to be extended\&. In some cases the number of entries in a template can vary depending upon values specified in the 'static' part of the template\&. (See Template 5\&.1 as an example\&.)
.PP
.PP
\fBNote\fP
.RS 4
Array mapdrs contains the number of octets in which the corresponding template values will be stored\&. A negative value in mapdrs is used to indicate that the corresponding template entry can contain negative values\&. This information is used later when packing (or unpacking) the template data values\&. Negative data values in GRIB are stored with the left most bit set to one, and a negative number of octets value in mapdrs indicates that this possibility should be considered\&. The number of octets used to store the data value in this case would be the absolute value of the negative value in mapdrs\&.
.RE
.PP
.SS "Program History Log"
Date   Programmer   Comments    2001-06-28   Gilbert   Initial    2009-01-14   Vuong   Changed structure name template to gtemplate    2022-10-18   Hartnett   Added \fBg2c_get_drs_template()\fP\&.    2023-09-08   Engle   Added template 5\&.42\&.    2025-01-06   Stahl   Added template 5\&.53   
.PP
\fBAuthor\fP
.RS 4
Stephen Gilbert 
.RE
.PP
\fBDate\fP
.RS 4
2001-06-28 
.RE
.PP

.PP
Definition in file \fBdrstemplates\&.c\fP\&.
.SH "Function Documentation"
.PP 
.SS "\fBgtemplate\fP * extdrstemplate (\fBg2int\fP number, \fBg2int\fP * list)"

.PP
This subroutine generates the remaining octet map for a given Data Representation Template, if required\&. Some Templates can vary depending on data values given in an earlier part of the Template, and it is necessary to know some of the earlier entry values to generate the full octet map of the Template\&.
.PP
\fBParameters\fP
.RS 4
\fInumber\fP The number of the Data Representation Template that is being requested\&. 
.br
\fIlist\fP The list of values for each entry in the the Data Representation Template\&.
.RE
.PP
\fBReturns\fP
.RS 4
Pointer to the returned template struct\&. Returns NULL pointer, if template not found\&.
.RE
.PP
\fBAuthor\fP
.RS 4
Stephen Gilbert 
.RE
.PP
\fBDate\fP
.RS 4
2000-05-11 
.RE
.PP

.PP
Definition at line \fB218\fP of file \fBdrstemplates\&.c\fP\&.
.PP
References \fBgetdrsindex()\fP, and \fBgetdrstemplate()\fP\&.
.PP
Referenced by \fBg2_unpack5()\fP\&.
.SS "int g2c_get_drs_template (int drs_template_num, int * maplen, int * map, int * needext)"

.PP
Get DRS template information\&. The DRS template consists of a template map, and its length\&. There are no supported DRS templates with extensions\&.
.PP
\fBParameters\fP
.RS 4
\fIdrs_template_num\fP The DRS template number\&. 
.br
\fImaplen\fP Pointer that gets the length of the map\&. Ignored if NULL\&. 
.br
\fImap\fP Pointer that gets the map as an array of int\&. Memory must be allocated by caller\&. Ignored if NULL\&. 
.br
\fIneedext\fP Pointer that a non-zero value if an extension to this template is needed\&. Ignored if NULL\&.
.RE
.PP
\fBReturns\fP
.RS 4
.IP "\(bu" 2
\fBG2C_NOERROR\fP No error\&.
.IP "\(bu" 2
\fBG2C_ENOTEMPLATE\fP Template not found\&.
.PP
.RE
.PP
\fBAuthor\fP
.RS 4
Ed Hartnett 
.RE
.PP
\fBDate\fP
.RS 4
10/18/22 
.RE
.PP

.PP
Definition at line \fB266\fP of file \fBdrstemplates\&.c\fP\&.
.PP
References \fBG2C_ENOTEMPLATE\fP, \fBG2C_MAX_DRS_TEMPLATE\fP, \fBG2C_NOERROR\fP, and \fBtemplatesdrs\fP\&.
.PP
Referenced by \fBg2c_rw_section5_metadata()\fP\&.
.SS "static \fBg2int\fP getdrsindex (\fBg2int\fP number)\fC [static]\fP"

.PP
This function returns the index of specified Data Representation Template\&. 
.PP
\fBParameters\fP
.RS 4
\fInumber\fP The number of the Data Representation Template that is being requested\&.
.RE
.PP
\fBReturns\fP
.RS 4
Index of the DRT in array gtemplates, if it exists\&. -1, otherwise\&.
.RE
.PP
\fBAuthor\fP
.RS 4
Stephen Gilbert 
.RE
.PP
\fBDate\fP
.RS 4
2001-06-28 
.RE
.PP

.PP
Definition at line \fB140\fP of file \fBdrstemplates\&.c\fP\&.
.PP
References \fBG2C_MAX_DRS_TEMPLATE\fP, \fBgetdrsindex()\fP, and \fBtemplatesdrs\fP\&.
.PP
Referenced by \fBextdrstemplate()\fP, \fBgetdrsindex()\fP, and \fBgetdrstemplate()\fP\&.
.SS "\fBgtemplate\fP * getdrstemplate (\fBg2int\fP number)"

.PP
This subroutine returns DRS template information for a specified Data Representation Template\&. The number of entries in the template is returned along with a map of the number of octets occupied by each entry\&. Also, a flag is returned to indicate whether the template would need to be extended\&.
.PP
\fBParameters\fP
.RS 4
\fInumber\fP The number of the Data Representation Template that is being requested\&.
.RE
.PP
\fBReturns\fP
.RS 4
Pointer to the returned template struct\&. Returns NULL if template not found\&.
.RE
.PP
\fBAuthor\fP
.RS 4
Stephen Gilbert 
.RE
.PP
\fBDate\fP
.RS 4
2000-05-11 
.RE
.PP

.PP
Definition at line \fB172\fP of file \fBdrstemplates\&.c\fP\&.
.PP
References \fBgetdrsindex()\fP, and \fBtemplatesdrs\fP\&.
.PP
Referenced by \fBextdrstemplate()\fP, \fBg2_addfield()\fP, and \fBg2_unpack5()\fP\&.
.SH "Variable Documentation"
.PP 
.SS "const struct drstemplate templatesdrs[\fBG2C_MAX_DRS_TEMPLATE\fP]\fC [static]\fP"

.PP
Stuct holding data for GRIB2 Data Representation Section (DRS) template\&. 
.PP
Definition at line \fB54\fP of file \fBdrstemplates\&.c\fP\&.
.PP
Referenced by \fBg2c_get_drs_template()\fP, \fBgetdrsindex()\fP, and \fBgetdrstemplate()\fP\&.
.SH "Author"
.PP 
Generated automatically by Doxygen for NCEPLIBS-g2c from the source code\&.
