drstemplates.c(3)
π¦ drstemplates.c β the manual, bestie edition π¦
okay so this is the drstemplates.c(3) page from the Library Functions Manual, and it's literally all about the functions, structs, and data for Data Representation Templates (DRT). no cap. π
β¨ 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). that's the whole vibe. π§
every template has three parts, and yes we're listing them:
- the number of entries in the template (
mapdrslen). - a map of the template (
mapdrs), which contains the number of octets in which to pack each of the template values. - 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 π β arraymapdrscontains the number of octets in which the corresponding template values will be stored. a negative value inmapdrsis 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 inmapdrsindicates 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 inmapdrs. lowkey important, don't skip it. π
β Program History Log β
2001-06-28β Gilbert β Initial2009-01-14β Vuong β Changed structure name template to gtemplate2022-10-18β Hartnett β Addedg2c_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. so like, it can't do it alone, it needs the receipts first. periodt. β¨
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. (iconic of them honestly.)
Parameters
drs_template_numβ the DRS template number.maplenβ pointer that gets the length of the map. ignored ifNULL.mapβ pointer that gets the map as an array ofint. memory must be allocated by caller. ignored ifNULL.needextβ pointer that a non-zero value if an extension to this template is needed. ignored ifNULL.
Returns
G2C_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().
π g2int getdrsindex (g2int number) [static] π
this function returns the index of specified Data Representation Template. it's giving lookup-table energy. π₯
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. so much info, so little time. π«Ά
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. (yes, "Stuct". we said what we said. it's in the original, we're keeping it fr fr. π)
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. it wrote itself basically. main character energy.
aaaand that's the whole page bestie, ily, go forth and unpack those octet maps. πβ¨π
this was NCEPLIBS-g2c, Version 2.3.0, page drstemplates.c(3) β see u in the next manpage, slay π
π¦
π¦ where this page comes from
- ubuntu resolute: libg2c-dev 2.3.0-4 Β· LGPL-3.0-only
- ubuntu stonking: libg2c-dev 2.3.0-7 Β· LGPL-3.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms