drstemplates.c(3)

πŸ“¦
version 2.3.0 Β· 2 versions
, in ubuntu resolute, ubuntu stonking

πŸ¦‹ 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:

  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. lowkey important, don't skip it. πŸ’€

⭐ Program History Log ⭐

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

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