table of contents
g2_unpack7.c(3) | NCEPLIBS-g2c | g2_unpack7.c(3) |
NAME¶
g2_unpack7.c - Unpack Section 7 (Data Section) as defined in GRIB Edition 2.
SYNOPSIS¶
#include <stdio.h>
#include <stdlib.h>
#include <memory.h>
#include <string.h>
#include 'grib2.h'
Functions¶
int comunpack (unsigned char *, g2int, g2int,
g2int *, g2int, g2float *)
This subroutine unpacks a data field that was packed using a complex packing
algorithm as defined in the GRIB2 documention, using info from the GRIB2
Data Representation Template 5.2 or 5.3. g2int g2_unpack7
(unsigned char *cgrib, g2int *iofst, g2int igdsnum,
g2int *igdstmpl, g2int idrsnum, g2int *idrstmpl,
g2int ndpts, g2float **fld)
This subroutine unpacks Section 7 (Data Section) as defined in GRIB Edition 2.
g2int jpcunpack (unsigned char *, g2int, g2int
*, g2int, g2float *)
This subroutine unpacks a data field that was packed into a JPEG2000 code
stream using info from the GRIB2 Data Representation Template 5.40 or
5.40000. g2int pngunpack (unsigned char *, g2int,
g2int *, g2int, g2float *)
This subroutine unpacks a data field that was packed into a PNG image format
using info from the GRIB2 Data Representation Template 5.41 or 5.40010.
g2int simunpack (unsigned char *, g2int *,
g2int, g2float *)
This subroutine unpacks a data field that was packed using a simple packing
algorithm as defined in the GRIB2 documention, using info from the GRIB2
Data Representation Template 5.0. g2int specunpack (unsigned
char *, g2int *, g2int, g2int, g2int,
g2int, g2float *)
This subroutine unpacks a spectral data field that was packed using the
complex packing algorithm for spherical harmonic data as defined in the
GRIB2 documention, using info from the GRIB2 Data Representation Template
5.51.
Detailed Description¶
Unpack Section 7 (Data Section) as defined in GRIB Edition 2.
Author
Date
Definition in file g2_unpack7.c.
Function Documentation¶
int comunpack (unsigned char * cpack, g2int lensec, g2int idrsnum, g2int * idrstmpl, g2int ndpts, g2float * fld)¶
This subroutine unpacks a data field that was packed using a complex packing algorithm as defined in the GRIB2 documention, using info from the GRIB2 Data Representation Template 5.2 or 5.3. Supports GRIB2 complex packing templates with or without spatial differences (i.e. DRTs 5.2 and 5.3).
PROGRAM HISTORY LOG:
- 2002-10-29 Gilbert
- 2004-12-16 Gilbert Added test (provided by Arthur Taylor/MDL) to verify that group widths and lengths are consistent with section length.
Parameters
lensec length of section 7 (used for error checking).
idrsnum Data Representation Template number 5.N Must equal 2 or 3.
idrstmpl pointer to the array of values for Data Representation Template 5.2 or 5.3
ndpts The number of data values to unpack
fld Contains the unpacked data values. fld must be allocated with at least ndpts*sizeof(g2float) bytes before calling this routine.
Returns
Author
Date
Definition at line 39 of file comunpack.c.
References gbit(), gbits(), int_power(), and rdieee().
Referenced by g2_unpack7().
g2int g2_unpack7 (unsigned char * cgrib, g2int * iofst, g2int igdsnum, g2int * igdstmpl, g2int idrsnum, g2int * idrstmpl, g2int ndpts, g2float ** fld)¶
This subroutine unpacks Section 7 (Data Section) as defined in GRIB Edition 2. PROGRAM HISTORY LOG:
- 2002-10-31 Gilbert
- 2002-12-20 Gilbert - Added GDT info to arguments and added 5.51 processing.
- 2003-08-29 Gilbert - Added support for new templates using PNG and JPEG2000 algorithms/templates.
- 2004-11-29 Gilbert - JPEG2000 now allowed to use WMO Template no. 5.40 PNG now allowed to use WMO Template no. 5.41
- 2004-12-16 Taylor - Added check on comunpack return code.
- 2008-12-23 Wesley - Initialize Number of data points unpacked
Parameters
iofst Bit offset of the beginning of Section 7 in cgrib.
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 unpacked and returned.
fld Pointer to a float array containing the unpacked data field.
Returns
- 0 no error
- 2 Not section 7
- 4 Unrecognized Data Representation Template
- 5 need one of GDT 3.50 through 3.53 to decode DRT 5.51
- 6 memory allocation error
- 7 corrupt section 7.
Author
Date
Definition at line 66 of file g2_unpack7.c.
References comunpack(), gbit(), jpcunpack(), pngunpack(), rdieee(), simunpack(), and specunpack().
Referenced by g2_getfld().
g2int jpcunpack (unsigned char * cpack, g2int len, g2int * idrstmpl, g2int ndpts, g2float * fld)¶
This subroutine unpacks a data field that was packed into a JPEG2000 code stream using info from the GRIB2 Data Representation Template 5.40 or 5.40000.
Parameters
len length of packed field cpack.
idrstmpl Pointer to array of values for Data Representation Template 5.40 or 5.40000.
ndpts The number of data values to unpack.
fld Contains the unpacked data values.
Returns
Author
Date
Definition at line 29 of file jpcunpack.c.
References dec_jpeg2000(), int_power(), and rdieee().
Referenced by g2_unpack7().
g2int pngunpack (unsigned char * cpack, g2int len, g2int * idrstmpl, g2int ndpts, g2float * fld)¶
This subroutine unpacks a data field that was packed into a PNG image format using info from the GRIB2 Data Representation Template 5.41 or 5.40010.
Parameters
len length of packed field cpack().
idrstmpl Pointer to array of values for Data Representation Template 5.41 or 5.40010.
ndpts The number of data values to unpack.
fld Contains the unpacked data values.
Returns
Author
Date
Definition at line 27 of file pngunpack.c.
References dec_png(), gbits(), int_power(), and rdieee().
Referenced by g2_unpack7().
g2int simunpack (unsigned char * cpack, g2int * idrstmpl, g2int ndpts, g2float * fld)¶
This subroutine unpacks a data field that was packed using a simple packing algorithm as defined in the GRIB2 documention, using info from the GRIB2 Data Representation Template 5.0.
Parameters
idrstmpl pointer to the array of values for Data Representation Template 5.0.
ndpts The number of data values to unpack.
fld Contains the unpacked data values. fld must be allocated with at least ndpts*sizeof(g2float) bytes before calling this routine.
Returns
Author
Date
Definition at line 26 of file simunpack.c.
References gbits(), int_power(), and rdieee().
Referenced by g2_unpack7().
g2int specunpack (unsigned char * cpack, g2int * idrstmpl, g2int ndpts, g2int JJ, g2int KK, g2int MM, g2float * fld)¶
This subroutine unpacks a spectral data field that was packed using the complex packing algorithm for spherical harmonic data as defined in the GRIB2 documention, using info from the GRIB2 Data Representation Template 5.51.
Parameters
idrstmpl pointer to the array of values for Data Representation Template 5.51.
ndpts The number of data values to unpack (real and imaginary parts).
JJ pentagonal resolution parameter.
KK pentagonal resolution parameter.
MM pentagonal resolution parameter.
fld Contains the unpacked data values. fld must be allocated with at least ndpts*sizeof(g2float) bytes before calling this routine.
Returns
Author
Date
Definition at line 34 of file specunpack.c.
References gbits(), int_power(), and rdieee().
Referenced by g2_unpack7().
Author¶
Generated automatically by Doxygen for NCEPLIBS-g2c from the source code.
Tue May 3 2022 | Version 1.6.4 |