Provided by: libg2c-dev_2.1.0-1_amd64 bug

NAME

       drstemplates.c - Functions, Structures, and Data for Data Representation Templates (DRT).

SYNOPSIS

       #include 'grib2_int.h'

   Functions
       gtemplate * extdrstemplate (g2int number, g2int *list)
           This subroutine generates the remaining octet map for a given Data Representation Template, if
           required.
       int g2c_get_drs_template (int drs_template_num, int *maplen, int *map, int *needext)
           Get DRS template information.
       static g2int getdrsindex (g2int number)
           This function returns the index of specified Data Representation Template.
       gtemplate * getdrstemplate (g2int number)
           This subroutine returns DRS template information for a specified Data Representation Template.

   Variables
       static const struct drstemplate templatesdrs [G2C_MAX_DRS_TEMPLATE]
           Stuct holding data for GRIB2 Data Representation Section (DRS) template.

Detailed Description

       Functions, Structures, and Data for Data Representation Templates (DRT).

       Each Template has three parts:

       1.  The number of entries in the template (mapdrslen).

       2.  A  map  of  the  template  (mapdrs), which contains the number of octets in which to pack each of the
           template values.

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

       Note
           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.

   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 g2c_get_drs_template().    2023-09-08   Engle
       Added template 5.42.    2025-01-06   Stahl   Added template 5.53

       Author
           Stephen Gilbert

       Date
           2001-06-28

       Definition in file drstemplates.c.

Function Documentation

   gtemplate * extdrstemplate (g2int number, g2int * list)
       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.

       Parameters
           number The number of the Data Representation Template that is being requested.
           list The list of values for each entry in the the Data Representation Template.

       Returns
           Pointer to the returned template struct. Returns NULL pointer, if template not found.

       Author
           Stephen Gilbert

       Date
           2000-05-11

       Definition at line 218 of file drstemplates.c.

       References getdrsindex(), and getdrstemplate().

       Referenced by g2_unpack5().

   int g2c_get_drs_template (int drs_template_num, int * maplen, int * map, int * needext)
       Get DRS template information. The DRS template consists of a template map, and its length. There  are  no
       supported DRS templates with extensions.

       Parameters
           drs_template_num The DRS template number.
           maplen Pointer that gets the length of the map. Ignored if NULL.
           map  Pointer  that  gets  the  map as an array of int. Memory must be allocated by caller. Ignored if
           NULL.
           needext Pointer that a non-zero value if an extension to this template is needed. Ignored if NULL.

       ReturnsG2C_NOERROR No error.

           • G2C_ENOTEMPLATE Template not found.

       Author
           Ed Hartnett

       Date
           10/18/22

       Definition at line 266 of file drstemplates.c.

       References G2C_ENOTEMPLATE, G2C_MAX_DRS_TEMPLATE, G2C_NOERROR, and templatesdrs.

       Referenced by g2c_rw_section5_metadata().

   static g2int getdrsindex (g2int number) [static]
       This function returns the index of specified Data Representation Template.

       Parameters
           number The number of the Data Representation Template that is being requested.

       Returns
           Index of the DRT in array gtemplates, if it exists. -1, otherwise.

       Author
           Stephen Gilbert

       Date
           2001-06-28

       Definition at line 140 of file drstemplates.c.

       References G2C_MAX_DRS_TEMPLATE, getdrsindex(), and templatesdrs.

       Referenced by extdrstemplate(), getdrsindex(), and getdrstemplate().

   gtemplate * getdrstemplate (g2int number)
       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.

       Parameters
           number The number of the Data Representation Template that is being requested.

       Returns
           Pointer to the returned template struct. Returns NULL if template not found.

       Author
           Stephen Gilbert

       Date
           2000-05-11

       Definition at line 172 of file drstemplates.c.

       References getdrsindex(), and templatesdrs.

       Referenced by extdrstemplate(), g2_addfield(), and g2_unpack5().

Variable Documentation

   const struct drstemplate templatesdrs[G2C_MAX_DRS_TEMPLATE] [static]
       Stuct holding data for GRIB2 Data Representation Section (DRS) template.

       Definition at line 54 of file drstemplates.c.

       Referenced by g2c_get_drs_template(), getdrsindex(), and getdrstemplate().

Author

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

NCEPLIBS-g2c                                      Version 2.1.0                                drstemplates.c(3)