g2_unpack7.c(3)

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

g2_unpack7.c πŸ’–

okay bestie, welcome to the g2_unpack7.c manual page, a.k.a. the glow-up guide to the GRIB2 Section 7 (that's the Data Section, the one with the actual numbers in it πŸ‘‘). this lives in the g2_unpack7.c(3) corner of the library functions manual. let's get into it ✨


✨ NAME ✨

g2_unpack7.c β€” Unpack Section 7 (Data Section) of a GRIB2 message.


πŸŽ€ SYNOPSIS πŸŽ€

#include 'grib2_int.h'
#include <memory.h>
#include <string.h>

πŸ’… Functions

  • g2int g2_unpack7 (unsigned char *cgrib, g2int *iofst, g2int igdsnum, g2int *igdstmpl, g2int idrsnum, g2int *idrstmpl, g2int ndpts, float **fld) β€” This subroutine unpacks Section 7 (Data Section) of a GRIB2 message.
  • int g2c_unpack7 (unsigned char *cgrib, int igdsnum, int gds_tmpl_len, long long int *gdstmpl, int idrsnum, int drs_tmpl_len, long long int *drstmpl, int ndpts, float *fld) β€” This subroutine unpacks Section 7 (Data Section) of a GRIB2 message.
  • static g2int g2c_unpack7_int (unsigned char *cgrib, g2int *iofst, g2int igdsnum, g2int *igdstmpl, g2int idrsnum, g2int *idrstmpl, g2int ndpts, int v1, float **fld) β€” Unpacks Section 7 (Data Section) of a GRIB2 message.

🌸 Detailed Description 🌸

Unpack Section 7 (Data Section) of a GRIB2 message.

no cap, that's the whole vibe of this file. it takes the packed-up data section and hands you back actual numbers πŸ¦‹

Author

Stephen Gilbert

Date

2002-10-31

πŸ“œ Program History Log

the receipts, in order πŸ’€

  • 2002-10-31 β€” Gilbert β€” Initial
  • 2002-12-20 β€” Gilbert β€” Added GDT info to arguments and added 5.51 processing.
  • 2003-08-29 β€” Gilbert β€” New templates using PNG and JPEG2000 algorithms/templates.
  • 2004-11-29 β€” Gilbert β€” JPEG2000 now allowed to use WMO Template 5.40 PNG allowed to use 5.41
  • 2004-12-16 β€” Taylor β€” Added check on comunpack return code.
  • 2008-12-23 β€” Wesley β€” Initialize Number of data points unpacked.
  • 2022-10-04 β€” Hartnett β€” Added g2c_unpack7().
  • 2023-10-16 β€” Engle β€” Added support for DRT 5.42, AEC compression.

Definition in file g2_unpack7.c.


⭐ Function Documentation ⭐

🧚 g2int g2_unpack7 (unsigned char * cgrib, g2int * iofst, g2int igdsnum, g2int * igdstmpl, g2int idrsnum, g2int * idrstmpl, g2int ndpts, float ** fld)

This subroutine unpacks Section 7 (Data Section) of a GRIB2 message. This function is maintained for backward compatibility. Users may wish to use the newer g2c_unpack7() function instead.

bestie heads up: this one is the legacy era. it still works, it's just not the main character anymore β€” g2c_unpack7() is the newer one. πŸ’…

Parameters

  • cgrib β€” char array containing Section 7 of the GRIB2 message
  • iofst β€” Pointer to a bit offset of the beginning of Section 7 in cgrib. This is updated by this function to reflect the data read in this function. After this function is successfully called, the value pointed to by iofst will be the number of bits to the end of section 7 in cbuf.
  • igdsnum β€” Grid Definition Template Number (see Code Table 3.0). (Only used for DRS Template 5.51.)
  • igdstmpl β€” Pointer to an integer array containing the data values for the specified Grid Definition Template (N=igdsnum). Each element of this integer array contains an entry (in the order specified) of Grid Definition Template 3.N. (Only used for DRS Template 5.51).
  • idrsnum β€” Data Representation Template Number (see Code Table 5.0).
  • idrstmpl β€” Pointer to an integer array containing the data values for the specified Data Representation Template (N=idrsnum). Each element of this integer array contains an entry (in the order specified) of Data Representation Template 5.N
  • ndpts β€” Number of data points to be unpacked and returned.
  • fld β€” Pointer to a float pointer which gets a pointer to an array allocated by this function to hold the unpacked data. This memory must be freed by the caller.
⚠️ note: that fld memory is allocated by this function and it is on you to free it. don't just walk away from it, bestie 😭

Returns

  • G2_NO_ERROR β€” No error.
  • G2_UNPACK_BAD_SEC β€” Array passed had incorrect section number.
  • G2_UNPACK7_BAD_DRT β€” Unrecognized Data Representation Template.
  • G2_UNPACK7_WRONG_GDT β€” need one of GDT 3.50 through 3.53 to decode DRT 5.51
  • G2_UNPACK_NO_MEM β€” Memory allocation error.
  • G2_UNPACK7_CORRUPT_SEC β€” Corrupt section 7.

Author

Stephen Gilbert

Date

2002-10-31

Definition at line 214 of file g2_unpack7.c.

References g2c_unpack7_int().

Referenced by g2_getfld().


πŸ¦‹ int g2c_unpack7 (unsigned char * cgrib, int igdsnum, int gds_tmpl_len, long long int * gdstmpl, int idrsnum, int drs_tmpl_len, long long int * drstmpl, int ndpts, float * fld)

This subroutine unpacks Section 7 (Data Section) of a GRIB2 message. This function is the newer version of g2_unpack7().

the upgrade era ✨ if you're writing new code, this is the one you want.

Parameters

  • cgrib β€” char array containing Section 7 of the GRIB2 message
  • igdsnum β€” Grid Definition Template Number (see Code Table 3.0). (Only used for DRS Template 5.51.) May be zero for other templates.
  • gds_tmpl_len β€” Number of elements in the GDS template.
  • gdstmpl β€” Pointer to an integer array containing the data values for the specified Grid Definition Template (N=igdsnum). Each element of this integer array contains an entry (in the order specified) of Grid Definition Template 3.N. (Only used for DRS Template 5.51). May be NULL.
  • idrsnum β€” Data Representation Template Number (see Code Table 5.0).
  • drs_tmpl_len β€” Number of elements in the DRS template.
  • drstmpl β€” Pointer to an integer array containing the data values for the specified Data Representation Template (N=idrsnum). Each element of this integer array contains an entry (in the order specified) of Data Representation Template 5.N
  • ndpts β€” Number of data points to be unpacked and returned.
  • fld β€” Pointer which the data. Memory must be allocated in advance by caller.
πŸ“ important glow-up:</> in this version, fld is not allocated for you. the caller has to allocate that memory in advance. different energy from the old one, fr fr.

Returns

  • G2_NO_ERROR β€” No error.
  • G2_UNPACK_BAD_SEC β€” Array passed had incorrect section number.
  • G2_UNPACK7_BAD_DRT β€” Unrecognized Data Representation Template.
  • G2_UNPACK7_WRONG_GDT β€” need one of GDT 3.50 through 3.53 to decode DRT 5.51
  • G2_UNPACK_NO_MEM β€” Memory allocation error.
  • G2_UNPACK7_CORRUPT_SEC β€” Corrupt section 7.

Author

Stephen Gilbert

Date

2002-10-31

Definition at line 259 of file g2_unpack7.c.

References G2C_EINVAL, G2C_ENOMEM, g2c_unpack7_int(), and LOG.

Referenced by g2c_get_prod().


πŸ’œ g2int g2c_unpack7_int (unsigned char * cgrib, g2int * iofst, g2int igdsnum, g2int * igdstmpl, g2int idrsnum, g2int * idrstmpl, g2int ndpts, int v1, float ** fld) [static]

Unpacks Section 7 (Data Section) of a GRIB2 message. This function is the internal function called by both g2_unpack7() and g2c_unpack7().

the backstage icon πŸ’œ both of the other two call into this one. it's static, so it's not out here for public consumption β€” it's the private group chat.

Parameters

  • cgrib β€” char array containing Section 7 of the GRIB2 message
  • iofst β€” Pointer to a bit offset of the beginning of Section 7 in cgrib. This is updated by this function to reflect the data read in this function. After this function is successfully called, the value pointed to by iofst will be the number of bits to the end of section 7 in cbuf.
  • igdsnum β€” Grid Definition Template Number (see Code Table 3.0). (Only used for DRS Template 5.51. May be 0 for other templates.)
  • igdstmpl β€” Pointer to an integer array containing the data values for the specified Grid Definition Template (N=igdsnum). Each element of this integer array contains an entry (in the order specified) of Grid Definition Template 3.N. (Only used for DRS Template 5.51, may be NULL for other templates).
  • idrsnum β€” Data Representation Template Number (see Code Table 5.0).
  • idrstmpl β€” Pointer to an integer array containing the data values for the specified Data Representation Template (N=idrsnum). Each element of this integer array contains an entry (in the order specified) of Data Representation Template 5.N
  • ndpts β€” Number of data points to be unpacked and returned.
  • v1 β€” If non-zero, then act like the V1 G2C API. This includes:
    • printing error messages to stderr in the event of error.
    • returning V1 error codes.
  • fld β€” Pointer to a float pointer which gets a pointer to an array allocated by this function to hold the unpacked data. This memory must be freed by the caller.
⚠️ yes, this one allocates fld for you too, and yes, you still have to free it. no skipping, bestie 😭

Returns

  • G2_NO_ERROR β€” No error.
  • G2_UNPACK_BAD_SEC β€” Array passed had incorrect section number.
  • G2_UNPACK7_BAD_DRT β€” Unrecognized Data Representation Template.
  • G2_UNPACK7_WRONG_GDT β€” need one of GDT 3.50 through 3.53 to decode DRT 5.51
  • G2_UNPACK_NO_MEM β€” Memory allocation error.
  • G2_UNPACK7_CORRUPT_SEC β€” Corrupt section 7.

Author

Stephen Gilbert

Date

2002-10-31

Definition at line 67 of file g2_unpack7.c.

References aecunpack(), comunpack(), G2_NO_ERROR, G2_UNPACK7_BAD_DRT, G2_UNPACK7_CORRUPT_SEC, G2_UNPACK7_WRONG_GDT, G2_UNPACK_BAD_SEC, G2_UNPACK_NO_MEM, gbit(), jpcunpack(), LOG, pngunpack(), rdieee(), simunpack(), and specunpack().

Referenced by g2_unpack7(), and g2c_unpack7().


πŸ‘‘ Author πŸ‘‘

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


and that's the whole page, bestie 🫢 this was brought to you by NCEPLIBS-g2c, Version 2.3.0, straight from the g2_unpack7.c(3) manual. slay, stay unpacked, and free your memory πŸ’–βœ¨πŸŽ€πŸ¦‹πŸŒΈπŸ’…

πŸ“¦ where this page comes from