g2_addfield.c(3)

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

✨ g2_addfield.c β€” the manual page, but make it cute ✨

okay bestie, this is the g2_addfield.c(3) page from the Library Functions Manual and it is so much more fun than it looks, i promise. it's giving "quiet library nerd who is secretly the main character." let's go πŸ’…


🌸 NAME 🌸

g2_addfield.c β€” pack sections 4 through 7 and add them to a GRIB2 message. that's it, that's the whole vibe. πŸ’–


πŸŽ€ SYNOPSIS πŸŽ€

#include 'grib2_int.h'
#include <stdio.h>
#include <stdlib.h>

πŸ’œ Functions πŸ’œ

  • g2int g2_addfield (unsigned char *cgrib, g2int ipdsnum, g2int *ipdstmpl, float *coordlist, g2int numcoord, g2int idrsnum, g2int *idrstmpl, float *fld, g2int ngrdpts, g2int ibmap, g2int *bmap) β€” pack sections 4 through 7 and adds them to a GRIB2 message.

πŸ¦‹ Detailed Description πŸ¦‹

Pack sections 4 through 7 and add them to a GRIB2 message. yes bestie, that is the entire description, we are nothing if not efficient here 😌

Author Stephen Gilbert

Date 2002-11-05

Definition in file g2_addfield.c.


πŸ‘‘ Function Documentation πŸ‘‘

🌈 g2int g2_addfield (unsigned char * cgrib, g2int ipdsnum, g2int * ipdstmpl, float * coordlist, g2int numcoord, g2int idrsnum, g2int * idrstmpl, float * fld, g2int ngrdpts, g2int ibmap, g2int * bmap) 🌈

Pack sections 4 through 7 and adds them to a GRIB2 message. and the sections in question are, in order, no skipping:

  1. Product Definition Section
  2. Data Representation Section
  3. Bit-Map Section
  4. Data Section

okay so this routine is a whole collab, it does NOT work alone. it's used with g2_create(), g2_addlocal(), g2_addgrid(), and g2_gribend() to create a complete GRIB2 message. the rules of the friend group are:

  • Function g2_create() must be called first to initialize a new GRIB2 message. no exceptions bestie, it's the icebreaker.
  • Function g2_addgrid() must be called after g2_create() and before this routine, to add the appropriate grid description to the GRIB2 message.
  • A call to g2_gribend() is required to complete the GRIB2 message after all fields have been added. it's the "okay bye love u" of the conversation.

πŸ“œ Program History Log πŸ“œ

the receipts, in order:

  • 2002-11-05 β€” Gilbert β€” Initial
  • 2002-12-23 β€” Gilbert β€” Added complex spherical harmonic packing
  • 2003-08-27 β€” Gilbert β€” Added support for new templates using PNG and JPEG2000 algorithms/templates.
  • 2004-11-29 β€” Gilbert β€” JPEG2000 now can use WMO Template 5.40, PNG can use WMO Template 5.41. Added packing algorithm check.
  • 2005-05-10 β€” Gilbert β€” Imposed minimum size on cpack.
  • 2009-01-14 β€” Vuong β€” Changed structure name template to gtemplate
  • 2023-09-08 β€” Engle β€” Added support for new template, 5.42, using CCSDS compression (libaec).

πŸ“ Parameters πŸ“

  • cgrib β€” Char array that contains the GRIB2 message to which sections 4 through 7 should be added. Must be allocated large enough to store the entire GRIB2 message. (yes, large enough, do not play with this one πŸ™ˆ)
  • ipdsnum β€” Product Definition Template Number (see Code Table 4.0).
  • ipdstmpl β€” Contains the data values for the Product Definition Template specified by ipdsnum.
  • coordlist β€” Array containg floating point values intended to document the vertical discretisation associated to model data on hybrid coordinate vertical levels.
  • numcoord β€” number of values in array coordlist.
  • idrsnum β€” Data Representation Template Number (see Code Table 5.0).
  • idrstmpl β€” The data values for the Data Representation Template specified by idrsnum. Note that some values in this template (eg. reference values, number of bits, etc...) may be changed by the data packing algorithms. Use this to specify scaling factors and order of spatial differencing, if desired.
  • fld β€” Array of data points to pack.
  • ngrdpts β€” Number of data points in grid. i.e. size of fld and bmap.
  • ibmap β€” Bitmap indicator (see Code Table 6.0)
    • 0 = bitmap applies and is included in Section 6.
    • 1-253 = Predefined bitmap applies.
    • 254 = Previously defined bitmap applies to this field.
    • 255 = Bit map does not apply to this product.
  • bmap β€” Integer array containing bitmap to be added (if ibmap = 0).

πŸ’« Returns πŸ’«

  • > 0 β€” Current size of updated GRIB2 message. (slay, it worked πŸ’–)
  • G2_ADD_MSG_INIT β€” GRIB message was not initialized. Need to call routine g2_create() first.
  • G2_ADD_MSG_COMPLETE β€” GRIB message already complete. Cannot add new section.
  • G2_BAD_SEC_COUNTS β€” Sum of Section byte counts doesn't add to total byte count.
  • G2_BAD_SEC β€” Previous Section was not 3 or 7.
  • G2_ADDFIELD_BAD_PDT β€” Could not find requested Product Definition Template.
  • G2_ADDFIELD_BAD_GDS β€” Section 3 (GDS) not previously defined in message.
  • G2_ADDFIELD_BAD_DRT β€” Tried to use unsupported Data Representationi Template.
  • G2_ADDFIELD_BAD_BITMAP β€” Specified use of a previously defined bitmap, but one does not exist in the GRIB message.
  • G2_ADDFIELD_BAD_GDT β€” GDT of one of 5.50 through 5.53 required to pack field using DRT 5.51.
  • G2_ADDFIELD_ERR β€” Error packing data field.

πŸ™ˆ Note πŸ™ˆ

Note that the Sections 4 through 7 can only follow Section 3 or Section 7 in a GRIB2 message. it's a strict seating chart, bestie, no moving seats. πŸ’€

Author Stephen Gilbert

Date 2002-11-05

Definition at line 100 of file g2_addfield.c.


🧚 References 🧚

aecpack(), cmplxpack(), gtemplate::ext, gtemplate::extlen, extpdstemplate(), G2_ADD_MSG_COMPLETE, G2_ADD_MSG_INIT, G2_ADDFIELD_BAD_BITMAP, G2_ADDFIELD_BAD_DRT, G2_ADDFIELD_BAD_GDS, G2_ADDFIELD_BAD_GDT, G2_ADDFIELD_BAD_PDT, G2_ADDFIELD_ERR, G2_BAD_SEC, G2_BAD_SEC_COUNTS, g2c_check_msg(), G2C_EMSGCOMPLETE, G2C_ENOTGRIB, gbit(), getdim(), getdrstemplate(), getpdstemplate(), getpoly(), jpcpack(), gtemplate::map, gtemplate::maplen, mkieee(), gtemplate::needext, pngpack(), sbit(), sbits(), simpack(), and specpack().


⭐ Author ⭐

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


okay that's the whole page, you ate that fr fr 🫢 this was NCEPLIBS-g2c Version 2.3.0, and it's dated 2002-11-05 up top but this exact page came from the g2_addfield.c(3) manual, so if you cite it, cite it cute. periodt. πŸ’–βœ¨

πŸ“¦ where this page comes from